Skip to main content

Module traits

Module traits 

Source
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:

Traits§

Connector
What every connector offers besides its capabilities: it says what it can do, and it stops.
ExecutionSource
Your own fills: the history and the live stream.
InstrumentSource
The instrument directory and the rules for trading an instrument.
MarketDataSource
Public trades, quotes and candles: history reads and streams.
OrderBookSource
Order book snapshot and stream.
OrderExecutor
Orders: put, cancel, replace, look at them, follow them, and reconcile with your ledger.
PortfolioSource
The account: money and positions, as a snapshot and as a stream.
StopOrderExecutor
Stop orders, take-profit and stop-limit - an extra capability next to OrderExecutor (UserDataCaps::supports_stop_orders tells whether the broker has it).