alpaca-proxy-agent icon indicating copy to clipboard operation
alpaca-proxy-agent copied to clipboard

Have to restart the service sometimes

Open xs005 opened this issue 4 years ago • 1 comments

It works well when I just started the service. I tried to run some jobs at the same time and they all can get data, but sometimes when I stopped those jobs, and later rerun them, there will be a long waiting time and no data. But if I restart the service before rerunning them, I can get the data immediately.

Another problem I got is when I run two jobs for more than 30 min, one job stopped as shown below. The other one is still running well. 2020-10-14 12:51:03,444 code = 1006 (connection closed abnormally [internal]), no reason Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/alpaca-trading-bot/examples/try_wss.py", line 109, in <module> conn.run(['trade_updates', 'alpacadatav1/Q.GOOG', 'alpacadatav1/AM.TSLA']) File "D:\miniconda3\envs\alpaca-trading-bot\lib\site-packages\alpaca_trade_api\stream2.py", line 298, in run loop.run_until_complete(self.consume()) File "D:\miniconda3\envs\alpaca-trading-bot\lib\asyncio\base_events.py", line 616, in run_until_complete return future.result() asyncio.exceptions.CancelledError Below is the log of the docker service image

xs005 avatar Oct 14 '20 16:10 xs005

Hi, about the first issue, I need at least a log or a script to execute to reproduce it.

about the second issue, the client disconnects but doesn't re-connect. are you using the StreamConn object? it does the re-connection for you. here's a code example that does exactly that: https://github.com/alpacahq/alpaca-trade-api-python/blob/master/examples/websocket_example.py

shlomiku avatar Oct 15 '20 04:10 shlomiku