algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::OrderShape Struct Reference

An order's type, price, trigger, time in force and session, as an amendment states them. More...

#include <algotradelib/src/core/types.hpp>

Public Member Functions

 OrderShape ()=default
 Constructs a limit shape with nothing else stated.
 OrderShape (OrderType type, std::optional< Decimal64 > price, std::optional< TimeInForce > time_in_force=std::nullopt, std::optional< OrderSession > session=std::nullopt, std::optional< Decimal64 > trigger_price=std::nullopt)
 Constructs a shape, stating only what the caller means to set.

Public Attributes

OrderType type_ {OrderType::LIMIT}
 The price basis.
std::optional< Decimal64 > price_
 The price, for a basis that takes one.
std::optional< Decimal64 > trigger_price_
 The trigger price, for STOP_LIMIT.
std::optional< TimeInForce > time_in_force_
 The time in force; unset means "keep the resting order's".
std::optional< OrderSession > session_
 The session; unset means "keep the resting order's".

Detailed Description

An order's type, price, trigger, time in force and session, as an amendment states them.

In an amendment, an unset time in force or session keeps the order's own. An unset trigger keeps the resting trigger only when both the new and the resting type are STOP_LIMIT; turning a stop into a plain LIMIT drops its trigger. To change only the price, use reprice.

Definition at line 2179 of file types.hpp.

Constructor & Destructor Documentation

◆ OrderShape()

algotradelib::OrderShape::OrderShape ( OrderType type,
std::optional< Decimal64 > price,
std::optional< TimeInForce > time_in_force = std::nullopt,
std::optional< OrderSession > session = std::nullopt,
std::optional< Decimal64 > trigger_price = std::nullopt )
inline

Constructs a shape, stating only what the caller means to set.

Parameters
typeThe price basis.
priceThe price, for a basis that takes one.
time_in_forceThe time in force, or unset to keep the resting order's.
sessionThe session, or unset to keep the resting order's.
trigger_priceThe trigger; unset keeps a resting stop's trigger only if type is also STOP_LIMIT.

Definition at line 2191 of file types.hpp.

Member Data Documentation

◆ price_

std::optional<Decimal64> algotradelib::OrderShape::price_

The price, for a basis that takes one.

Definition at line 2207 of file types.hpp.

Referenced by algotradelib::cancel_all(), algotradelib::cancel_quantity(), OrderShape(), and algotradelib::resting_shape().

◆ session_

std::optional<OrderSession> algotradelib::OrderShape::session_

The session; unset means "keep the resting order's".

A set value is a deliberate change: made where the broker can make it, refused where it cannot (Toss cannot move an order between sessions).

Definition at line 2230 of file types.hpp.

Referenced by algotradelib::cancel_all(), algotradelib::cancel_quantity(), OrderShape(), and algotradelib::resting_shape().

◆ time_in_force_

std::optional<TimeInForce> algotradelib::OrderShape::time_in_force_

The time in force; unset means "keep the resting order's".

A set value is a deliberate change: made where the broker can make it, refused where it cannot (Toss cannot change it on a modify).

Definition at line 2223 of file types.hpp.

Referenced by algotradelib::cancel_all(), algotradelib::cancel_quantity(), OrderShape(), and algotradelib::resting_shape().

◆ trigger_price_

std::optional<Decimal64> algotradelib::OrderShape::trigger_price_

The trigger price, for STOP_LIMIT.

On an amendment, unset keeps the resting stop's trigger, but only when both the new and the resting shape are STOP_LIMIT (see amended_trigger_price); changing into a stop needs a trigger stated. A trigger set on a type that takes none is refused. On an OrderRequest, a stop-limit without one is refused.

Definition at line 2216 of file types.hpp.

Referenced by algotradelib::amended_trigger_price(), algotradelib::cancel_all(), algotradelib::cancel_quantity(), OrderShape(), and algotradelib::resting_shape().

◆ type_


The documentation for this struct was generated from the following file: