def create_test_binance( database: DBHandler, msg_aggregator: MessagesAggregator, location: Location = Location.BINANCE, name: str = 'binance', ) -> Binance: if location == Location.BINANCE: uri = BINANCE_BASE_URL elif location == Location.BINANCEUS: uri = BINANCEUS_BASE_URL else: raise AssertionError( f'Tried to create binance exchange with location {location}') binance = Binance( name=name, api_key=make_api_key(), secret=make_api_secret(), database=database, msg_aggregator=msg_aggregator, uri=uri, ) this_dir = os.path.dirname(os.path.abspath(__file__)) json_path = Path(this_dir) / 'data' / 'binance_exchange_info.json' with json_path.open('r') as f: json_data = json.loads(f.read()) binance._symbols_to_pair = create_binance_symbols_to_pair( json_data, location) binance.first_connection_made = True return binance
def create_test_binance( database: DBHandler, msg_aggregator: MessagesAggregator, ) -> Binance: binance = Binance( api_key=make_api_key(), secret=make_api_secret(), database=database, msg_aggregator=msg_aggregator, ) this_dir = os.path.dirname(os.path.abspath(__file__)) json_path = Path(this_dir) / 'data' / 'binance_exchange_info.json' with json_path.open('r') as f: json_data = json.loads(f.read()) binance._symbols_to_pair = create_binance_symbols_to_pair(json_data) binance.first_connection_made = True return binance
def function_scope_binance( database, inquirer, # pylint: disable=unused-argument function_scope_messages_aggregator, ): binance = Binance( api_key=make_api_key(), secret=make_api_secret(), database=database, msg_aggregator=function_scope_messages_aggregator, ) this_dir = os.path.dirname(os.path.abspath(__file__)) json_path = Path(this_dir).parent.parent / 'utils' / 'data' / 'binance_exchange_info.json' with json_path.open('r') as f: json_data = json.loads(f.read()) binance._symbols_to_pair = create_binance_symbols_to_pair(json_data) binance.first_connection_made = True return binance