Implement Kraken integration with REST and WebSocket clients, add market data handling, and enhance settings configuration
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from arbitrade.exchange.models import BookLevel
|
||||
from arbitrade.market_data.order_book import OrderBook
|
||||
|
||||
|
||||
def test_order_book_apply_and_best_levels() -> None:
|
||||
book = OrderBook()
|
||||
book.apply_bids([BookLevel(price=100.0, volume=1.0), BookLevel(price=99.5, volume=2.0)])
|
||||
book.apply_asks([BookLevel(price=100.5, volume=1.1), BookLevel(price=101.0, volume=0.9)])
|
||||
|
||||
best_bid = book.best_bid()
|
||||
best_ask = book.best_ask()
|
||||
|
||||
assert best_bid is not None
|
||||
assert best_ask is not None
|
||||
assert best_bid.price == 100.0
|
||||
assert best_ask.price == 100.5
|
||||
|
||||
|
||||
def test_order_book_checksum_matches_self() -> None:
|
||||
book = OrderBook()
|
||||
book.apply_bids([BookLevel(price=100.0, volume=1.0)])
|
||||
book.apply_asks([BookLevel(price=100.5, volume=1.0)])
|
||||
|
||||
checksum = book.compute_checksum()
|
||||
|
||||
assert isinstance(checksum, int)
|
||||
assert checksum == book.compute_checksum()
|
||||
Reference in New Issue
Block a user