def test_market_names_of_edges_are_valid(self): exchange_names = ['bittrex', 'bitstamp', 'poloniex'] graph = build_arbitrage_graph_for_exchanges(exchange_names) # load the exchanges with their markets exchanges = { exchange_name: getattr(ccxt, exchange_name)() for exchange_name in exchange_names } futures = [ asyncio.ensure_future(exchange.load_markets()) for exchange in exchanges.values() ] asyncio.get_event_loop().run_until_complete(asyncio.gather(*futures)) for edge in graph.edges(data=True): data = edge[2] exchange = exchanges[data['exchange_name']] self.assertIn(data['market_name'], exchange.symbols)
def test_all_node_degrees_greater_than_one(self): exchanges = ['bittrex', 'bitstamp', 'poloniex'] graph = build_arbitrage_graph_for_exchanges(exchanges) for node in graph: self.assertGreater(graph.degree(node), 1)