コード例 #1
0
def sandbox_bitmex(database, inquirer):  # pylint: disable=unused-argument
    bitmex = Bitmex(
        api_key=TEST_BITMEX_API_KEY,
        secret=TEST_BITMEX_API_SECRET,
        database=database,
        msg_aggregator=MessagesAggregator(),
    )
    bitmex.uri = 'https://testnet.bitmex.com'
    return bitmex
コード例 #2
0
def test_bitmex(database, inquirer):  # pylint: disable=unused-argument
    # API key/secret from tests cases here: https://www.bitmex.com/app/apiKeysUsage
    bitmex = Bitmex(
        api_key=TEST_BITMEX_API_KEY,
        secret=TEST_BITMEX_API_SECRET,
        database=database,
        msg_aggregator=MessagesAggregator(),
    )
    bitmex.uri = 'https://testnet.bitmex.com'
    return bitmex
コード例 #3
0
def mock_bitmex(database, inquirer):  # pylint: disable=unused-argument
    # API key/secret from tests cases here: https://www.bitmex.com/app/apiKeysUsage
    bitmex = Bitmex(
        api_key=b'LAqUlngMIQkIUjXMUreyu3qn',
        secret=b'chNOOS4KvNXR_Xq4k4c9qsfoKWvnDecLATCRlcBwyKDYnWgO',
        database=database,
        msg_aggregator=MessagesAggregator(),
    )

    bitmex.first_connection_made = True
    return bitmex
コード例 #4
0
ファイル: exchanges.py プロジェクト: zalam003/rotki
def create_test_bitmex(
    database: DBHandler,
    msg_aggregator: MessagesAggregator,
) -> Bitmex:
    # API key/secret from tests cases here: https://www.bitmex.com/app/apiKeysUsage
    bitmex = Bitmex(
        api_key=ApiKey('LAqUlngMIQkIUjXMUreyu3qn'),
        secret=ApiSecret(b'chNOOS4KvNXR_Xq4k4c9qsfoKWvnDecLATCRlcBwyKDYnWgO'),
        database=database,
        msg_aggregator=msg_aggregator,
    )
    bitmex.first_connection_made = True
    return bitmex
コード例 #5
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
コード例 #6
0
def test_name():
    exchange = Bitmex('a', b'a', object(), object())
    assert exchange.name == 'bitmex'
コード例 #7
0
def test_name():
    exchange = Bitmex('bitmex1', 'a', b'a', object(), object())
    assert exchange.location == Location.BITMEX
    assert exchange.name == 'bitmex1'