PyPortfolioOpt icon indicating copy to clipboard operation
PyPortfolioOpt copied to clipboard

How to allocate $10,000 in a short/long portfolio?

Open Originn opened this issue 2 years ago • 0 comments

What are you trying to do? I have a script to check portfolio performance for 4 different methods(CVaR, mean_veriance, etc..) for the last year. I want to compare the long/short portfolio as well. The issue is that all of the methods assume I am starting with $10,000, but the short/long portfoilio always allocate more than $10,000 to the short+long. Is there a way to set it up that it will just allocate the funds as if it only had $10,000?

What have you tried?

ef = EfficientFrontier(None, S, weight_bounds=(-1, 1))
ef.min_volatility()
weights = ef.clean_weights()
da = DiscreteAllocation(weights, latest_prices, total_portfolio_value=10000, short_ratio=0.3)

(it allocates 10,000 for long and 3,000 for short, I want 7,000 for long and 3,000 for short)

I currently bypassing it by multiplying the leftover and the long position allocations by 0.7

Originn avatar Jan 12 '23 06:01 Originn