Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

price_handler_unsubscribe #14

Closed
MKrec opened this issue May 8, 2016 · 0 comments
Closed

price_handler_unsubscribe #14

MKrec opened this issue May 8, 2016 · 0 comments
Labels

Comments

@MKrec
Copy link

MKrec commented May 8, 2016

ONLY APPLIES TO BACKTESTING
When you unsubscribe from a ticker, although it is removed from the tickers_data and tickers list, it is not removed from the generator. Additionally, if you subscribe to a new ticker mid backtest, the ticker data isnt added to the generator.

so when you hit:

def stream_next_tick:
index, row = next(self.tick_stream) # The generator

You will actually still get the data for the ticker that was removed. This then assigns the removed ticker to ticker = row["ticker"]. Furthermore, when you try and access self.tickers[ticker]["bid"] you get a key error because the key no longer exist in the updated self.ticker dict.

I'm not sure how this can be solved because if you reassign the generator the new data frame that contains the updated ticker list (and data), you reset the generator (correct?).

I'm not sure if i'm explaining this clearly, but if you have any questions on the issue, ill try my best to articulate better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants