I am stuck on this issue. This is the code that was written in the Medium post. I have been trying to debug it. I have it to this point where it appears to get the ticker data and historical data but then hits a wall and cites mismatch columns. I’m not sure what I need to align. Any help would be appreciated.
primary@wm1:~$ python3.6 wm4_v3.txt
Getting current ticker data…
Success.
Tracking 309 symbols.
Getting historical data…
1/309
Success.
Watching 309 symbols.
ERROR:root:error while consuming ws messages: cannot set a row with mismatched columns
^CTraceback (most recent call last):
File “/home/primary/.local/lib/python3.6/site-packages/alpaca_trade_api/stream2.py”, line 331, in run
loop.run_until_complete(self.consume())
File “/usr/lib/python3.6/asyncio/base_events.py”, line 484, in run_until_complete
return future.result()
File “/home/primary/.local/lib/python3.6/site-packages/alpaca_trade_api/stream2.py”, line 316, in consume
self.data_ws.consume(),
File “/home/primary/.local/lib/python3.6/site-packages/alpaca_trade_api/polygon/streamconn.py”, line 108, in cons
ume
await self._consume_task
File “/home/primary/.local/lib/python3.6/site-packages/alpaca_trade_api/polygon/streamconn.py”, line 114, in _con
sume_msg
await self._dispatch(data)
File “/home/primary/.local/lib/python3.6/site-packages/alpaca_trade_api/polygon/streamconn.py”, line 221, in _dis
patch
await handler(self, channel, ent)
File “wm4_v3.txt”, line 192, in handle_second_bar
minute_history[symbol].loc[ts] = new_data
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 670, in setitem
iloc._setitem_with_indexer(indexer, value)
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 1626, in _setitem_with_inde
xer
self._setitem_with_indexer_missing(indexer, value)
File “/home/primary/.local/lib/python3.6/site-packages/pandas/core/indexing.py”, line 1856, in _setitem_with_inde
xer_missing
raise ValueError(“cannot set a row with mismatched columns”)
ValueError: cannot set a row with mismatched columns
During handling of the above exception, another exception occurred:
Traceback (most recent call last):