Expand description
The capability traits: what a connector can do, split by what it needs.
A market data connector implements OrderBookSource, MarketDataSource and
InstrumentSource. A user data connector (orders, fills, portfolio) implements
OrderExecutor, ExecutionSource, PortfolioSource and StopOrderExecutor. Write your
code against the traits and it runs on every broker.
Rules that hold for all of them:
- A call that reads or commands returns its answer directly. A subscription call returns a
SubscriptionIdand the events come later asEnvelopes in the channel given to the connector at start. - A capability the broker lacks answers
Error::Unsupportedat once, without a network call. Read the connector’s caps (MarketDataCaps,UserDataCaps) to know in advance. - A trading command is never repeated by the library. If the outcome is unknown the error is
Error::Unknown, see there what to do. - Trading commands are refused with
Error::NotReconcileduntil the first successfulOrderExecutor::reconcile, withError::Degradedafter a lost event, and withError::ShuttingDownduring shutdown. Reading calls are not gated by this.
Traits§
- Connector
- What every connector offers besides its capabilities: it says what it can do, and it stops.
- Execution
Source - Your own fills: the history and the live stream.
- Instrument
Source - The instrument directory and the rules for trading an instrument.
- Market
Data Source - Public trades, quotes and candles: history reads and streams.
- Order
Book Source - Order book snapshot and stream.
- Order
Executor - Orders: put, cancel, replace, look at them, follow them, and reconcile with your ledger.
- Portfolio
Source - The account: money and positions, as a snapshot and as a stream.
- Stop
Order Executor - Stop orders, take-profit and stop-limit - an extra capability next to
OrderExecutor(UserDataCaps::supports_stop_orderstells whether the broker has it).