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

Author