wardbradt / peregrine

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

Can i specify the coins in Multiple coins one exchange ? thanks. #43

Closed littleworm2018 closed 5 years ago

littleworm2018 commented 5 years ago

Hi, Thank you for your work. some coins i don't want to get, Can i specify the coins in Multiple coins one exchange ? thanks?

wardbradt commented 5 years ago

I do not have the time right now to add this in, but, to do this, you have two options. Both of them require modifying this piece of code in peregrinearb/utils/single_exchange.py.

tasks = [_add_weighted_edge_to_graph(exchange, market_name, graph,
                                         log=True, fee=fee, suppress=suppress, ticker=ticker, depth=depth)
             for market_name, ticker in tickers.items()]
  1. Make load_exchange_graph take a parameter markets, a list or other iterable. markets is the markets (trading pairs) you are interested in. Change the above piece of code to:
    tasks = [_add_weighted_edge_to_graph(exchange, market_name, graph,
                                         log=True, fee=fee, suppress=suppress, ticker=tickers[market_name], depth=depth)
             for market_name in markets]
  2. Make load_exchange_graph take currencies, a list of the currencies you are interested in, as a parameter. Change the piece of code to:
    tasks = [_add_weighted_edge_to_graph(exchange, market_name, graph,
                                         log=True, fee=fee, suppress=suppress, ticker=ticker, depth=depth)
             for market_name, ticker in tickers.items() if (market_name.split('/')[0] in currencies or market_name.split('/')[1] in currencies)]

    For option 2, you can replace or with and if you want to.

littleworm2018 commented 5 years ago

roger that. Thank you for your detailed explanation.