Example #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()
Example #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)
Example #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')
Example #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)
Example #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)
Example #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'])
Example #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'
    ]
Example #8
0
def test_buy_limit(apikey, secret):

    wex = Wex(apikey, secret)

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

    wex = Wex(apikey, secret)

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

    wex = Wex(apikey, secret)

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

    wex = Wex(apikey, secret)

    with pytest.raises(ValueError):
        wex.sell_limit("ltc_btc", 1, 0.25)
Example #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'''
Example #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()

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

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

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

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