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

An order to place, in broker-neutral form. More...

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

Collaboration diagram for algotradelib::OrderRequest:

Public Attributes

InstrumentId instrument_
 The instrument; its venue_ is identity, and routing is this struct's venue_.
OrderSide side_ {OrderSide::BUY}
 Buy or sell.
OrderType type_ {OrderType::LIMIT}
 The price basis: limit, market, best-limit, and so on.
TimeInForce time_in_force_ {TimeInForce::DAY}
 How long the order stays valid.
OrderSession session_ {OrderSession::REGULAR}
 The trading session.
Venue venue_ {Venue::UNSPECIFIED}
 Where to route the order, if the broker offers a choice.
Decimal64 quantity_
 The quantity, in the instrument's units (shares).
std::optional< Decimal64 > price_
 The price; required when carries_caller_price(type_), refused otherwise.
std::optional< Decimal64 > trigger_price_
 The trigger price; required for STOP_LIMIT, refused otherwise.
std::optional< std::string > client_order_id_
 An idempotency key, if the broker offers one; never generated by the library.
bool confirm_high_value_ {false}
 Confirms a high-value order, where the broker asks for that confirmation.

Detailed Description

An order to place, in broker-neutral form.

price_ must be set exactly when carries_caller_price(type_), and trigger_price_ exactly for STOP_LIMIT. An UNKNOWN type, time in force or session, or a combination the broker does not offer at the requested venue, is refused before any I/O.

Definition at line 1925 of file types.hpp.

Member Data Documentation

◆ client_order_id_

std::optional<std::string> algotradelib::OrderRequest::client_order_id_

An idempotency key, if the broker offers one; never generated by the library.

Toss honours one for ten minutes. KIS has none for individual customers and refuses a request that carries one, before any I/O.

Definition at line 1966 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place(), algotradelib::kis::unsupported_client_order_id(), and algotradelib::kiwoom::unsupported_client_order_id().

◆ confirm_high_value_

bool algotradelib::OrderRequest::confirm_high_value_ {false}

Confirms a high-value order, where the broker asks for that confirmation.

Definition at line 1968 of file types.hpp.

◆ instrument_

InstrumentId algotradelib::OrderRequest::instrument_

The instrument; its venue_ is identity, and routing is this struct's venue_.

Definition at line 1927 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ price_

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

The price; required when carries_caller_price(type_), refused otherwise.

Definition at line 1952 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ quantity_

Decimal64 algotradelib::OrderRequest::quantity_

The quantity, in the instrument's units (shares).

Definition at line 1950 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ session_

OrderSession algotradelib::OrderRequest::session_ {OrderSession::REGULAR}

The trading session.

Definition at line 1935 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ side_

OrderSide algotradelib::OrderRequest::side_ {OrderSide::BUY}

Buy or sell.

Definition at line 1929 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ time_in_force_

TimeInForce algotradelib::OrderRequest::time_in_force_ {TimeInForce::DAY}

How long the order stays valid.

Definition at line 1933 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ trigger_price_

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

The trigger price; required for STOP_LIMIT, refused otherwise.

A broker whose BrokerCaps::has_trigger_price is false never receives one: BrokerSession refuses the request first.

Definition at line 1959 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ type_

OrderType algotradelib::OrderRequest::type_ {OrderType::LIMIT}

The price basis: limit, market, best-limit, and so on.

Definition at line 1931 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().

◆ venue_

Venue algotradelib::OrderRequest::venue_ {Venue::UNSPECIFIED}

Where to route the order, if the broker offers a choice.

Set routing here, not in instrument_.venue_ (an adapter refuses an identity venue other than the one it reports). UNSPECIFIED takes the broker's default:

  • KIS routes UNSPECIFIED to KRX; COMBINED is sent as SOR on a real account, and on a demo account COMBINED and NXT are refused before any request (venue_unavailable);
  • Kiwoom requires a venue and refuses UNSPECIFIED before any request;
  • Toss offers no choice and refuses any venue but UNSPECIFIED.

A live runner sets it from live::SessionExecutor::default_route.

Definition at line 1948 of file types.hpp.

Referenced by algotradelib::live::SessionExecutor< Session >::place().


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