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], orNonewhen 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 asinstrument_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 monotonicnowof 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.