def create_test_coinbasepro( database: DBHandler, msg_aggregator: MessagesAggregator, passphrase: str, ) -> Coinbasepro: coinbasepro = Coinbasepro( api_key=make_api_key(), secret=make_api_secret(), database=database, msg_aggregator=msg_aggregator, passphrase=passphrase, ) return coinbasepro
def get_exchange(self, account: str) -> ExchangeInterface: account_info = [ a for a in self.config['accounts'] if a['name'] == account ][0] if account_info['exchange'] == 'kraken': exchange = Kraken(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'binance': exchange = Binance(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'coinbase': exchange = Coinbase(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'coinbasepro': exchange = Coinbasepro(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator, str(account_info['passphrase'])) elif account_info['exchange'] == 'gemini': exchange = Gemini(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'bitmex': exchange = Bitmex(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'bittrex': exchange = Bittrex(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'poloniex': exchange = Poloniex(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'bitcoinde': exchange = Bitcoinde(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) elif account_info['exchange'] == 'iconomi': exchange = Iconomi(str(account_info['api_key']), str(account_info['secret']).encode(), self, self.msg_aggregator) else: raise ValueError("Unknown exchange: " + account_info['exchange']) return exchange
def test_name(): exchange = Coinbasepro('coinbasepro1', 'a', b'a', object(), object(), '') assert exchange.location == Location.COINBASEPRO assert exchange.name == 'coinbasepro1'
def test_name(): exchange = Coinbasepro('a', b'a', object(), object(), '') assert exchange.name == 'coinbasepro'