Hello everyone
I am a professor of finance at the University of Wisconsin and a complete newbie to quantconnect. I've been playing around with it a bit and found some strange issues I'd like to address. Specifically, the function setholdings() seems to be giving me some gray hairs. It is my understanding (correct me if I am wrong) that setholdings(symbol,w) initializes a trade that keeps a constant weight w in a security with ticker "symbol."
I ran a simple test. Setting cahs to the default value of 100K, I simply modified the basicTemplateAlgorithm.cs to
SetHoldings("TVIX", -1);
SetHoldings("UVXY", 1);
These securities do the same trade (2 x long) in underlying VIX futures. Therefore, a long short position should produce something close to a zero profit and zero risk.
The tradelog (using 100K) starting capital looks like this for the first couple of dates:
It is clear that the backtest is using adjusted prices (adjusted for reverse splits). This creates a problem because one cannot adjust the position size to be even close to the w=1, 100K target.
A workaround is to set the initial capital to some large number. I tried 100M. I now get
So on the first day, it shorts 102M worth of TVIX, but does not hedge the position in UVXY (invalid quote). On the second, it buys to cover 138 shares despite the fact that the naked short from the previous day has made money. It then buys about 96M of UVXY, not even close to the target weight of w=1.
Questions/ comments
1. The use of adjusted close data makes no sense in this context.
2. The "invalid" codes that show up in the 100M case are not there for the 100K case. I don't understand...
3. The weights are incorrect.
Thanks much of any of you have any comments on this. I actually greatly appreciate what quantconnect is trying to do.
Best
Bjorn Eraker
Jared Broad
Thanks and welcome Bjorn! Glad to have you on QuantConnect.
Those assets behave strangely because of the limits of precision when using adjusted data back that far. I would recommend using DataNormalization.Raw data; which will use the actual asset price and pay you dividends in cash (apply splits as quantity changes).
With the prices of the assets at such extremes its beyond numerical precision and "weird stuff happens". Normally this shows a warning message but it looks like these stocks aren't showing the message -- we'll look into that.
See the backtest attached which has much more reasonable numbers of $7 and $17 for the price per share -- and then its happier to calculate the weights. Happy to help more if you could please attach the algorithm so we can replicate it and see the error messages.
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.
Bjorn Eraker
Thanks for your help Jared.
If I suspect that there is an error in the data base, do I use the bugreport or do you have any other way to report suspected data errors?
Thanks
Michael Manus
the support email address :)
the support tab in the algorith lab.....
support@quantconnect.com
Bjorn Eraker
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!