예제 #1
0
def test_get_order_book_count():

    asset_pair = "XXRPZCAD"
    count = 3

    sess = KrakenSession()
    order_book = sess.get_order_book(asset_pair, count=count)

    asset_pair_order_book = order_book[asset_pair]
    for order_lists in asset_pair_order_book.values():
        assert len(order_lists) <= count

    with pytest.raises(InvalidRequestParameterException):
        sess.get_order_book(asset_pair, "four")
예제 #2
0
def test_get_order_book_base():

    asset_pair = "XXRPZCAD"

    sess = KrakenSession()
    order_book = sess.get_order_book(asset_pair)
    assert lists_match(order_book.keys(), [asset_pair])

    asset_pair_order_book = order_book[asset_pair]
    assert lists_match(asset_pair_order_book.keys(), ['asks', 'bids'])

    for ask in asset_pair_order_book['asks']:
        assert len(ask) == ORDER_BOOK_ASKS_LENGTH

    for bids in asset_pair_order_book['bids']:
        assert len(bids) == ORDER_BOOKS_BIDS_LENGTH

    with pytest.raises(MissingRequiredParameterException):
        sess.get_order_book(None)

    with pytest.raises(InvalidRequestParameterOptionsException):
        sess.get_order_book("BadPAiR")