I'd like to create some market-neurtal portfolio that always stays flat, e.g. buy VOO sell SPY.
Disadvantages
shorting stock involves paying dividends - https://www.google.com/search?q=do+i+pay+dividends+if+I+short+stock
borrowing shares may be expensive - https://www.google.com/search?q=cost+of+shorting+the+stock
Another way of doing it is to use proportions of opposite stocks, e.g. long SPY long VXX, but this portfolio may fluctuate significantly and is not exactly market-neutral.
How to create a combination of stocks bouncing around 0 and at the same time make sure that I don't overpay for it?
Adam W
One way would be to do regularly rebalancing in the Risk Model based on historical beta to the market:
Â
class MyRiskModel(RiskManagementModel): def Initialize(self, lookback=30): self.lookback = lookback # Historical lookback period for finding beta self.betaThreshold = betaThreshold # Some small threshold for market neutrality def ManageRisk(self, algorithm, targets): # Currently invested securities currInvested = [x.Symbol for x in algorithm.Portfolio.Values if x.Invested] # Compute current beta of portfolio (see Sharpe (1964), statsmodels.OLS, etc) portfolioBeta = # if abs(portfolioBeta) > betaThreshold: # Historical SPY / whatever "market"-benchmark historicalSPY = algorithm.History('SPY', timedelta(days=self.lookback) portfolioValue = algorithm.Portfolio.TotalHoldingsValue for symbol in currInvested: # Compute individual asset betas # Get portfolio weights by weight = abs(algorithm.Portfolio[symbol].Quantity) * algorithm.Securities[symbol].Close / algorithm.Portfolio.TotalHoldingsValue # Store beta/weights by symbol in a dict/list/etc # Constrain asset weights until the expected portfolio beta is 0 return # new constrained weights
Finding the "cheapest" is a bit more tricky and depends on the brokerage. Borrowing costs aren't modeled in yet and can make a big difference for strategies like this depending on the brokerage, but you can look into creating your own borrowing cost model specific to your brokerage.
Shile Wen
Hi Artemiusgreat,
The easiest way to achieve this type of portfolio would be to long and short equal amounts of SPY (SPDR Services SPX) and VOO (Vanguard SPX), respectively. I’ve shown how to do this in the attached backtest.
Best,
Shile Wen
Artemiusgreat
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!