![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
One order a strategy asks the runner to place. More...
#include <algotradelib/src/strategy/intent.hpp>
Public Member Functions | |
| OrderIntent | with_tag (std::string tag) const |
| Returns a copy with a tag. | |
| OrderIntent | with_client_order_id (std::string key) const |
| Returns a copy with a broker idempotency key. | |
| const InstrumentId & | instrument () const noexcept |
| Returns the instrument to trade. | |
| OrderSide | side () const noexcept |
| Returns the side. | |
| OrderType | type () const noexcept |
| Returns the order type. | |
| TimeInForce | time_in_force () const noexcept |
| Returns how long the order stays valid. | |
| const SizeSpec & | size () const noexcept |
| Returns how much to trade. | |
| const std::optional< Price > & | limit () const noexcept |
| Returns the limit price. | |
| const std::optional< Price > & | trigger () const noexcept |
| Returns the trigger price. | |
| const std::string & | tag () const noexcept |
| Returns the tag. | |
| const std::optional< std::string > & | client_order_id () const noexcept |
| Returns the idempotency key. | |
Static Public Member Functions | |
| static OrderIntent | limit (InstrumentId instrument, OrderSide side, SizeSpec size, Price limit, TimeInForce time_in_force=TimeInForce::DAY) |
| Makes a limit order. | |
| static OrderIntent | stop_limit (InstrumentId instrument, OrderSide side, SizeSpec size, Price trigger, Price limit, TimeInForce time_in_force=TimeInForce::DAY) |
| Makes a stop-limit order: a limit order the broker releases when the trigger price is reached. | |
| static OrderIntent | market (InstrumentId instrument, OrderSide side, SizeSpec size, TimeInForce time_in_force=TimeInForce::DAY) |
| Makes a market order, which carries no price. | |
One order a strategy asks the runner to place.
Make one with limit, market or stop_limit; add a tag with with_tag and an idempotency key with with_client_order_id. Submit it with ctx.submit(intent).
Definition at line 253 of file intent.hpp.
|
inlinenoexcept |
Returns the idempotency key.
Definition at line 425 of file intent.hpp.
Referenced by algotradelib::strategy::reconcile(), and algotradelib::strategy::weight_target().
|
inlinenoexcept |
Returns the instrument to trade.
Definition at line 361 of file intent.hpp.
Referenced by limit(), market(), algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinenoexcept |
Returns the limit price.
Definition at line 401 of file intent.hpp.
|
inlinestatic |
Makes a limit order.
| instrument | The instrument to trade. |
| side | Buy or sell. |
| size | How much to trade; see SizeSpec. |
| limit | The limit price. |
| time_in_force | How long the order stays valid. |
Definition at line 265 of file intent.hpp.
Referenced by limit(), algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinestatic |
Makes a market order, which carries no price.
| instrument | The instrument to trade. |
| side | Buy or sell. |
| size | How much to trade; see SizeSpec. |
| time_in_force | How long the order stays valid. |
Definition at line 318 of file intent.hpp.
|
inlinenoexcept |
Returns the side.
Definition at line 369 of file intent.hpp.
Referenced by limit(), market(), algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinenoexcept |
Returns how much to trade.
Definition at line 393 of file intent.hpp.
Referenced by limit(), market(), algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinestatic |
Makes a stop-limit order: a limit order the broker releases when the trigger price is reached.
Which direction of move reaches the trigger, and how the trigger may relate to the limit, is the broker's rule and is not checked here. A backtest models the release and the fill with stated assumptions and counts them in ReportCaveats; see NextBarFillModel::decide.
| instrument | The instrument to trade. |
| side | Buy or sell. |
| size | How much to trade; see SizeSpec. |
| trigger | The price that releases the order. |
| limit | The limit price once released. |
| time_in_force | How long the order stays valid. |
Definition at line 294 of file intent.hpp.
|
inlinenoexcept |
Returns the tag.
Definition at line 417 of file intent.hpp.
Referenced by algotradelib::strategy::reconcile(), algotradelib::strategy::weight_target(), and with_tag().
|
inlinenoexcept |
Returns how long the order stays valid.
Definition at line 385 of file intent.hpp.
Referenced by limit(), market(), algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinenoexcept |
Returns the trigger price.
Definition at line 409 of file intent.hpp.
Referenced by algotradelib::strategy::reconcile(), stop_limit(), and algotradelib::strategy::weight_target().
|
inlinenoexcept |
Returns the order type.
Definition at line 377 of file intent.hpp.
|
inline |
Returns a copy with a broker idempotency key.
Set it only where Ctx::caps::has_client_order_id is true (test it with if constexpr): a runner whose broker has no idempotency key refuses the intent rather than dropping the key.
| key | The key. |
Definition at line 351 of file intent.hpp.
|
inline |
Returns a copy with a tag.
| tag | A label of your choice, carried to the order and its fills; the library does not interpret it. |
Definition at line 336 of file intent.hpp.