alpacahq / Momentum-Trading-Example

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

event loop is already running #7

Open wjg59701 opened 4 years ago

wjg59701 commented 4 years ago

Can anyone tell me why I always get the error "event loop is already running" when I try to run the trade_updates channel?

the error is thrown from the asyncio

ghost commented 4 years ago

There's an error with asyncio. Need to install a patch. This worked for me: https://markhneedham.com/blog/2019/05/10/jupyter-runtimeerror-this-event-loop-is-already-running/

This is well documented: https://github.com/erdewit/nest_asyncio

pip install nest_asyncio
import nest_asyncio
nest_asyncio.apply()