alpacahq / Momentum-Trading-Example

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

ERROR: consuming ws messages: unknown channel A.OPK (you may need to specify the right data_stream) #24

Open giuseppe-salvatore opened 4 years ago

giuseppe-salvatore commented 4 years ago

Hi, so I tried investigating this error a bit and from the Alpaca API seems like the A channel (which should be the bars by second) doesn't exist. AM (the bars by minute does). I know this is polygon but I thought that this is what Alpaca is using under the hood. I wonder whether this is the problem... also, I am using the paper trading just to make sure I don't mess things up. Any help would be highly appreciated and if I manage to fix this I will create a PR anyway. Thanks

RezaAIDL77 commented 4 years ago

Hei man, I do have a same issue. One idea I got this weekend is to check: conn = tradeapi.stream2.StreamConn(api_key, api_secret, base_url) instead of conn = tradeapi.StreamConn(base_url=base_url, key_id=api_key_id, secret_key=api_secret)

Sorry if I didn't help. I myself is trying to fix this ...

Gabowatt commented 4 years ago

Specify the Data Stream in the StreamConn like this: conn = tradeapi.StreamConn(base_url=base_url, key_id=api_key_id, secret_key=api_secret,data_stream='polygon')