wardbradt / peregrine

Detects arbitrage opportunities across 131 cryptocurrency exchanges in 50 countries
MIT License
1.21k stars 339 forks source link

"This event loop is already running" #57

Closed Ereks closed 5 years ago

Ereks commented 5 years ago

Hello!

I am trying to run example "multiple_coins_multiple_exchanges", but constantly encounter an error. It seems to be a problem in Asyncio, but I still can't figure out what the problem is.

Also already saw this issue, but I suppose this problem still existing. https://github.com/wardbradt/peregrine/issues/36

python 3.7.3 asyncio 3.4.3 ccxt 1.18.594 peregrinearb 1.2.2

Code:

from peregrinearb import create_weighted_multi_exchange_digraph, bellman_ford_multi, \
    print_profit_opportunity_for_path_multi

graph = create_weighted_multi_exchange_digraph(['bittrex', 'gemini', 'kraken'], log=True)

graph, paths = bellman_ford_multi(graph, 'ETH', loop_from_source=False, unique_paths=True)
for path in paths:
    print_profit_opportunity_for_path_multi(graph, path)

Output: image

Ereks commented 5 years ago

The problem was in jupyter notebook. Found solution here: