Hello! I am new to Quantconnect. I made a code to short when the VIX index is at or above 40 and wait 10 days to buy back the SPY once the VIX index falls below 40. I am experiencing trouble with my longs and shorts. In my code, I write:
self.SetHoldings("SPY", -1)
However, when I look at the equity short ratio, it is at 0.5 and not 1. Sometimes, it even goes below -1. Similarly, my long ratio is supposed to drop down to 0, however it decreases only to 0.36. Can anyone help me with this problem? How do I get my equity short ratio to be 1? Thank you for your help!
Louis Szeto
Hi Aliaksei
It is normal for a margin trade. In a short sell, if the price of SPY went down, you gain CASH. Thus, when the short position you held worth less, and the portfolio value (particularly talking about cash position) went up, the short ratio would become lower. This was very significant during 2008 crisis when SPY dropped by 50%. Similarly, if the price of SPY went up, you'd lose cash, so the position exceeded -1 for a bit.
Best
Louis
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.
Aliaksei
Thank you, this was very helpful!
Aliaksei
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!