wardbradt / peregrine

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

Order_book #29

Closed shivamgoyal1 closed 6 years ago

shivamgoyal1 commented 6 years ago

future: <Task finished coro=<_add_weighted_edge_to_graph() done, defined at /Users/shivamgoyal/bitcoin_arb/preregine/peregrine/peregrinearb/utils/single_exchange.py:95> exception=UnboundLocalError("local variable 'order_book' referenced before assignment",)>
Traceback (most recent call last):
  File "/Users/shivamgoyal/bitcoin_arb/preregine/peregrine/peregrinearb/utils/single_exchange.py", line 115, in _add_weighted_edge_to_graph
    ticker_bid = order_book['bids'][0][0]
UnboundLocalError: local variable 'order_book' referenced before assignment
Task exception was never retrieved
future: <Task finished coro=<_add_weighted_edge_to_graph() done, defined at /Users/shivamgoyal/bitcoin_arb/preregine/peregrine/peregrinearb/utils/single_exchange.py:95> exception=UnboundLocalError("local variable 'order_book' referenced before assignment",)>
Traceback (most recent call last):
  File "/Users/shivamgoyal/bitcoin_arb/preregine/peregrine/peregrinearb/utils/single_exchange.py", line 115, in _add_weighted_edge_to_graph
    ticker_bid = order_book['bids'][0][0]
UnboundLocalError: local variable 'order_book' referenced before assignment
Task exception was never retrieved
future: <Task finished coro=<_add_weighted_edge_to_graph() done, defined at /Users/shivamgoyal/bitcoin_arb/preregine/peregrine/peregrinearb/utils/single_exchange.py:95> exception=UnboundLocalError("local variable 'order_book' referenced before assignment",)>```

The program I'm running is: 
```import asyncio
from peregrinearb import load_exchange_graph, print_profit_opportunity_for_path, bellman_ford

loop = asyncio.get_event_loop()
graph = loop.run_until_complete(load_exchange_graph('binance'))

paths = bellman_ford(graph, 'BTC', unique_paths=True)
for path in paths:
    print_profit_opportunity_for_path(graph, path)```
wardbradt commented 6 years ago

This has been fixed. https://github.com/wardbradt/peregrine/pull/30