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 Tracking Error 0 Treynor Ratio 0 Total Fees $0.00 Estimated Strategy Capacity $0 Lowest Capacity Asset |
class FormalYellowGreenCat(QCAlgorithm): def Initialize(self): self.SetStartDate(2021, 10, 10) # Set Start Date self.SetCash(100000) # Set Strategy Cash self.spy = self.AddEquity("SPY", Resolution.Tick).Symbol consolidator = TickConsolidator(timedelta(minutes=1)) consolidator.DataConsolidated += self.ConsolidatedBarHandler self.SubscriptionManager.AddConsolidator(self.spy, consolidator) self.data = None def OnData(self, data): self.data = data def ConsolidatedBarHandler(self, sender, bar): if self.Time.hour == 15 and self.Time.minute == 30: self.Debug(bar.Close) # First tick if self.data.ContainsKey(self.spy): ticks = self.data.Ticks[self.spy] last_price = ticks[0].LastPrice self.Debug(ticks[0].LastPrice) else: self.Debug("no data 1") # Submit a crazy amount of SPY orders self.orderticket = self.LimitOrder(self.spy, 999, self.Securities[self.spy].Close) # Second tick if self.data.ContainsKey(self.spy): ticks = self.data.Ticks[self.spy] ast_price = ticks[0].LastPrice self.Debug(ticks[0].LastPrice) else: self.Debug("no data 2") def OnOrderEvent(self, orderevent): if orderevent.Status == OrderStatus.PartiallyFilled: pass # How do I update the order price here? If possible.