def get_exchange(self, account: str) -> ExchangeInterface: account_info = [a for a in self.config['accounts'] if a['name'] == account][0] exchange_opts = dict( name=account_info['name'], api_key=str(account_info['api_key']), secret=str(account_info['secret']).encode(), database=self, msg_aggregator=self.msg_aggregator ) if account_info['exchange'] == 'kraken': exchange = Kraken(**exchange_opts) elif account_info['exchange'] == 'binance': exchange = Binance(**exchange_opts) elif account_info['exchange'] == 'coinbase': exchange = Coinbase(**exchange_opts) elif account_info['exchange'] == 'coinbasepro': exchange = Coinbasepro(**exchange_opts, passphrase=str(account_info['passphrase'])) elif account_info['exchange'] == 'gemini': exchange = Gemini(**exchange_opts) elif account_info['exchange'] == 'bitmex': exchange = Bitmex(**exchange_opts) elif account_info['exchange'] == 'bittrex': exchange = Bittrex(**exchange_opts) elif account_info['exchange'] == 'poloniex': exchange = Poloniex(**exchange_opts) elif account_info['exchange'] == 'bitcoinde': exchange = Bitcoinde(**exchange_opts) elif account_info['exchange'] == 'iconomi': exchange = Iconomi(**exchange_opts) else: raise ValueError("Unknown exchange: " + account_info['exchange']) return exchange
def create_test_gemini( api_key, api_secret, database, msg_aggregator, base_uri, ): return Gemini( api_key=api_key, secret=api_secret, database=database, msg_aggregator=msg_aggregator, base_uri=base_uri, )
def sandbox_gemini( database, inquirer, # pylint: disable=unused-argument function_scope_messages_aggregator, gemini_sandbox_api_key, gemini_sandbox_api_secret, gemini_test_base_uri, ): gemini = Gemini( api_key=gemini_sandbox_api_key, secret=gemini_sandbox_api_secret, database=database, msg_aggregator=function_scope_messages_aggregator, base_uri=gemini_test_base_uri, ) return gemini