portfolio-performance / portfolio

Track and evaluate the performance of your investment portfolio across stocks, cryptocurrencies, and other assets.
http://www.portfolio-performance.info
Eclipse Public License 1.0
2.96k stars 606 forks source link

support negative & above 100% weights for portfolio allocation #2415

Open mknudsen opened 3 years ago

mknudsen commented 3 years ago

Is your feature request related to a problem? Please describe.

I would like to assign negative weights to parts of my portfolio, specifically margin (cash) accounts.

This way PP could help me to automatically calculate the correct amounts to achieve a desired level of leverage.

Describe the solution you'd like

I would like to assign negative weights to parts of my portfolio, i.e.

stocks : 120% margin : -20 %

so if my portfolio would have 10000 Euros worth of stocks and 0 balance on my margin account it would tell me, to take 20k out of my margin account and buy 20k worth of stocks.

Describe alternatives you've considered

Right now I calculate the amount manually and keep the margin balance out of my portfolio weighting.

ostrian commented 3 years ago

I had the same feature request (in German), see https://forum.portfolio-performance.info/t/klassifikation-mit-negativen-anteilen-z-b-kredit/12609

An extension to this request (which I just proposed in the linked forum post) would be to allow negative numbers and weights > 100% also for the classification of individual securities (e.g., Leveraged ETFs). This would allow to track leverage on the portfolio level with a combination of margin and leveraged products.

ostrian commented 3 years ago

For your problem (only margin), a solution might be to assign the following weights in the classification:

stocks 100% margin 0%

and assign to all individual securities: 80% in stocks (or a subcategory?) and 20% in margin. Then, the negative margin sum cancels the 20% of the security value in the margin category.

It’s not ideal since you have to multiply the rebalancing deltas by your leverage ratio in order to arrive at the sums you really have to buy / sell. And it doesn’t solve the problem of integrating leveraged securites.

I've written the same comment in the forum including an example file, not sure if you've seen it.