Beispiel #1
0
def test_get_balances(apikey, secret):

    wex = Wex(apikey, secret)
    balances = wex.get_balances()

    assert isinstance(balances, dict)
    assert 'btc' in balances.keys()
Beispiel #2
0
def test_get_deposit_address(apikey, secret):

    wex = Wex(apikey, secret)

    try:
        with pytest.raises(ValueError):
            wex.get_deposit_address("ltc")
    except:
        assert isinstance(wex.get_deposit_address("ppc"), dict)
Beispiel #3
0
def test_withdraw(apikey, secret):

    print(
        'This is made to fail with <<api key dont have withdraw permission>>, so make sure your testing API key does not allow that.'
    )
    wex = Wex(apikey, secret)

    with pytest.raises(ValueError):
        wex.withdraw("ppc", 1, 'PpcEaT3Rd0NTsendftMKDAKr331DXgHe3L')
Beispiel #4
0
def test_get_market_depth():
    '''test get_market_depth'''

    market_depth = Wex.get_market_depth("ppc_usd")

    assert isinstance(market_depth, dict)
    assert isinstance(market_depth["asks"], Decimal)
Beispiel #5
0
def test_get_market_orders():
    '''test get_market_orderbook'''

    market_orders = Wex.get_market_orders("ppc_usd")

    assert isinstance(market_orders, dict)
    assert isinstance(market_orders["asks"], list)
    assert isinstance(market_orders["bids"], list)
Beispiel #6
0
def test_get_market_trade_history():
    '''test get_market_trade_history'''

    trade_history = Wex.get_market_trade_history("ppc_usd", 10)

    assert isinstance(trade_history, list)
    assert len(trade_history) == 10
    assert sorted(trade_history[0].keys()) == sorted(
        ['type', 'price', 'amount', 'tid', 'timestamp'])
Beispiel #7
0
def test_get_market_ticker():
    '''test get_market_ticker'''

    ticker = Wex.get_market_ticker("ppc_usd")

    assert isinstance(ticker, dict)
    assert sorted(ticker.keys()) == [
        'avg', 'buy', 'high', 'last', 'low', 'sell', 'updated', 'vol',
        'vol_cur'
    ]
Beispiel #8
0
def test_buy_limit(apikey, secret):

    wex = Wex(apikey, secret)

    with pytest.raises(ValueError):
        wex.buy_limit("ppc_btc", 0.05, 1)
Beispiel #9
0
def test_cancel_order(apikey, secret):

    wex = Wex(apikey, secret)

    with pytest.raises(ValueError):
        wex.get_open_orders("ppc_btc")
Beispiel #10
0
def test_get_transaction_history(apikey, secret):

    wex = Wex(apikey, secret)

    assert isinstance(wex.get_transaction_history(), dict)
Beispiel #11
0
def test_sell_limit(apikey, secret):

    wex = Wex(apikey, secret)

    with pytest.raises(ValueError):
        wex.sell_limit("ltc_btc", 1, 0.25)
Beispiel #12
0
import pytest
from cryptotik import Wex
from decimal import Decimal

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

wex = Wex()


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

    assert wex.format_pair("ppc-usd") == "ppc_usd"


def test_get_base_currencies():

    wex.get_base_currencies()


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

    assert isinstance(wex.get_markets(), list)
    assert "btc_usd" in wex.get_markets()


def test_get_market_ticker():
    '''test get_market_ticker'''
Beispiel #13
0
import pytest
from cryptotik import Wex
from decimal import Decimal

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

wex = Wex(pytest.config.getoption("--apikey"), 
            pytest.config.getoption("--secret"))


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

    assert wex.format_pair("ppc-usd") == "ppc_usd"


def test_get_base_currencies():

    wex.get_base_currencies()


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

    assert isinstance(wex.get_markets(), list)
    assert "btc_usd" in wex.get_markets()

Beispiel #14
0
def test_format_pair():
    '''test string formating to match API expectations'''

    assert Wex.format_pair("ppc-usd") == "ppc_usd"
Beispiel #15
0
def test_get_market_spread():
    '''test get_market spread'''

    assert isinstance(Wex.get_market_spread("ppc_usd"), Decimal)
Beispiel #16
0
def test_get_markets():
    '''test get_markets'''

    assert isinstance(Wex.get_markets(), list)
    assert "btc_usd" in Wex.get_markets()