![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
The mock broker's adaptation: what it implements, and the thunks to mock::MockClient. More...
#include <algotradelib/src/brokers/mock/traits.hpp>
Public Types | |
| using | Client = mock::MockClient |
| The client. | |
| using | Config = mock::MarketSettings |
| The configuration: the market's settings. | |
| using | Account = mock::MockAccount |
| The account; the mock has one. | |
| using | BrokerTag = mock::Broker |
| The broker tag. | |
| using | PlaceAck = PlacedOrder<mock::Broker> |
| The acknowledgement, already normalized. | |
| using | Amendment = mock::MockAmendment |
| A cancellation. | |
| using | HistoryQuery = OrderHistoryQuery |
| The history query, the library's own. | |
| using | WorkingOrdersResult = WorkingOrders<mock::Broker> |
| The working-order listing, already normalized. | |
Static Public Member Functions | |
| static constexpr bool | supports_interval (BarInterval interval) |
| Tests whether the mock can hold bars of an interval: minute to daily. | |
| static std::optional< BrokerError > | validate_bars (const BarQuery &query) |
| Refuses a bar request for an interval no market can hold, before the client. | |
| static std::optional< BrokerError > | validate_calendar (Country, std::optional< Date >) |
| Admits every calendar request; the market refuses another country itself. | |
| static std::optional< BrokerError > | validate_place (const OrderRequest &order) |
| Refuses an idempotency key, before the client. | |
| static Result< PlacedOrder< mock::Broker > > | normalize_place (Result< PlaceAck > raw) |
| Returns the acknowledgement as it is: the market answers in the library's own shape. | |
| static Result< WorkingOrders< mock::Broker > > | normalize_working_orders (Result< WorkingOrdersResult > raw) |
| Returns the listing as it is. | |
| static Result< Amendment > | to_replacement (const OrderRef< mock::Broker > &, const AmendInstruction &) |
| Refuses every modification: the mock broker cancels but does not modify orders. | |
| static Result< Amendment > | to_cancellation (const OrderRef< mock::Broker > &ref, const AmendInstruction &instruction) |
| Converts a cancellation of the whole remainder; refuses a stated quantity. | |
| static Result< HistoryQuery > | to_history_query (const Account &, const OrderHistoryQuery &query) |
| Passes a history query through; refuses a symbol filter or a row limit. | |
| static const network::RateLimitStats * | rate_limit_stats (const Client &) |
| The mock broker is never paced. | |
| static Result< QuoteSnapshot > | quote (Client &client, InstrumentId instrument) |
| Forwards a quote request. | |
| static Result< Instrument > | instrument (Client &client, InstrumentId instrument) |
| Forwards a reference-data request. | |
| static Result< TradingCalendar > | calendar (Client &client, Country country, std::optional< Date >) |
| Forwards a calendar request; the answer covers every date the market has, whatever from. | |
| static Result< BarSeries > | bars (Client &client, BarQuery query) |
| Forwards a bar request. | |
| static Result< HoldingsSnapshot > | holdings (Client &client, const Account &) |
| Forwards a holdings request. | |
| static Result< BuyingPower > | buying_power (Client &client, const Account &, Currency currency) |
| Forwards a buying-power request. | |
| static Result< PlaceAck > | place_order (Client &client, const Account &, OrderRequest order) |
| Forwards a placement. | |
| static Result< PlaceAck > | replace_order (Client &, const Account &, Amendment) |
| Never called: to_replacement refuses every modification. | |
| static Result< PlaceAck > | cancel_order (Client &client, const Account &, Amendment amendment) |
| Forwards a cancellation. | |
| static Result< WorkingOrdersResult > | working_orders (Client &client, const Account &) |
| Forwards a working-order request. | |
| static Result< OrderPage > | order_history (Client &client, const Account &, HistoryQuery query) |
| Forwards an order-history request. | |
Static Public Attributes | |
| static constexpr std::string_view | name = mock::Broker::name |
| The broker's name, "mock". | |
| static constexpr bool | blocking = true |
| The client returns each result. | |
| static constexpr bool | data_only = false |
| It takes orders. | |
| static constexpr bool | has_account_discovery = false |
| No account listing: there is one account. | |
| static constexpr bool | has_client_order_id = false |
| No idempotency key. | |
| static constexpr bool | has_working_orders = true |
| Lists open orders. | |
| static constexpr bool | has_amendable_quantity = true |
| Reports each open order's quantity as amendable. | |
| static constexpr bool | working_orders_state_terminal = false |
| The listing shows open orders only, as every shipped broker's does. | |
| static constexpr bool | has_trigger_price = false |
| No stop-limit orders. | |
| static constexpr bool | has_order_by_id = false |
| No single-order inquiry. | |
| static constexpr bool | has_partial_cancel = false |
| Cancels the whole remainder only. | |
| static constexpr bool | history_requires_range = false |
| The history needs no date range. | |
| static constexpr bool | has_history_cursor = false |
| The whole history comes in one answer. | |
| static constexpr bool | has_history_limit = false |
| No row limit. | |
| static constexpr bool | has_history_symbol_filter = false |
| No symbol filter. | |
| static constexpr bool | has_depth = false |
| No order book. | |
| static constexpr bool | has_price_limits = false |
| No price band. | |
| static constexpr bool | has_trade_prints = false |
| No trade prints. | |
| static constexpr bool | has_batch_prices = false |
| One quote per request. | |
| static constexpr bool | has_buying_power = true |
| Reports buying power. | |
| static constexpr bool | has_buying_power_quantity = false |
| No affordable quantity. | |
| static constexpr SellableSource | sellable_source = SellableSource::HOLDINGS |
| The holdings rows carry the sellable quantity. | |
| static constexpr bool | has_commission_schedule = false |
| No commission schedule; costs come from the market's fill model. | |
| static constexpr bool | has_reference_data = true |
| Answers reference data: what the market was given, or its default. | |
| static constexpr bool | has_batch_reference_data = false |
| No reference data. | |
| static constexpr bool | has_calendar = true |
| Publishes a calendar: what the market was given, or the dates of its bars. | |
| static constexpr bool | has_calendar_range = true |
| One answer covers every date the market has. | |
| static constexpr bool | has_calendar_sessions = false |
| No session hours. | |
The mock broker's adaptation: what it implements, and the thunks to mock::MockClient.
It lists working orders (open orders only), reports buying power, carries the sellable quantity on its holdings rows, and answers reference data and a calendar (what the market was given, or its defaults). It refuses before calling the client: a trigger price, an idempotency key, a modification (replace_unsupported), a partial cancellation (partial_cancel_unsupported), and a history filtered by symbol or limited to a row count.
Definition at line 30 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::Account = mock::MockAccount |
The account; the mock has one.
Definition at line 36 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::Amendment = mock::MockAmendment |
A cancellation.
Definition at line 42 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::BrokerTag = mock::Broker |
The broker tag.
Definition at line 38 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::Client = mock::MockClient |
The client.
Definition at line 32 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::Config = mock::MarketSettings |
The configuration: the market's settings.
Definition at line 34 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::HistoryQuery = OrderHistoryQuery |
The history query, the library's own.
Definition at line 44 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::PlaceAck = PlacedOrder<mock::Broker> |
The acknowledgement, already normalized.
Definition at line 40 of file traits.hpp.
| using algotradelib::BrokerTraits< mock::MockClient >::WorkingOrdersResult = WorkingOrders<mock::Broker> |
The working-order listing, already normalized.
Definition at line 46 of file traits.hpp.
|
inlinestatic |
Forwards a bar request.
| client | The client. |
| query | The query. |
Definition at line 251 of file traits.hpp.
|
inlinestatic |
Forwards a buying-power request.
| client | The client. |
| currency | The currency. |
Definition at line 270 of file traits.hpp.
|
inlinestatic |
Forwards a calendar request; the answer covers every date the market has, whatever from.
| client | The client. |
| country | The market. |
Definition at line 241 of file traits.hpp.
|
inlinestatic |
Forwards a cancellation.
| client | The client. |
| amendment | The order id. |
Definition at line 298 of file traits.hpp.
|
inlinestatic |
Forwards a holdings request.
| client | The client. |
Definition at line 260 of file traits.hpp.
|
inlinestatic |
Forwards a reference-data request.
| client | The client. |
| instrument | The instrument. |
Definition at line 231 of file traits.hpp.
Referenced by instrument(), and quote().
|
inlinestatic |
Returns the acknowledgement as it is: the market answers in the library's own shape.
| raw | The client's answer. |
Definition at line 155 of file traits.hpp.
|
inlinestatic |
Returns the listing as it is.
| raw | The client's answer. |
Definition at line 164 of file traits.hpp.
|
inlinestatic |
Forwards an order-history request.
| client | The client. |
| query | The query. |
Definition at line 317 of file traits.hpp.
|
inlinestatic |
Forwards a placement.
| client | The client. |
| order | The order. |
Definition at line 280 of file traits.hpp.
|
inlinestatic |
Forwards a quote request.
| client | The client. |
| instrument | The instrument. |
Definition at line 221 of file traits.hpp.
|
inlinestatic |
|
inlinestatic |
Never called: to_replacement refuses every modification.
Definition at line 288 of file traits.hpp.
|
inlinestaticconstexpr |
Tests whether the mock can hold bars of an interval: minute to daily.
A market answers only the interval of each instrument's own series (unsupported_interval).
| interval | The interval. |
Definition at line 114 of file traits.hpp.
Referenced by validate_bars().
|
inlinestatic |
Converts a cancellation of the whole remainder; refuses a stated quantity.
| ref | The order. |
| instruction | The cancellation. |
Definition at line 184 of file traits.hpp.
|
inlinestatic |
Passes a history query through; refuses a symbol filter or a row limit.
| query | The query. |
Definition at line 198 of file traits.hpp.
|
inlinestatic |
Refuses every modification: the mock broker cancels but does not modify orders.
Definition at line 172 of file traits.hpp.
|
inlinestatic |
Refuses a bar request for an interval no market can hold, before the client.
| query | The query. |
Definition at line 123 of file traits.hpp.
|
inlinestatic |
Admits every calendar request; the market refuses another country itself.
Definition at line 134 of file traits.hpp.
|
inlinestatic |
Refuses an idempotency key, before the client.
| order | The order. |
Definition at line 143 of file traits.hpp.
|
inlinestatic |
Forwards a working-order request.
| client | The client. |
Definition at line 307 of file traits.hpp.
|
staticconstexpr |
The client returns each result.
Definition at line 51 of file traits.hpp.
|
staticconstexpr |
It takes orders.
Definition at line 53 of file traits.hpp.
|
staticconstexpr |
No account listing: there is one account.
Definition at line 56 of file traits.hpp.
|
staticconstexpr |
Reports each open order's quantity as amendable.
Definition at line 62 of file traits.hpp.
|
staticconstexpr |
One quote per request.
Definition at line 86 of file traits.hpp.
|
staticconstexpr |
No reference data.
Definition at line 98 of file traits.hpp.
|
staticconstexpr |
Reports buying power.
Definition at line 88 of file traits.hpp.
|
staticconstexpr |
No affordable quantity.
Definition at line 90 of file traits.hpp.
|
staticconstexpr |
Publishes a calendar: what the market was given, or the dates of its bars.
Definition at line 100 of file traits.hpp.
|
staticconstexpr |
One answer covers every date the market has.
Definition at line 102 of file traits.hpp.
|
staticconstexpr |
No session hours.
Definition at line 104 of file traits.hpp.
|
staticconstexpr |
No idempotency key.
Definition at line 58 of file traits.hpp.
|
staticconstexpr |
No commission schedule; costs come from the market's fill model.
Definition at line 94 of file traits.hpp.
|
staticconstexpr |
No order book.
Definition at line 80 of file traits.hpp.
|
staticconstexpr |
The whole history comes in one answer.
Definition at line 74 of file traits.hpp.
|
staticconstexpr |
No row limit.
Definition at line 76 of file traits.hpp.
|
staticconstexpr |
No symbol filter.
Definition at line 78 of file traits.hpp.
|
staticconstexpr |
No single-order inquiry.
Definition at line 68 of file traits.hpp.
|
staticconstexpr |
Cancels the whole remainder only.
Definition at line 70 of file traits.hpp.
|
staticconstexpr |
No price band.
Definition at line 82 of file traits.hpp.
|
staticconstexpr |
Answers reference data: what the market was given, or its default.
Definition at line 96 of file traits.hpp.
|
staticconstexpr |
No trade prints.
Definition at line 84 of file traits.hpp.
|
staticconstexpr |
No stop-limit orders.
Definition at line 66 of file traits.hpp.
|
staticconstexpr |
Lists open orders.
Definition at line 60 of file traits.hpp.
|
staticconstexpr |
The history needs no date range.
Definition at line 72 of file traits.hpp.
|
staticconstexpr |
The broker's name, "mock".
Definition at line 49 of file traits.hpp.
|
staticconstexpr |
The holdings rows carry the sellable quantity.
Definition at line 92 of file traits.hpp.
|
staticconstexpr |
The listing shows open orders only, as every shipped broker's does.
Definition at line 64 of file traits.hpp.