Ejemplo n.º 1
0
def test_withdraw(apikey, secret):

    print('This is made to fail with <Insufficient funds>' +
          ', so make sure your testing API key does not allow that.')
    hit = Hitbtc(apikey, secret)

    with pytest.raises(AssertionError):
        hit.withdraw("ppc", 1, 'PpcEaT3Rd0NTsendftMKDAKr331DXgHe3L')
Ejemplo n.º 2
0
def test_get_market_ticker():
    '''test get_market_ticker'''

    ticker = Hitbtc.get_market_ticker("PPC-USD")

    assert isinstance(ticker, dict)
    assert sorted(ticker.keys()) == ['ask', 'bid', 'high', 'last', 'low', 'open', 'symbol', 'timestamp', 'volume', 'volumeQuote']
Ejemplo n.º 3
0
def test_get_market_depth():
    '''test get_market_depth'''

    market_depth = Hitbtc.get_market_depth("ppc-usd")

    assert isinstance(market_depth, dict)
    assert isinstance(market_depth["asks"], Decimal)
Ejemplo n.º 4
0
def test_get_market_orders():
    '''test get_market_orderbook'''

    market_orders = Hitbtc.get_market_orders("ppc-usd")

    assert isinstance(market_orders, dict)
    assert isinstance(market_orders["ask"], list)
    assert isinstance(market_orders["bid"], list)
Ejemplo n.º 5
0
def test_get_market_trade_history():
    '''test get_market_trade_history'''

    trade_history = Hitbtc.get_market_trade_history("ppc-usd", 10)

    assert isinstance(trade_history, list)
    assert len(trade_history) == 10
    assert sorted(trade_history[0].keys()) == sorted(['id', 'price', 'quantity', 'side', 'timestamp'])
Ejemplo n.º 6
0
def test_get_withdraw_history(apikey, secret):

    hit = Hitbtc(apikey, secret)

    assert isinstance(hit.get_withdraw_history("ppc"), list)
Ejemplo n.º 7
0
def test_format_pair():
    '''test string formating to match API expectations'''

    assert Hitbtc.format_pair("ppc-usd") == "PPCUSD"
Ejemplo n.º 8
0
def test_get_deposit_address(apikey, secret):

    hit = Hitbtc(apikey, secret)

    assert isinstance(hit.get_deposit_address("ppc"), dict)
Ejemplo n.º 9
0
def test_get_balances(apikey, secret):

    hit = Hitbtc(apikey, secret)
    balances = hit.get_balances()

    assert isinstance(balances, list)
Ejemplo n.º 10
0
def test_get_market_spread():
    '''test get_market spread'''

    assert isinstance(Hitbtc.get_market_spread("ppc-usd"), Decimal)
Ejemplo n.º 11
0
def test_get_markets():
    '''test get_markets'''

    assert isinstance(Hitbtc.get_markets(), list)
    assert "ppcusd" in Hitbtc.get_markets()
Ejemplo n.º 12
0
def test_cancel_order(apikey, secret):

    hit = Hitbtc(apikey, secret)

    with pytest.raises(AssertionError):
        hit.cancel_order('invalid')
Ejemplo n.º 13
0
def test_sell(apikey, secret):

    hit = Hitbtc(apikey, secret)

    with pytest.raises(AssertionError):
        hit.sell("ltc_btc", 1, 0.25)
Ejemplo n.º 14
0
def test_buy(apikey, secret):

    hit = Hitbtc(apikey, secret)

    with pytest.raises(AssertionError):
        hit.buy("ppc_btc", 0.05, 1)
Ejemplo n.º 15
0
import pytest
from cryptotik import Hitbtc
from decimal import Decimal
from cryptotik.exceptions import APIError

private = pytest.mark.skipif(not pytest.config.getoption("--apikey"),
                             reason="needs --apikey option to run.")

hit = Hitbtc(pytest.config.getoption("--apikey"),
             pytest.config.getoption("--secret"))


def test_format_pair():
    '''test string formating to match API expectations'''

    assert hit.format_pair("ppc-usd") == "PPCUSD"


def test_get_markets():
    '''test get_markets'''

    assert isinstance(hit.get_markets(), list)
    assert "ppcusd" in hit.get_markets()


def test_get_market_ticker():
    '''test get_market_ticker'''

    ticker = hit.get_market_ticker("PPC-USD")

    assert isinstance(ticker, dict)