python-kraken-sdk icon indicating copy to clipboard operation
python-kraken-sdk copied to clipboard

Populate OrderBook with current state when add_book is called

Open jbsmithj1981 opened this issue 1 year ago • 2 comments

I've created an order book client for a slowly moving market so it can be a long time until we receive a change to the orderbook. When that happens, there is no call to on_book_update callback and we end up with an empty orderbook in the downstream system.

What does the team think about updating the orderbook with the current state of the orderbook , calling on_book_update with this initial state to emit an initial event when add_book is called.

This would avoid the situation where we know there are orders in the odrerbook but there have been no changes to the order book with would trigger the on_book_update callback?

jbsmithj1981 avatar Aug 24 '24 18:08 jbsmithj1981

Hello @OpenCoderX, do you have a reproducible example? As far as I can see is the initial snapshot already respected and on_book_update is called, as soon as the initial snapshot is processed (see https://github.com/btschwertfeger/python-kraken-sdk/blob/v3.1.0/kraken/spot/orderbook.py#L194-L213).

Meaning that the book is only empty for a really short time.

btschwertfeger avatar Aug 27 '24 06:08 btschwertfeger

@OpenCoderX, could you verify that your issue does not exist with the latest versions?

btschwertfeger avatar Sep 24 '24 06:09 btschwertfeger

Closing the issue, as the it seems like there is no problem anymore.

btschwertfeger avatar Nov 24 '24 17:11 btschwertfeger