alpacahq / Momentum-Trading-Example

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

Stream connection set to live url #3

Closed trainsdse closed 5 years ago

trainsdse commented 5 years ago

Line 75 establishes the stream but does not take in the parameter for base_url and therefore always connects to the default which is the live api url. Out of the box this causes issues when testing with a paper account because you end up sending orders with the paper url but "listening" for updates on the live url. If you change line 75 to this:

conn = tradeapi.StreamConn(base_url=base_url, key_id=api_key_id, secret_key=api_secret)

it fixes the issue.

Pretty easy to figure out but I figured I'd mention it.

Cheers,

TJ

ttt733 commented 5 years ago

This was fixed by #5.