I am trying to run this example: martingale (https://alpaca.markets/learn/martingale-day-trading-python/)
and I get connection error after a couple of hours. I ran this via the paper account for a few days and I got the same error every day:
WARNING:root:code = 1006 (connection closed abnormally [internal]), no reason
Traceback (most recent call last):
File “view_trades.py”, line 143, in
trader.start_trading()
File “view_trades.py”, line 138, in start_trading
conn.run([f’alpacadatav1/T.{self.symbol}’, ‘trade_updates’])
File “…\anaconda3\envs\py36\lib\site-packages\alpaca_trade_api\stream2.py”, line 276, in run
loop.run_until_complete(self.consume())
File “…\anaconda3\envs\py36\lib\asyncio\base_events.py”, line 484, in run_until_complete
return future.result()
concurrent.futures._base.CancelledError