Skip to main content

Module map

Module map 

Source
Expand description

Mappers from the BCS wire models to the brokapi-core domain types.

The functions are pure: they take a model that the protocol crate parsed and the current monotonic time, and they return a domain value. They never fail loudly. A record that cannot be mapped safely is dropped (None or an empty list), not guessed. Where the documentation of the API leaves a choice open, the function says which choice it makes.

The connectors call these functions. You need them only to read raw data from BcsRaw in the same shape as the shared traits give it.

Modules§

execution
Execution history mapping.
instrument
Instrument reference data mapping.
market
Market data mapping: BCS wire models to brokapi-core domain types.
order
Order and execution mapping.
portfolio
Portfolio mapping.
schedule
Schedule mapping.
stop
Stop orders: PlaceStopOrderRequest -> BCS conditional order (orderType = "5").

Functions§

bcs_instrument_key
Returns the BCS instrument key of an [InstrumentId], or None when its native id is not [NativeId::TickerClass] (the id came from another broker).
instrument_id
Builds an [InstrumentId] from a BCS instrument key. The native id is [NativeId::TickerClass], the form every BCS call wants.
instrument_id_ticker
Builds an [InstrumentId] from a ticker and a class code (board). Same as instrument_id.
parse_broker_ts
Parses a time string of the BCS API into nanoseconds since the Unix epoch.
timestamps
Builds the [Timestamps] of an event: the local receive time now (wall clock), the monotonic now of the receive, and the broker’s own time when it is known.
unix_nanos
Converts a UTC date and time to nanoseconds since the Unix epoch. A date outside the range that fits in 64 bits (years 1677 to 2262) gives 0.
whole_pieces
The order quantity as the whole number of pieces the BCS order API takes.