Beispiel #1
0
def test_iconomi_assets_are_known(
        database,
        inquirer,  # pylint: disable=unused-argument
):
    unsupported_assets = set(UNSUPPORTED_ICONOMI_ASSETS)
    common_items = unsupported_assets.intersection(
        set(WORLD_TO_ICONOMI.values()))
    assert not common_items, f'Iconomi assets {common_items} should not be unsupported'
    # use a real Iconomi instance so that we always get the latest data
    iconomi = Iconomi(
        name='iconomi1',
        api_key=make_api_key(),
        secret=make_api_secret(),
        database=database,
        msg_aggregator=MessagesAggregator(),
    )

    supported_tickers = iconomi.query_supported_tickers()
    for ticker in supported_tickers:
        try:
            _ = asset_from_iconomi(ticker)
        except UnknownAsset as e:
            test_warnings.warn(
                UserWarning(
                    f'Found unknown asset {e.asset_name} in ICONOMI. '
                    f'Support for it has to be added', ))
Beispiel #2
0
    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
Beispiel #3
0
def create_test_iconomi(
    database: DBHandler,
    msg_aggregator: MessagesAggregator,
) -> Iconomi:
    return Iconomi(
        api_key=make_api_key(),
        secret=make_api_secret(),
        database=database,
        msg_aggregator=msg_aggregator,
    )
Beispiel #4
0
def test_iconomi_assets_are_known(
        database,
        inquirer,  # pylint: disable=unused-argument
):
    # use a real Iconomi instance so that we always get the latest data
    iconomi = Iconomi(
        api_key=make_api_key(),
        secret=make_api_secret(),
        database=database,
        msg_aggregator=MessagesAggregator(),
    )

    supported_tickers = iconomi.query_supported_tickers()
    for ticker in supported_tickers:
        try:
            _ = iconomi_asset(ticker)
        except UnknownAsset as e:
            test_warnings.warn(
                UserWarning(
                    f'Found unknown asset {e.asset_name} in ICONOMI. '
                    f'Support for it has to be added', ))
Beispiel #5
0
def test_name():
    exchange = Iconomi('iconomi1', 'a', b'a', object(), object())
    assert exchange.location == Location.ICONOMI
    assert exchange.name == 'iconomi1'
Beispiel #6
0
def test_name():
    exchange = Iconomi('a', b'a', object(), object())
    assert exchange.name == 'iconomi'