| 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 Probabilistic 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.847 Tracking Error 0.156 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
from datetime import timedelta
class runLevels(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2016, 12, 1)
self.SetEndDate(2021, 12, 1)
self.SetCash(100000)
self.ticker = "AAPL" ## SET TICKER
self.AddEquity(self.ticker, Resolution.Minute)
self.Securities[self.ticker].SetDataNormalizationMode(DataNormalizationMode.Raw)
self.Consolidate(self.ticker, Resolution.Daily, self.DailyConsolidated)
self.Schedule.On(self.DateRules.On(self.EndDate.year, self.EndDate.month, self.EndDate.day), self.TimeRules.At(0, 0), self.LastDay)
self.ConsolidatedBars=[]
def OnData(self, data):
pass
def DailyConsolidated(self, bar):
self.ConsolidatedBars.append(bar)
def LastDay(self):
self.history = self.History(self.Symbol(self.ticker), len(self.ConsolidatedBars), Resolution.Daily)
NumberErrors=0
for i in range(0,len(self.ConsolidatedBars)-1):
historicSlice = self.history.iloc[i]
HistoricBar = TradeBar(historicSlice.name[1], self.Symbol(self.ticker), historicSlice.open, historicSlice.high, historicSlice.low, historicSlice.close, historicSlice.volume)
ConsolidatedBar = self.ConsolidatedBars[i+1]
#IF DIFFERENCE IS MORE THAN 0.05
if abs(HistoricBar.High - ConsolidatedBar.High) > 0.05 or abs(HistoricBar.Low - ConsolidatedBar.Low) > 0.05:
#Log histotic and consolidated to compare
#self.Log(f"HISTORIC {HistoricBar.EndTime} H: {HistoricBar.High} L:{HistoricBar.Low} CONSOLIDATED {ConsolidatedBar.EndTime} H: {ConsolidatedBar.High} L:{ConsolidatedBar.Low}")
NumberErrors += 1
self.Log(f"TOTAL NUMBER OF DAYS WITH INACCURACIES: {NumberErrors} OUT OF {len(self.ConsolidatedBars)} TOTAL DAYS")