Is there an algorithm for price calculation on a bucket with 2 prices?

34 Views Asked by At

Is there some sort of algorithm to calculate the amount of shares on a bucket with 2 prices?

Example: A bucket has 2 assets called A and B. Asset A costs 100 USD and Asset B costs 50 USD. If I buy the bucket, the amount of money I put in gets divided by 50% towards asset A and 50% towards asset b. Lets say I "invest" 100 USD, that means I get 0.5 of asset a and one asset b.

How can I calculate the amount of shares of bucket I should own, in a way that I can reverse the calculation again to get the amount of asset a and b that I should own?

Thanks!