alpacahq / Momentum-Trading-Example

An example algorithm for a momentum-based day trading strategy.
642 stars 218 forks source link

couldn't get real-time async data from polygon #20

Open sue6233 opened 4 years ago

sue6233 commented 4 years ago

Tried to run and go the following error messages: 135/136 136/136 Success. Watching 136 symbols. unknown channel A.VMD (you may need to specify the right data_stream)

Any input on this problem? thanks.

kunalp11 commented 4 years ago

I have something similar: 179/179 Success. Watching 179 symbols. unknown channel A.ETRN (you may need to specify the right data_stream) algo.py:376: 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. Python runtime state: initialized

Current thread 0x0000326c (most recent call first): File "C:\Users*\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 508 in _check_closed File "C:\Users*\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 591 in run_until_complete File "C:\Users***\AppData\Local\Programs\Python\Python38\lib\site-packages\alpaca_trade_api\stream2.py", line 275 in run File "algo.py", line 373 in run_ws

I suspect it's to do with the new API changing the Stream call in the channels = ['trade_updates'] block and tried to swap out the 'A' for 'T' according to the schema. It prevented the error but now the script just sits at "Watching ### symbols." for hours. It takes no action after that so I just end up killing the process. I think I'm on the right track, but not sure if something else needs to be changed as well.

sue6233 commented 4 years ago

Or could be to do with too much streaming data? The doc says it only allows 200 api calls/minute. Just error message doesn't say that way. New here.