basana.external.binance.order_book_diff

class basana.external.binance.order_book_diff.OrderBookDiffEvent(when, order_book_diff)

Bases: Event

An event for order book diffs.

Parameters:
  • when (datetime) – The datetime when the event occurred. It must have timezone information set.

  • order_book_diff (OrderBookDiff) – The order book diff.

order_book_diff: OrderBookDiff

The order book diff.

class basana.external.binance.order_book_diff.OrderBookDiff(pair, json)

An order book diff as described in https://developers.binance.com/docs/binance-spot-api-docs/web-socket-streams#diff-depth-stream

Parameters:
  • pair (Pair)

  • json (dict)

property asks: List[Entry]

Asks to be updated.

property bids: List[Entry]

Bids to be updated.

property final_update_id: int

The final update id.

property first_update_id: int

The first update id.

json: dict

The JSON representation.

pair: Pair

The trading pair.

class basana.external.binance.order_book_diff.Entry(price: decimal.Decimal, volume: decimal.Decimal)
Parameters:
  • price (Decimal)

  • volume (Decimal)

price: Decimal

The price.

volume: Decimal

The volume.