Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )
Wednesday, February 12, 2020
Asset proportions
Suppose you have two assets a and b, each will form a proportion of the total a+b. So if you have 60 units of a and 40 units of b, a/(a+b)=0.6 and b/(a+b)=0.4.
You want to know how b's proportion will change if you add x units to a.
So you're asking how b/(a+b+x) will relate to b/(a+b).
To get b/(a+b+x), divide b/(a+b) by the proportion of the new total a+b+x to the old total a+b.
Eg with the example above, you add 100 units to a. a+b+x=200, a+b=100, the proportion is 200/100=2, divide 0.4 by 2 to get the new proportion for b, 0.2.
Check, b is still 40, a+b+x is 200, 40/200 = 0.2.