wardbradt/peregrine

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

littleworm2018 opened this issue · 2 comments

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?

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]
  1. 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.

roger that.
Thank you for your detailed explanation.