def _initialize_markets(self, market_names: List[Tuple[str, str]]): ethereum_rpc_url = global_config_map.get("ethereum_rpc_url").value for market_name, symbol in market_names: if market_name == "ddex" and self.wallet: market = DDEXMarket( wallet=self.wallet, web3_url=ethereum_rpc_url, order_book_tracker_data_source_type= OrderBookTrackerDataSourceType.EXCHANGE_API, symbols=[symbol]) elif market_name == "binance": binance_api_key = global_config_map.get( "binance_api_key").value binance_api_secret = global_config_map.get( "binance_api_secret").value market = BinanceMarket( web3_url=ethereum_rpc_url, binance_api_key=binance_api_key, binance_api_secret=binance_api_secret, order_book_tracker_data_source_type= OrderBookTrackerDataSourceType.EXCHANGE_API, symbols=[symbol]) elif market_name == "radar_relay" and self.wallet: market = RadarRelayMarket(wallet=self.wallet, web3_url=ethereum_rpc_url, symbols=[symbol]) elif market_name == "coinbase_pro": coinbase_pro_api_key = global_config_map.get( "coinbase_pro_api_key").value coinbase_pro_secret_key = global_config_map.get( "coinbase_pro_secret_key").value coinbase_pro_passphrase = global_config_map.get( "coinbase_pro_passphrase").value market = CoinbaseProMarket( web3_url=ethereum_rpc_url, coinbase_pro_api_key=coinbase_pro_api_key, coinbase_pro_secret_key=coinbase_pro_secret_key, coinbase_pro_passphrase=coinbase_pro_passphrase, symbols=[symbol]) else: raise ValueError(f"Market name {market_name} is invalid.") self.markets[market_name]: MarketBase = market
def setUpClass(cls): cls.clock: Clock = Clock(ClockMode.REALTIME) cls.wallet = Web3Wallet(private_key=conf.web3_private_key_radar, backend_urls=conf.test_web3_provider_list, erc20_token_addresses=[conf.mn_zerox_token_address, conf.mn_weth_token_address], chain=EthereumChain.MAIN_NET) cls.market: RadarRelayMarket = RadarRelayMarket(wallet=cls.wallet, web3_url=conf.test_web3_provider_list[0], order_book_tracker_data_source_type= OrderBookTrackerDataSourceType.EXCHANGE_API, symbols=["ZRX-WETH"]) print("Initializing Radar Relay market... ") cls.ev_loop: asyncio.BaseEventLoop = asyncio.get_event_loop() cls.clock.add_iterator(cls.wallet) cls.clock.add_iterator(cls.market) cls.ev_loop.run_until_complete(cls.clock.run_til(time.time() + 1)) cls.ev_loop.run_until_complete(cls.wait_til_ready()) print("Ready.")