Hello everyone!
I hope someone can help me out on 2 questions.
My first question. I'm subscribed to tick data for a stock, and I've consolidated the tick data into minute bar data. The minute bar data will be received in the minute bar handler and I wish to run my buy/sell logic in the minute bar handler and I'll need to reference the most recent tick data in the buy logic. When tick data is received in OnData, I put the data into a global variable like the following snippet:
def OnData(self, data):
self.data = data
and I'd be referencing the current tick data twice in the consolidated bar handler like the following snippet:
def ConsolidatedBarHandler(self, sender, bar):
ticks_one = self.data.Ticks[self.spy]
last_price = ticks[0].LastPrice
ticks_two = self.data.Ticks[self.spy]
last_price = ticks[0].LastPrice
My question is, will ticks_one and ticks_two be the same tick? I guess my main question is, will Ondata be running on a separate thread, hence, updating self.data with the most recent ticks the moment ticks are received?
My second question. Why does self.data.ContainsKey for spy turn up to be false in the backtest?
Forget about the “update order” part.
Best regards
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!