algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
concept.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "./event.hpp"
4#include "./intent.hpp"
5#include "./portfolio.hpp"
6
7#include <chrono>
8#include <optional>
9#include <string>
10#include <string_view>
11#include <type_traits>
12#include <utility>
13#include <vector>
14
15namespace algotradelib {
16namespace strategy {
17
52
53namespace strategy_detail {
54
68#define ATL_DETECT_DECLARED(NAME) \
69 struct NAME##_fallback { \
70 int NAME; \
71 }; \
72 template <typename S> \
73 struct NAME##_probe : S, NAME##_fallback {}; \
74 template <typename S, typename = void> \
75 struct NAME##_is_ambiguous : std::true_type {}; \
76 template <typename S> \
77 struct NAME##_is_ambiguous<S, std::void_t<decltype(&NAME##_probe<S>::NAME)>> \
78 : std::false_type {}; \
79 template <typename S> \
80 constexpr bool declares_##NAME = std::conjunction_v< \
81 std::is_class<S>, std::negation<std::is_final<S>>, NAME##_is_ambiguous<S> \
82 >
83
84ATL_DETECT_DECLARED(on_start);
85ATL_DETECT_DECLARED(on_stop);
87ATL_DETECT_DECLARED(on_bars);
88ATL_DETECT_DECLARED(on_quote);
89ATL_DETECT_DECLARED(on_fill);
90ATL_DETECT_DECLARED(on_order_update);
91ATL_DETECT_DECLARED(on_phase);
92
93#undef ATL_DETECT_DECLARED
94
96template <typename S>
97constexpr bool declares_any_handler =
98 declares_on_start<S> || declares_on_stop<S> || declares_on_bar<S> || declares_on_bars<S> ||
99 declares_on_quote<S> || declares_on_fill<S> || declares_on_order_update<S> || declares_on_phase<S>;
100
102template <typename S>
103constexpr bool names_can_be_read = std::is_class_v<S> && !std::is_final_v<S>;
104
106template <typename S>
107void require_readable_names() {
108 static_assert(
109 names_can_be_read<S>,
110 "a final strategy cannot be checked for a handler the runner would skip, because its member names "
111 "cannot be looked up; remove `final` from the strategy class"
112 );
113}
114
119template <typename S>
120void require_one_bar_handler() {
121 static_assert(
122 !(declares_on_bar<S> && declares_on_bars<S>),
123 "a strategy declares on_bar or on_bars, not both: on_bar receives each bar, on_bars every "
124 "instrument's bar of a period at once; keep the one this strategy decides with"
125 );
126}
127
128} // namespace strategy_detail
129
138namespace dispatch {
139
148template <typename S, typename Ctx>
149void start(S& strategy, Ctx& context) {
150 strategy_detail::require_readable_names<S>();
151 if constexpr (strategy_detail::declares_on_start<S>) {
152 strategy.on_start(context);
153 } else {
154 static_cast<void>(strategy);
155 static_cast<void>(context);
156 }
157}
158
167template <typename S, typename Ctx>
168void stop(S& strategy, Ctx& context) {
169 strategy_detail::require_readable_names<S>();
170 if constexpr (strategy_detail::declares_on_stop<S>) {
171 strategy.on_stop(context);
172 } else {
173 static_cast<void>(strategy);
174 static_cast<void>(context);
175 }
176}
177
190template <typename S, typename Ctx>
191void bar(S& strategy, Ctx& context, const BarEvent& event) {
192 strategy_detail::require_readable_names<S>();
193 strategy_detail::require_one_bar_handler<S>();
194 static_assert(
195 strategy_detail::declares_on_bar<S> || !strategy_detail::declares_on_bars<S>,
196 "this strategy declares on_bars, so its bars are delivered in slices: feed it through "
197 "Runner::record and Runner::feed(const BarSlice&), not one BarEvent at a time"
198 );
199 if constexpr (strategy_detail::declares_on_bar<S>) {
200 strategy.on_bar(context, event);
201 } else {
202 static_cast<void>(strategy);
203 static_cast<void>(context);
204 static_cast<void>(event);
205 }
206}
207
217template <typename S, typename Ctx>
218void bars(S& strategy, Ctx& context, const BarSlice& slice) {
219 strategy_detail::require_readable_names<S>();
220 strategy_detail::require_one_bar_handler<S>();
221 if constexpr (strategy_detail::declares_on_bars<S>) {
222 strategy.on_bars(context, slice);
223 } else {
224 static_cast<void>(strategy);
225 static_cast<void>(context);
226 static_cast<void>(slice);
227 }
228}
229
239template <typename S, typename Ctx>
240void quote(S& strategy, Ctx& context, const QuoteEvent& event) {
241 strategy_detail::require_readable_names<S>();
242 if constexpr (strategy_detail::declares_on_quote<S>) {
243 strategy.on_quote(context, event);
244 } else {
245 static_cast<void>(strategy);
246 static_cast<void>(context);
247 static_cast<void>(event);
248 }
249}
250
260template <typename S, typename Ctx>
261void fill(S& strategy, Ctx& context, const Fill& event) {
262 strategy_detail::require_readable_names<S>();
263 if constexpr (strategy_detail::declares_on_fill<S>) {
264 strategy.on_fill(context, event);
265 } else {
266 static_cast<void>(strategy);
267 static_cast<void>(context);
268 static_cast<void>(event);
269 }
270}
271
281template <typename S, typename Ctx>
282void order_update(S& strategy, Ctx& context, const OrderSnapshot& event) {
283 strategy_detail::require_readable_names<S>();
284 if constexpr (strategy_detail::declares_on_order_update<S>) {
285 strategy.on_order_update(context, event);
286 } else {
287 static_cast<void>(strategy);
288 static_cast<void>(context);
289 static_cast<void>(event);
290 }
291}
292
303template <typename S, typename Ctx>
304void phase(S& strategy, Ctx& context, const MarketPhase& event) {
305 strategy_detail::require_readable_names<S>();
306 if constexpr (strategy_detail::declares_on_phase<S>) {
307 strategy.on_phase(context, event);
308 } else {
309 static_cast<void>(strategy);
310 static_cast<void>(context);
311 static_cast<void>(event);
312 }
313}
314
315} // namespace dispatch
316
317namespace strategy_detail {
318
320template <typename S, typename Ctx>
321void call_every_handler(
322 S& strategy, Ctx& context, const BarEvent& bar, const BarSlice& slice, const QuoteEvent& quote,
323 const Fill& fill, const OrderSnapshot& order, const MarketPhase& phase
324) {
325 dispatch::start(strategy, context);
326 dispatch::stop(strategy, context);
327 // The bar route the runner takes: slices for a strategy declaring `on_bars`, single bars otherwise.
328 if constexpr (declares_on_bars<S>) {
329 static_cast<void>(bar);
330 dispatch::bars(strategy, context, slice);
331 } else {
332 static_cast<void>(slice);
333 dispatch::bar(strategy, context, bar);
334 }
335 dispatch::quote(strategy, context, quote);
336 dispatch::fill(strategy, context, fill);
337 dispatch::order_update(strategy, context, order);
338 dispatch::phase(strategy, context, phase);
339}
340
345template <typename S, typename Ctx>
346constexpr bool compiles_every_handler_call() {
347 if constexpr (names_can_be_read<S>) {
348 static_cast<void>(&call_every_handler<S, Ctx>);
349 }
350 return true;
351}
352
353} // namespace strategy_detail
354
360struct NoCaps {
362 static constexpr bool has_account_discovery = false;
364 static constexpr bool has_client_order_id = false;
366 static constexpr bool has_trigger_price = false;
368 static constexpr bool data_only = false;
370 static constexpr bool has_working_orders = false;
372 static constexpr bool working_orders_state_terminal = false;
374 static constexpr bool has_amendable_quantity = false;
376 static constexpr bool has_order_by_id = false;
378 static constexpr bool has_partial_cancel = false;
380 static constexpr bool history_requires_range = false;
382 static constexpr bool has_history_cursor = false;
384 static constexpr bool has_history_limit = false;
386 static constexpr bool has_history_symbol_filter = false;
388 static constexpr bool has_depth = false;
390 static constexpr bool has_price_limits = false;
392 static constexpr bool has_trade_prints = false;
394 static constexpr bool has_batch_prices = false;
396 static constexpr bool has_reference_data = false;
398 static constexpr bool has_batch_reference_data = false;
400 static constexpr bool has_calendar = false;
402 static constexpr bool has_calendar_range = false;
404 static constexpr bool has_calendar_sessions = false;
406 static constexpr bool has_buying_power = false;
408 static constexpr bool has_buying_power_quantity = false;
410 static constexpr bool has_commission_schedule = false;
419 static constexpr bool supports_interval(BarInterval) { return false; }
420};
421
423struct AllCaps {
425 static constexpr bool has_account_discovery = true;
427 static constexpr bool has_client_order_id = true;
429 static constexpr bool has_trigger_price = true;
431 static constexpr bool data_only = false;
433 static constexpr bool has_working_orders = true;
435 static constexpr bool working_orders_state_terminal = true;
437 static constexpr bool has_amendable_quantity = true;
439 static constexpr bool has_order_by_id = true;
441 static constexpr bool has_partial_cancel = true;
443 static constexpr bool history_requires_range = true;
445 static constexpr bool has_history_cursor = true;
447 static constexpr bool has_history_limit = true;
449 static constexpr bool has_history_symbol_filter = true;
451 static constexpr bool has_depth = true;
453 static constexpr bool has_price_limits = true;
455 static constexpr bool has_trade_prints = true;
457 static constexpr bool has_batch_prices = true;
459 static constexpr bool has_reference_data = true;
461 static constexpr bool has_batch_reference_data = true;
463 static constexpr bool has_calendar = true;
465 static constexpr bool has_calendar_range = true;
467 static constexpr bool has_calendar_sessions = true;
469 static constexpr bool has_buying_power = true;
471 static constexpr bool has_buying_power_quantity = true;
473 static constexpr bool has_commission_schedule = true;
482
486 static constexpr bool supports_interval(BarInterval) { return true; }
487};
488
492 static constexpr std::string_view name = "probe";
493};
494
508template <typename CapsType>
510public:
514 using caps = CapsType;
515
517 ProbeContextT() = default;
519 ProbeContextT(const ProbeContextT&) = delete;
532
534 class Log {
535 public:
540 void note(std::string_view message) { lines_.emplace_back(message); }
545 const std::vector<std::string>& lines() const noexcept { return lines_; }
546
547 private:
548 std::vector<std::string> lines_;
549 };
550
555 std::chrono::system_clock::time_point now() const noexcept { return now_; }
556
561 MarketPhase phase() const noexcept { return phase_; }
562
567 const TradingCalendar& calendar() const noexcept { return calendar_; }
568
573 const Portfolio<ProbeBroker>& portfolio() const noexcept { return portfolio_; }
574
581 std::optional<Instrument> instrument(const InstrumentId& id) const {
582 for (const auto& known : instruments_) {
583 if (known.id_ == id) {
584 return known;
585 }
586 }
587 return std::nullopt;
588 }
589
594 void submit(OrderIntent intent) { submitted_.push_back(std::move(intent)); }
595
600 void submit(TargetPosition target) { targets_.push_back(std::move(target)); }
601
606 void cancel(const OrderRef<ProbeBroker>& ref) {
607 canceled_.push_back(CancelIntent<ProbeBroker>{ref, {}});
608 }
609
614 Log& log() noexcept { return log_; }
615
620 const std::vector<OrderIntent>& submitted() const noexcept { return submitted_; }
625 const std::vector<TargetPosition>& targets() const noexcept { return targets_; }
630 const std::vector<CancelIntent<ProbeBroker>>& canceled() const noexcept { return canceled_; }
631
633 std::chrono::system_clock::time_point now_{};
641 std::vector<Instrument> instruments_;
642
643private:
644 std::vector<OrderIntent> submitted_;
645 std::vector<TargetPosition> targets_;
646 std::vector<CancelIntent<ProbeBroker>> canceled_;
647 Log log_;
648};
649
652
655
662template <typename S, typename Ctx>
664 // A strategy's handler names are looked up through a class derived from it, which a `final` class does
665 // not allow; read any other way, a handler the runner cannot call could be skipped in silence.
666 static_assert(
667 strategy_detail::names_can_be_read<S>,
668 "a final strategy cannot be checked for a handler the runner would skip, because its member names "
669 "cannot be looked up; remove `final` from the strategy class"
670 );
671 // A handler taking its context by value would submit to a copy, and what it submitted would be lost.
672 // Every context this library hands a strategy is move-only; a caller's own must be too -- from the
673 // mutable lvalue `dispatch` passes as well as from a `const` one, since a copy constructor may take either.
674 static_assert(
675 !std::is_copy_constructible_v<Ctx> && !std::is_constructible_v<Ctx, Ctx&>,
676 "a strategy context must not be copyable, so that a handler taking it by value does not compile "
677 "(what it submitted would go to the copy and be lost); delete the context's copy constructor"
678 );
679 static_assert(
680 strategy_detail::declares_any_handler<S>,
681 "This type declares no strategy handler. Expected at least one of on_start, on_bar, on_bars, "
682 "on_quote, on_fill, on_order_update, on_phase, or on_stop"
683 );
684 static_assert(
685 !(strategy_detail::declares_on_bar<S> && strategy_detail::declares_on_bars<S>),
686 "a strategy declares on_bar or on_bars, not both: on_bar receives each bar, on_bars every "
687 "instrument's bar of a period at once; keep the one this strategy decides with"
688 );
689
691 static constexpr bool value = strategy_detail::compiles_every_handler_call<S, Ctx>();
692};
693
712#define ATL_ASSERT_STRATEGY(S, Ctx) \
713 static_assert( \
714 ::algotradelib::strategy::StrategyConformance<S, Ctx>::value, \
715 "Strategy does not satisfy the algotradelib strategy surface; see the messages above" \
716 )
717
718} // namespace strategy
719} // namespace algotradelib
One order a strategy asks the runner to place.
Definition intent.hpp:249
A log that keeps each line in memory for a test to read.
Definition concept.hpp:534
void note(std::string_view message)
Records one line.
Definition concept.hpp:540
const std::vector< std::string > & lines() const noexcept
Returns the recorded lines.
Definition concept.hpp:545
A context for testing a strategy without a runner: it records what the strategy asks for.
Definition concept.hpp:509
ProbeContextT & operator=(const ProbeContextT &)=delete
Deleted: a probe cannot be copied.
std::chrono::system_clock::time_point now() const noexcept
Returns the current instant.
Definition concept.hpp:555
const std::vector< CancelIntent< ProbeBroker > > & canceled() const noexcept
Returns the cancellations requested.
Definition concept.hpp:630
void cancel(const OrderRef< ProbeBroker > &ref)
Records a cancellation.
Definition concept.hpp:606
const std::vector< TargetPosition > & targets() const noexcept
Returns the target positions submitted.
Definition concept.hpp:625
const Portfolio< ProbeBroker > & portfolio() const noexcept
Returns the portfolio.
Definition concept.hpp:573
CapsType caps
The broker capabilities the strategy sees.
Definition concept.hpp:514
ProbeContextT & operator=(ProbeContextT &&)=default
Move assignment: takes the other probe's state.
ProbeBroker Broker
The broker tag; see ProbeBroker.
Definition concept.hpp:512
Log & log() noexcept
Returns the log.
Definition concept.hpp:614
ProbeContextT(ProbeContextT &&)=default
Move constructor: takes the other probe's state.
const TradingCalendar & calendar() const noexcept
Returns the trading calendar.
Definition concept.hpp:567
void submit(TargetPosition target)
Records a target position.
Definition concept.hpp:600
std::chrono::system_clock::time_point now_
Definition concept.hpp:633
void submit(OrderIntent intent)
Records an order intent.
Definition concept.hpp:594
MarketPhase phase() const noexcept
Returns the market phase.
Definition concept.hpp:561
const std::vector< OrderIntent > & submitted() const noexcept
Returns the order intents submitted.
Definition concept.hpp:620
ProbeContextT()=default
Constructs an empty probe.
std::optional< Instrument > instrument(const InstrumentId &id) const
Looks up an instrument's reference data in instruments_.
Definition concept.hpp:581
ProbeContextT(const ProbeContextT &)=delete
Deleted: like a runner's context, a probe cannot be copied.
#define ATL_DETECT_DECLARED(NAME)
Definition concept.hpp:68
The events a runner delivers to a strategy's handlers, and the market phase.
What a strategy asks the runner for: orders (OrderIntent), target positions (TargetPosition) and canc...
Calls a strategy's handlers, skipping the ones it does not declare.
Definition concept.hpp:138
void phase(S &strategy, Ctx &context, const MarketPhase &event)
Calls strategy.on_phase(context, event) if the strategy declares on_phase; otherwise does nothing.
Definition concept.hpp:304
void quote(S &strategy, Ctx &context, const QuoteEvent &event)
Calls strategy.on_quote(context, event) if the strategy declares on_quote; otherwise does nothing.
Definition concept.hpp:240
void start(S &strategy, Ctx &context)
Calls strategy.on_start(context) if the strategy declares on_start; otherwise does nothing.
Definition concept.hpp:149
void stop(S &strategy, Ctx &context)
Calls strategy.on_stop(context) if the strategy declares on_stop; otherwise does nothing.
Definition concept.hpp:168
void bar(S &strategy, Ctx &context, const BarEvent &event)
Calls strategy.on_bar(context, event) if the strategy declares on_bar; otherwise does nothing.
Definition concept.hpp:191
void fill(S &strategy, Ctx &context, const Fill &event)
Calls strategy.on_fill(context, event) if the strategy declares on_fill; otherwise does nothing.
Definition concept.hpp:261
void order_update(S &strategy, Ctx &context, const OrderSnapshot &event)
Calls strategy.on_order_update(context, event) if the strategy declares on_order_update; otherwise do...
Definition concept.hpp:282
void bars(S &strategy, Ctx &context, const BarSlice &slice)
Calls strategy.on_bars(context, slice) if the strategy declares on_bars; otherwise does nothing.
Definition concept.hpp:218
What a strategy sees and emits: events, intents, the portfolio, reconciliation and risk limits.
Definition concept.hpp:16
MarketPhase
Where the clock stands relative to the trading session.
Definition event.hpp:30
@ OPEN
Inside the session.
Definition event.hpp:38
ProbeContextT< NoCaps > MinimalContext
A probe context whose broker implements nothing optional.
Definition concept.hpp:651
ProbeContextT< AllCaps > FullContext
A probe context whose broker implements everything optional.
Definition concept.hpp:654
The library: broker-neutral types (core), and the modules below.
SellableSource
Where the library gets a broker's sellable quantity.
Definition types.hpp:1092
@ INQUIRY
From a per-instrument inquiry, made only where the snapshot has no figure.
Definition types.hpp:1096
@ NONE
No per-instrument inquiry: any figure comes on the holdings rows (Kiwoom), or there is none.
Definition types.hpp:1098
BarInterval
The period one bar covers.
Identifies an instrument: its country, venue and symbol.
Definition types.hpp:78
A broker's reference to one order, used to amend or cancel it.
Definition types.hpp:2111
The state of one order, as a broker listing reported it.
Definition types.hpp:2008
What a sellable quantity covers, and how RiskGuard must treat resting sells against it.
Definition types.hpp:918
@ WHOLE_HOLDING
Every share held of the instrument, whatever venue or lot.
Definition types.hpp:924
@ DEDUCT
Subtract every resting sell from the figure.
Definition types.hpp:942
The trading days a broker reported for one market, ascending by date.
Definition calendar.hpp:44
A capability set in which the broker implements everything optional.
Definition concept.hpp:423
static constexpr bool has_batch_reference_data
Whether one reference-data request can cover several instruments.
Definition concept.hpp:461
static constexpr bool has_calendar_sessions
Whether the broker publishes intraday session hours (only Toss); the library does not expose them yet...
Definition concept.hpp:467
static constexpr bool has_client_order_id
Whether the broker accepts an idempotency key (OrderRequest::client_order_id_).
Definition concept.hpp:427
static constexpr bool has_trigger_price
Whether the adapter sends trigger prices (stop-limit orders).
Definition concept.hpp:429
static constexpr bool supports_interval(BarInterval)
Tests whether the broker serves bars of an interval (the unnamed argument).
Definition concept.hpp:486
static constexpr bool has_trade_prints
Whether the broker publishes recent trades.
Definition concept.hpp:455
static constexpr bool has_history_limit
Whether an order-history inquiry accepts a row limit (OrderHistoryQuery::limit_).
Definition concept.hpp:447
static constexpr bool working_orders_state_terminal
Whether the working-order listing can show a terminal status (filled, cancelled, ....
Definition concept.hpp:435
static constexpr SellableBasis sellable_inquiry_basis
The whole holding, with resting sells deducted (the basis the library assumes for Toss,...
Definition concept.hpp:477
static constexpr bool has_batch_prices
Whether the broker quotes several instruments in one request.
Definition concept.hpp:457
static constexpr bool has_working_orders
Whether the broker lists the orders still open to amendment. A listing shows only what the broker's A...
Definition concept.hpp:433
static constexpr bool has_price_limits
Whether the broker publishes the day's price limits.
Definition concept.hpp:453
static constexpr bool has_amendable_quantity
Whether the broker reports the quantity still amendable on an open order.
Definition concept.hpp:437
static constexpr bool has_partial_cancel
Whether the broker can cancel part of an order.
Definition concept.hpp:441
static constexpr bool has_calendar_range
Whether one calendar request covers a span of dates.
Definition concept.hpp:465
static constexpr bool has_depth
Whether the broker publishes the order book (depth).
Definition concept.hpp:451
static constexpr bool history_requires_range
Whether an order-history inquiry needs a date range (OrderHistoryQuery::from_).
Definition concept.hpp:443
static constexpr bool has_buying_power
Whether the broker reports buying power.
Definition concept.hpp:469
static constexpr bool has_account_discovery
Whether the broker lists the selectable accounts.
Definition concept.hpp:425
static constexpr bool has_calendar
Whether the broker publishes the trading calendar.
Definition concept.hpp:463
static constexpr SellableSource sellable_source
The sellable quantity comes from an inquiry.
Definition concept.hpp:475
static constexpr bool has_order_by_id
Whether the broker can look up one order by its id.
Definition concept.hpp:439
static constexpr bool has_commission_schedule
Whether the broker publishes the account's commission rates.
Definition concept.hpp:473
static constexpr bool has_reference_data
Whether the broker publishes instrument reference data.
Definition concept.hpp:459
static constexpr bool data_only
false: this broker takes orders.
Definition concept.hpp:431
static constexpr bool has_buying_power_quantity
Whether the broker can also say how many shares are affordable.
Definition concept.hpp:471
static constexpr bool has_history_symbol_filter
Whether an order-history inquiry can filter by symbol.
Definition concept.hpp:449
static constexpr bool has_history_cursor
Whether an order-history answer can carry a cursor to the next page.
Definition concept.hpp:445
One bar, delivered to on_bar.
Definition event.hpp:202
Every instrument's bar of one interval for one period end, delivered to on_bars.
Definition event.hpp:298
A request to cancel one working order.
Definition intent.hpp:471
One execution of an order the strategy placed, delivered to on_fill.
Definition event.hpp:407
A capability set in which the broker implements nothing optional.
Definition concept.hpp:360
static constexpr bool history_requires_range
Whether an order-history inquiry needs a date range (OrderHistoryQuery::from_).
Definition concept.hpp:380
static constexpr bool has_reference_data
Whether the broker publishes instrument reference data.
Definition concept.hpp:396
static constexpr bool has_buying_power
Whether the broker reports buying power.
Definition concept.hpp:406
static constexpr bool has_client_order_id
Whether the broker accepts an idempotency key (OrderRequest::client_order_id_).
Definition concept.hpp:364
static constexpr bool has_calendar_sessions
Whether the broker publishes intraday session hours (only Toss); the library does not expose them yet...
Definition concept.hpp:404
static constexpr bool has_order_by_id
Whether the broker can look up one order by its id.
Definition concept.hpp:376
static constexpr bool data_only
Whether the client is a market-data source that takes no orders (built on DataOnlyTraits).
Definition concept.hpp:368
static constexpr bool has_batch_reference_data
Whether one reference-data request can cover several instruments.
Definition concept.hpp:398
static constexpr bool has_account_discovery
Whether the broker lists the selectable accounts.
Definition concept.hpp:362
static constexpr bool has_batch_prices
Whether the broker quotes several instruments in one request.
Definition concept.hpp:394
static constexpr bool has_history_limit
Whether an order-history inquiry accepts a row limit (OrderHistoryQuery::limit_).
Definition concept.hpp:384
static constexpr bool has_buying_power_quantity
Whether the broker can also say how many shares are affordable.
Definition concept.hpp:408
static constexpr bool has_commission_schedule
Whether the broker publishes the account's commission rates.
Definition concept.hpp:410
static constexpr bool supports_interval(BarInterval)
Tests whether the broker serves bars of an interval (the unnamed argument).
Definition concept.hpp:419
static constexpr bool working_orders_state_terminal
Whether the working-order listing can show a terminal status (filled, cancelled, ....
Definition concept.hpp:372
static constexpr SellableBasis sellable_inquiry_basis
Unestablished, since there is no inquiry.
Definition concept.hpp:414
static constexpr bool has_trigger_price
Whether the adapter sends trigger prices (stop-limit orders).
Definition concept.hpp:366
static constexpr bool has_calendar_range
Whether one calendar request covers a span of dates.
Definition concept.hpp:402
static constexpr bool has_history_cursor
Whether an order-history answer can carry a cursor to the next page.
Definition concept.hpp:382
static constexpr bool has_trade_prints
Whether the broker publishes recent trades.
Definition concept.hpp:392
static constexpr bool has_amendable_quantity
Whether the broker reports the quantity still amendable on an open order.
Definition concept.hpp:374
static constexpr bool has_working_orders
Whether the broker lists the orders still open to amendment. A listing shows only what the broker's A...
Definition concept.hpp:370
static constexpr bool has_price_limits
Whether the broker publishes the day's price limits.
Definition concept.hpp:390
static constexpr bool has_calendar
Whether the broker publishes the trading calendar.
Definition concept.hpp:400
static constexpr bool has_partial_cancel
Whether the broker can cancel part of an order.
Definition concept.hpp:378
static constexpr bool has_depth
Whether the broker publishes the order book (depth).
Definition concept.hpp:388
static constexpr bool has_history_symbol_filter
Whether an order-history inquiry can filter by symbol.
Definition concept.hpp:386
static constexpr SellableSource sellable_source
No sellable-quantity figure is available.
Definition concept.hpp:412
What the account holds and which orders are still working, as a strategy sees it.
Definition portfolio.hpp:50
The broker tag of a probe context; nothing it issues reaches a market.
Definition concept.hpp:490
static constexpr std::string_view name
The broker name an order reference prints.
Definition concept.hpp:492
A quote the runner has just read, delivered to on_quote.
Definition event.hpp:390
The checks behind ATL_ASSERT_STRATEGY; instantiating it reports what is wrong with S.
Definition concept.hpp:663
static constexpr bool value
Always true; reading it compiles every handler call the runner makes with Ctx.
Definition concept.hpp:691
The position a strategy wants to hold in one instrument.
Definition intent.hpp:442