Overall Statistics |
Total Trades 0 Average Win 0% Average Loss 0% Compounding Annual Return 0% Drawdown 0% Expectancy 0 Net Profit 0% Sharpe Ratio 0 Loss Rate 0% Win Rate 0% Profit-Loss Ratio 0 Alpha 0 Beta 0 Annual Standard Deviation 0 Annual Variance 0 Information Ratio 0 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 |
import numpy as np class DualListedArb(QCAlgorithm): def Initialize(self): self.SetStartDate(2017,12,19) self.SetEndDate(2017,12,20) self.SetCash(10000) self.AddEquity("UAA", Resolution.Minute) self.AddEquity("UA", Resolution.Minute) self.AddEquity("SPY", Resolution.Minute) self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.At(0,0), Action(self.SetBenchmark)) self.SetWarmUp(int(6.5*60)) def OnData(self, slice): if self.IsWarmingUp: return mainPrice = slice["UA"].Price dualPrice = slice["UAA"].Price def SetBenchmark(self): self.mainHistory = self.History("UA", 390, Resolution.Minute) self.dualHistory = self.History("UAA", 390, Resolution.Minute) # ERROR STARTS HERE #self.spread = self.dualHistory - self.mainHistory #self.benchmarkSpread = self.spread.mean()