You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for symbol in symbols:
del self.handlers['bars'][symbol]
*Symbol KeyError (doesn't exist in handlers,)
this loop should try except or check keys before delete
same for all unsubscribe* methods
The text was updated successfully, but these errors were encountered:
it is obvious, if you have a list of subscribed symbols, and try to unsubscribe them, if one of them is not in self.handlers['bars'] the rest of the loop fails,
pseudo :
symbols = ["AAPL","AMC"... 1000 symbol]
api.subscribe_trades(callback, *symbols)
in case when some of 1000 symbols failed to subscribe or are not valide symbols, when you try to unsubscribe the symbols list it fails with *Symbol KeyError (doesn't exist in handlers,) AND THE UNSUBSCIBING LOOP STOPS it doesn't continue with the rest of them
this loop should be enclosed with try except to let the rest unsubscibe and catch warning text about none existing ones
def unsubscribe_trades(self, *symbols):
if self._running:
asyncio.get_event_loop().run_until_complete(
self._unsubscribe(trades=symbols))
for symbol in symbols:
del self._handlers['trades'][symbol] -------------
try: +++++++++++++++++++++++++++++
del self._handlers['trades'][symbol] +++++++
except:+++++++++++++++++++++++++++
log....++++++++++++++++++++++++++
alpaca-trade-api-python/alpaca_trade_api/stream.py
Line 230 in a34b337
for symbol in symbols:
del self.handlers['bars'][symbol]
*Symbol KeyError (doesn't exist in handlers,)
this loop should try except or check keys before delete
same for all unsubscribe* methods
The text was updated successfully, but these errors were encountered: