Ejemplo n.º 1
0
def test_dummy_balances():
    account = TradingAccount()
    actual = account.getBalance().columns.to_list()
    if len(actual) == 0:
        pytest.skip('No balances to perform test')
    assert type(actual) is list
    expected = ['currency', 'balance', 'hold', 'available']
    assert len(actual) == len(expected)
    assert all([a == b for a, b in zip(actual, expected)])
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'test'
Ejemplo n.º 2
0
def test_binance_market_balance():
    try:
        with open('config-binance.json') as config_file:
            config = json.load(config_file)

        account = TradingAccount(config)
        actual = account.getBalance('BTC')
        assert type(actual) is float
        assert account.getExchange() == 'binance'
        assert account.getMode() == 'live'

    except IOError:
        pytest.skip('config-binance.json does not exist to perform test')
Ejemplo n.º 3
0
def test_coinbasepro_instantiates_without_error():
    config = {
        "api_url": "https://api.pro.coinbase.com",
        "api_key": "00000000000000000000000000000000",
        "api_secret":
        "0000/0000000000/0000000000000000000000000000000000000000000000000000000000/00000000000==",
        "api_pass": "******"
    }

    account = TradingAccount(config)
    assert type(account) is TradingAccount
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'live'
Ejemplo n.º 4
0
def test_dummy_orders():
    account = TradingAccount()
    account.buy('BTC', 'GBP', 1000, 30000)
    actual = account.getOrders().columns.to_list()
    if len(actual) == 0:
        pytest.skip('No orders to perform test')
    expected = [
        'created_at', 'market', 'action', 'type', 'size', 'value', 'status',
        'price'
    ]
    assert len(actual) == len(expected)
    assert all([a == b for a, b in zip(actual, expected)])
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'test'
Ejemplo n.º 5
0
def test_binance_not_load():
    config = {
        "api_url":
        "https://api.binance.com",
        "api_key":
        "0000000000000000000000000000000000000000000000000000000000000000",
        "api_secret":
        "0000000000000000000000000000000000000000000000000000000000000000"
    }

    account = TradingAccount(config)
    assert type(account) is TradingAccount
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'test'
Ejemplo n.º 6
0
def test_binance_instantiates_without_error():
    config = {
        "exchange":
        "binance",
        "api_url":
        "https://api.binance.com",
        "api_key":
        "0000000000000000000000000000000000000000000000000000000000000000",
        "api_secret":
        "0000000000000000000000000000000000000000000000000000000000000000"
    }

    account = TradingAccount(config)
    assert type(account) is TradingAccount
    assert account.getExchange() == 'binance'
    assert account.getMode() == 'live'
Ejemplo n.º 7
0
def test_binance_balances():
    try:
        with open('config-binance.json') as config_file:
            config = json.load(config_file)

        account = TradingAccount(config)
        assert type(account) is TradingAccount
        assert account.getExchange() == 'binance'
        assert account.getMode() == 'live'

        actual = account.getBalance().columns.to_list()
        if len(actual) == 0:
            pytest.skip('No orders to perform test')
        assert type(actual) is list
        expected = ['currency', 'balance', 'hold', 'available']
        assert len(actual) == len(expected)
        assert all([a == b for a, b in zip(actual, expected)])

    except IOError:
        pytest.skip('config-binance.json does not exist to perform test')
Ejemplo n.º 8
0
def test_coinbasepro_all_orders():
    try:
        with open('config-coinbasepro.json') as config_file:
            config = json.load(config_file)

        account = TradingAccount(config)
        assert type(account) is TradingAccount
        assert account.getExchange() == 'coinbasepro'
        assert account.getMode() == 'live'

        actual = account.getOrders().columns.to_list()
        if len(actual) == 0:
            pytest.skip('No orders to perform test')
        expected = [
            'created_at', 'market', 'action', 'type', 'size', 'value',
            'status', 'price'
        ]
        assert len(actual) == len(expected)
        assert all([a == b for a, b in zip(actual, expected)])

    except IOError:
        pytest.skip('config-coinbasepro.json does not exist to perform test')
Ejemplo n.º 9
0
def test_dummy_market_balance():
    account = TradingAccount()
    actual = account.getBalance('GBP')
    assert type(actual) is float
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'test'
Ejemplo n.º 10
0
def test_default_instantiates_without_error():
    account = TradingAccount()
    assert type(account) is TradingAccount
    assert account.getExchange() == 'coinbasepro'
    assert account.getMode() == 'test'