Skip to main content

Module market

Module market 

Expand description

Market data mapping: BCS wire models to brokapi-core domain types.

Structs§

MappedMarketEvent
An event mapped from a market data message, with the subscription it belongs to if known.

Traits§

BookLevelSource
A price level of an order book in either wire form (REST or WebSocket), so one function can map both.

Functions§

map_last_trade
Maps a market trade message to a [MarketTrade].
map_quotes
Maps a quotes message to a [Quote].
map_rest_candles
Maps the candles of POST /candles-chart to domain candles of the timeframe tf that was asked.
map_rest_last_trade
One trade of the tape (POST /last-trades) for instrument, the one asked for: the records of the docs carry no instrument. Side is 1 buy / 2 sell (older samples: BUY / SELL); a record whose side is neither is dropped rather than guessed.
map_rest_order_book
Maps a REST order book answer to an [Event::OrderBook] holding an [OrderBook::Snapshot].
map_ws_market_data
Maps a market data WebSocket message to an event.
map_ws_order_book
Maps a WebSocket order book message to an [OrderBook::Snapshot]. Every message of this stream is a full book, not a delta.
parse_subscribe_error
Detect BCS market-data subscribe error payloads (errors array).