alpacahq/Momentum-Trading-Example

RuntimeWarning: coroutine 'StreamConn.close' was never awaited

stabless opened this issue · 4 comments

Interesting problem - any ideas what is causing this ?

354/354
Success.
Watching 354 symbols.
WARNING:root:code = 1000 (OK), no reason
:375: RuntimeWarning: coroutine 'StreamConn.close' was never awaited
conn.close()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
WARNING:root:server rejected WebSocket connection: HTTP 429
Cannot close a running event loop
WARNING:root:code = 1000 (OK), no reason
WARNING:root:server rejected WebSocket connection: HTTP 429
WARNING:root:server rejected WebSocket connection: HTTP 429
Cannot close a running event loop
Cannot close a running event loop

@stabless did you ever figure this out?

@stabless did you ever figure this out?

I am getting a similar message. Does anyone know how to debug this?

Getting current ticker data...
Success.
Tracking 226 symbols.
Getting historical data...
1/226
.
.
.
226/226
Success.
Watching 226 symbols.
unknown channel A.BBAR (you may need to specify the right data_stream)
algo.py:386: RuntimeWarning: coroutine 'StreamConn.close' was never awaited
conn.close()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Event loop is closed
.
.
.
Event loop is closed
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00007f681b498740 (most recent call first):
File "/usr/lib/python3.7/asyncio/base_events.py", line 480 in _check_closed
File "/usr/lib/python3.7/asyncio/base_events.py", line 560 in run_until_complete
File "/usr/local/lib/python3.7/dist-packages/alpaca_trade_api/stream2.py", line 275 in run
File "algo.py", line 383 in run_ws
.
.
.
File "algo.py", line 387 in run_ws
...
Aborted

BlueMistTrekker, I am getting the same error. Let me know if you find a solution.