![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
What one broker client implements, as compile-time constants. More...
#include <algotradelib/src/core/broker_caps.hpp>
Public Types | |
| using | Traits = BrokerTraits<Client> |
| The traits specialization the constants are read from. | |
Static Public Member Functions | |
| static constexpr bool | supports_interval (BarInterval interval) |
| Tests whether the broker publishes bars of an interval. | |
Static Public Attributes | |
| static constexpr bool | has_account_discovery = Traits::has_account_discovery |
| Whether the broker lists the selectable accounts. | |
| static constexpr bool | has_client_order_id = Traits::has_client_order_id |
| Whether the broker accepts an idempotency key (OrderRequest::client_order_id_). | |
| static constexpr bool | has_working_orders = Traits::has_working_orders |
| Whether the broker lists the orders still open to amendment. A listing shows only what the broker's API lists (at Toss, not orders of types placed outside it). | |
| static constexpr bool | has_amendable_quantity = Traits::has_amendable_quantity |
| Whether the broker reports the quantity still amendable on an open order. | |
| static constexpr bool | working_orders_state_terminal = caps_detail::terminal_working_state<Traits>() |
| Whether the working-order listing can show a terminal status (filled, cancelled, ...). | |
| static constexpr bool | has_trigger_price = Traits::has_trigger_price |
| Whether the adapter sends trigger prices (stop-limit orders). | |
| static constexpr bool | data_only = Traits::data_only |
| Whether the client is a market-data source that takes no orders (built on DataOnlyTraits). | |
| static constexpr bool | has_order_by_id = Traits::has_order_by_id |
| Whether the broker can look up one order by its id. | |
| static constexpr bool | has_partial_cancel = Traits::has_partial_cancel |
| Whether the broker can cancel part of an order. | |
| static constexpr bool | history_requires_range = Traits::history_requires_range |
| Whether an order-history inquiry needs a date range (OrderHistoryQuery::from_). | |
| static constexpr bool | has_history_cursor = Traits::has_history_cursor |
| Whether an order-history answer can carry a cursor to the next page. | |
| static constexpr bool | has_history_limit = Traits::has_history_limit |
| Whether an order-history inquiry accepts a row limit (OrderHistoryQuery::limit_). | |
| static constexpr bool | has_history_symbol_filter = Traits::has_history_symbol_filter |
| Whether an order-history inquiry can filter by symbol. | |
| static constexpr bool | has_depth = Traits::has_depth |
| Whether the broker publishes the order book (depth). | |
| static constexpr bool | has_price_limits = Traits::has_price_limits |
| Whether the broker publishes the day's price limits. | |
| static constexpr bool | has_trade_prints = Traits::has_trade_prints |
| Whether the broker publishes recent trades. | |
| static constexpr bool | has_batch_prices = Traits::has_batch_prices |
| Whether the broker quotes several instruments in one request. | |
| static constexpr bool | has_buying_power = Traits::has_buying_power |
| Whether the broker reports buying power. | |
| static constexpr bool | has_buying_power_quantity = Traits::has_buying_power_quantity |
| Whether the broker can also say how many shares are affordable. | |
| static constexpr SellableSource | sellable_source = Traits::sellable_source |
| Where the library gets the sellable quantity: HOLDINGS costs nothing, INQUIRY one request per instrument sold, NONE means it is not available. | |
| static constexpr SellableBasis | sellable_inquiry_basis = caps_detail::inquiry_basis<Traits>() |
| What a sellable figure from the per-instrument inquiry covers. | |
| static constexpr bool | has_commission_schedule = Traits::has_commission_schedule |
| Whether the broker publishes the account's commission rates. | |
| static constexpr bool | has_reference_data = Traits::has_reference_data |
| Whether the broker publishes instrument reference data. | |
| static constexpr bool | has_batch_reference_data = Traits::has_batch_reference_data |
| Whether one reference-data request can cover several instruments. | |
| static constexpr bool | has_calendar = Traits::has_calendar |
| Whether the broker publishes the trading calendar. | |
| static constexpr bool | has_calendar_range = Traits::has_calendar_range |
| Whether one calendar request covers a span of dates. | |
| static constexpr bool | has_calendar_sessions = Traits::has_calendar_sessions |
| Whether the broker publishes intraday session hours (only Toss); the library does not expose them yet. | |
What one broker client implements, as compile-time constants.
Gate broker-specific code with if constexpr on these, so one strategy compiles against every broker. A traits specialization must answer every constant (none has a default); working_orders_state_terminal and sellable_inquiry_basis only where the inquiry they describe exists. ATL_ASSERT_BROKER reads them all.
A capability says the broker implements an operation, not that every account may call it: KIS does not offer its modifiable-order inquiry to demo accounts, so its adapter answers that read from the daily order inquiry there instead.
| Client | The broker client type. |
Definition at line 56 of file broker_caps.hpp.
| using algotradelib::BrokerCaps< Client >::Traits = BrokerTraits<Client> |
The traits specialization the constants are read from.
Definition at line 58 of file broker_caps.hpp.
|
inlinestaticconstexpr |
Tests whether the broker publishes bars of an interval.
KIS and Toss both publish minute and daily bars; only KIS publishes weekly, monthly and yearly. An interval a broker does not publish is refused, not aggregated from shorter bars.
| interval | The interval. |
Definition at line 204 of file broker_caps.hpp.
|
staticconstexpr |
Whether the client is a market-data source that takes no orders (built on DataOnlyTraits).
Binding such a client as the trading session of live::SessionExecutor or live::SessionSource does not compile. Calling place or holdings on its session directly fails at run time.
Definition at line 100 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker lists the selectable accounts.
Definition at line 61 of file broker_caps.hpp.
Referenced by algotradelib::BlockingSession< Client >::accounts(), algotradelib::async_accounts(), and algotradelib::list_accounts().
|
staticconstexpr |
Whether the broker reports the quantity still amendable on an open order.
Definition at line 73 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker quotes several instruments in one request.
Definition at line 138 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_prices(), and algotradelib::BlockingSession< Client >::prices().
|
staticconstexpr |
Whether one reference-data request can cover several instruments.
Toss takes up to 200 symbols; KIS one. The port asks for one; use session.client() for more.
Definition at line 176 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker reports buying power.
Definition at line 141 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_buying_power(), and algotradelib::BlockingSession< Client >::buying_power().
|
staticconstexpr |
Whether the broker can also say how many shares are affordable.
true for Kiwoom (per margin tier), false for Toss and KIS. The port returns only the amount; reach the quantity through session.client().
Definition at line 149 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker publishes the trading calendar.
Definition at line 179 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_calendar(), and algotradelib::BlockingSession< Client >::calendar().
|
staticconstexpr |
Whether one calendar request covers a span of dates.
KIS answers from a base date onward; Toss answers the requested day and the trading day either side.
Definition at line 187 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker publishes intraday session hours (only Toss); the library does not expose them yet.
Definition at line 193 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker accepts an idempotency key (OrderRequest::client_order_id_).
Definition at line 64 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker publishes the account's commission rates.
Definition at line 166 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_commissions(), and algotradelib::BlockingSession< Client >::commissions().
|
staticconstexpr |
Whether the broker publishes the order book (depth).
Definition at line 129 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_depth(), and algotradelib::BlockingSession< Client >::depth().
|
staticconstexpr |
Whether an order-history answer can carry a cursor to the next page.
When false, the adapter returns the whole history in one answer.
Definition at line 116 of file broker_caps.hpp.
|
staticconstexpr |
Whether an order-history inquiry accepts a row limit (OrderHistoryQuery::limit_).
false for KIS, which refuses a query with a limit (INVALID_ARGUMENT, before any I/O).
Definition at line 123 of file broker_caps.hpp.
|
staticconstexpr |
Whether an order-history inquiry can filter by symbol.
Definition at line 126 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker can look up one order by its id.
Definition at line 103 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_order(), and algotradelib::BlockingSession< Client >::order().
|
staticconstexpr |
Whether the broker can cancel part of an order.
Definition at line 106 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker publishes the day's price limits.
Definition at line 132 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_price_limits(), and algotradelib::BlockingSession< Client >::price_limits().
|
staticconstexpr |
Whether the broker publishes instrument reference data.
Definition at line 169 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_instrument(), and algotradelib::BlockingSession< Client >::instrument().
|
staticconstexpr |
Whether the broker publishes recent trades.
Definition at line 135 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_trades(), and algotradelib::BlockingSession< Client >::trades().
|
staticconstexpr |
Whether the adapter sends trigger prices (stop-limit orders).
When false, BrokerSession refuses a placement or modification carrying a trigger (unsupported_trigger_price) before the adapter runs; cancellations are unaffected. true for KIS and Kiwoom, false for Toss.
Definition at line 91 of file broker_caps.hpp.
|
staticconstexpr |
Whether the broker lists the orders still open to amendment. A listing shows only what the broker's API lists (at Toss, not orders of types placed outside it).
Definition at line 70 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_working_orders(), and algotradelib::BlockingSession< Client >::working_orders().
|
staticconstexpr |
Whether an order-history inquiry needs a date range (OrderHistoryQuery::from_).
Definition at line 109 of file broker_caps.hpp.
|
staticconstexpr |
What a sellable figure from the per-instrument inquiry covers.
Set only where sellable_source is INQUIRY (unestablished otherwise). If unestablished, checked sells are refused.
Definition at line 163 of file broker_caps.hpp.
|
staticconstexpr |
Where the library gets the sellable quantity: HOLDINGS costs nothing, INQUIRY one request per instrument sold, NONE means it is not available.
Definition at line 155 of file broker_caps.hpp.
Referenced by algotradelib::BrokerSession< Client >::async_sellable_quantity(), and algotradelib::BlockingSession< Client >::sellable_quantity().
|
staticconstexpr |
Whether the working-order listing can show a terminal status (filled, cancelled, ...).
false for KIS, Toss and Kiwoom: their listings show only open orders. Then an order that leaves the listing has no terminal on_order_update; read its outcome from holdings or an order inquiry instead of waiting for one. false here when has_working_orders is false.
Definition at line 82 of file broker_caps.hpp.