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

The Kiwoom Securities REST API client. More...

Classes

struct  Broker
 The Kiwoom broker tag: order references are typed by it, so a Kiwoom reference works with both Kiwoom clients and with no other broker. More...
struct  KiwoomAccount
 The Kiwoom account selector, which is empty: no Kiwoom endpoint takes an account number, since the app key determines the account (ka00001 reports which). More...
struct  KiwoomAccountInfo
 One account Kiwoom's ka00001 reports for the bound credential. More...
struct  KiwoomAmendment
 An amendment or cancellation of a Kiwoom order. More...
class  KiwoomAuth
 Obtains and caches a Kiwoom access token with blocking requests; thread-safe. More...
class  KiwoomBlockingClient
 A blocking Kiwoom client: each call runs a KiwoomClient request on a private event loop and returns its result. Not thread-safe. Order references work with either client. More...
class  KiwoomClient
 The asynchronous Kiwoom REST client: market data, account inquiries and orders for domestic stocks. More...
struct  KiwoomConfig
 Kiwoom credentials (app key and secret key), demo or real account, the market-data tape, and the holdings settings an account must state before trading. More...
struct  KiwoomDeposit
 Kiwoom's deposit detail (kt00001), as reported; buying_power reads spendable_ from it, and the rest is reachable through session.client(). More...
struct  KiwoomHistoryQuery
 A Kiwoom order-history query: one date (kt00007 takes no range, so a multi-day query is refused). More...
struct  KiwoomMarginTier
 One margin tier of Kiwoom's kt00010 answer: what may be ordered at that 증거금률. More...
struct  KiwoomOpenOrder
 One Kiwoom order that is still open to modification or cancellation. More...
struct  KiwoomOpenOrderPage
 One page of Kiwoom orders that remain modifiable or cancellable. More...
struct  KiwoomOrderableAmount
 What may be ordered of one instrument, per margin tier (kt00010), reachable through session.client(). More...
struct  KiwoomOrderAck
 Kiwoom's acknowledgement of an accepted order, amendment or cancellation. More...
struct  KiwoomOrderRef
 A Kiwoom order's address: order number and symbol, both of which amendments and cancellations require. More...
struct  KiwoomOrderShapeRow
 One row of Kiwoom's order-type table: the numeric request code, the Korean names its listings report, and the normalized shape. More...
struct  KiwoomRest
 A Kiwoom REST access token (au10001's token) and its expiry (expires_dt). More...

Typedefs

using KiwoomHttpClient = network::HttpClient
 The blocking HTTP client KiwoomAuth uses.

Enumerations

enum class  MarketTape { CONSOLIDATED , KRX , NXT }
 Which venue's prices Kiwoom market-data requests read (see KiwoomConfig::market_tape_). More...
enum class  KiwoomPositionScope { UNSPECIFIED , VALUATION_ONLY }
 What the venue named on a Kiwoom holdings request (kt00018's dmst_stex_tp) means for the positions it lists; Kiwoom does not document it, so you assert it (see KiwoomConfig::holdings_position_scope_). More...
enum class  KiwoomSellableScope { UNSPECIFIED , WHOLE_HOLDING }
 What a Kiwoom holdings row's tradable quantity (trde_able_qty) covers; undocumented, so you assert it (see KiwoomConfig::holdings_sellable_scope_). More...
enum class  KiwoomRateLimitLayer { NONE , ENDPOINT , TOTAL , GROUP }
 Which of Kiwoom's three rate limits a refusal reports (per API, account-wide, or per API group); backing off the wrong one does not help. More...
enum class  KiwoomOrderOperation { UNCLASSIFIED , PLACE , AMEND , CANCEL }
 Which order instruction a reply answers. More...

Functions

Date today_in_seoul ()
 Returns today's date in Korea (UTC+9), the date Kiwoom requests are made in.
std::optional< BrokerError > unestablished_holdings_scope ()
 Makes the error that refuses a new order or an amendment while KiwoomConfig::holdings_position_scope_ is not stated.
std::optional< BrokerError > unsupported_client_order_id (const OrderRequest &order)
 Refuses an idempotency key, which Kiwoom does not offer (an order carrying client_order_id_ is refused before sending).
bool valid_trigger_value (const Decimal64 &trigger)
 Tests whether a trigger price is one Kiwoom can carry (cond_uv, mdfy_cond_uv).
std::optional< BrokerError > invalid_trigger (OrderType type, const std::optional< Decimal64 > &trigger)
 Checks that a trigger price is present exactly when the order type takes one (only STOP_LIMIT, Kiwoom's 28) and is a positive whole number of won.
std::optional< BrokerError > order_division (OrderType type, TimeInForce time_in_force, OrderSession session, std::string &division)
 Finds Kiwoom's order-type code for an order shape.
const KiwoomOrderShapeRow * shape_by_name (std::string_view name) noexcept
 Looks up an order shape by the Korean name a response gives (either listing's spelling).
const KiwoomOrderShapeRow * shape_by_code (std::string_view code) noexcept
 Looks up an order shape by Kiwoom's numeric trde_tp code.
const char * exchange_code (Venue venue) noexcept
 Returns Kiwoom's dmst_stex_tp value for a venue.
constexpr Venue kiwoom_effective_route (Venue asked) noexcept
 Returns the venue a Kiwoom order reaches: the one it names (Kiwoom requires one, so an order naming none is refused before sending).
Venue normalized_venue (std::string_view code) noexcept
 Converts a venue Kiwoom names on a response (stex_tp, dmst_stex_tp).
Venue listed_venue (std::string_view stex_tp, std::string_view sor_yn) noexcept
 Returns the venue of a working-order row (ka10075) from its stex_tp and sor_yn.
std::optional< OrderSide > normalized_order_side (std::string_view text) noexcept
 Reads the side from Kiwoom's free-text io_tp_nm (such as +매수, 현금매도, 매수정정), by whether it contains 매수 or 매도.
OrderStatus normalized_order_status (std::string_view text) noexcept
 Reads an order status from Kiwoom's Korean word.
constexpr const char * chart_api_id (BarInterval interval) noexcept
 Returns the api-id of the chart endpoint for a bar interval.
constexpr const char * chart_rows_field (BarInterval interval) noexcept
 Returns the array field a bar interval's chart endpoint returns its rows in.
std::optional< BrokerError > unsupported_bar_interval (BarInterval interval)
 Refuses a bar interval this client requests no chart for (chart_api_id).
constexpr const char * tape_suffix (MarketTape tape) noexcept
 Returns the symbol suffix for a tape.
std::chrono::system_clock::time_point parse_compact_expiry (std::string_view text)
 Reads Kiwoom's token expiry, yyyyMMddHHmmss in Korean time.
constexpr bool kiwoom_position_scope_asserted (KiwoomPositionScope scope) noexcept
 Tests whether a holdings scope states what Kiwoom's holdings figure covers, so holdings may be read and orders checked against them.
KiwoomRateLimitLayer kiwoom_rate_limit_layer (std::string_view code) noexcept
 Classifies a Kiwoom return code as a rate-limit refusal.
ErrorCategory kiwoom_error_category (std::string_view code) noexcept
 Classifies a Kiwoom return_code.
std::optional< BrokerError > kiwoom_declared_error (const boost::json::object &document)
 Reads the failure a Kiwoom response declares in its body (Kiwoom reports business failures with HTTP 200 and a nonzero return_code).
std::string_view kiwoom_refusal_code (std::string_view message) noexcept
 Reads the code inside an order refusal's return_msg, which Kiwoom writes as [2000](CODE:text) under the generic return_code 20.
std::optional< BrokerError > kiwoom_recognized_refusal (int http_status, const boost::json::object &document, KiwoomOrderOperation operation, bool demo)
 Reads the refusal a cash-order reply states, for the replies this client recognizes as one.

Variables

constexpr std::array< KiwoomOrderShapeRow, 21 > kOrderShapes
 Kiwoom's order-type (trde_tp) table, from its API specification.

Detailed Description

The Kiwoom Securities REST API client.

Typedef Documentation

◆ KiwoomHttpClient

The blocking HTTP client KiwoomAuth uses.

Definition at line 9 of file network.hpp.

Enumeration Type Documentation

◆ KiwoomOrderOperation

Which order instruction a reply answers.

Fixed where the request is built and carried to the parser with it, never recovered from the reply. Everything that is not an order request is UNCLASSIFIED.

Enumerator
UNCLASSIFIED 

Not an order request, or one this client does not classify.

PLACE 

A placement (kt10000, kt10001).

AMEND 

An amendment (kt10002).

CANCEL 

A cancellation (kt10003).

Definition at line 138 of file errors.hpp.

◆ KiwoomPositionScope

What the venue named on a Kiwoom holdings request (kt00018's dmst_stex_tp) means for the positions it lists; Kiwoom does not document it, so you assert it (see KiwoomConfig::holdings_position_scope_).

Enumerator
UNSPECIFIED 

Not stated: every new order and amendment is refused (cancellations are not), and the session's holdings verb refuses (the client's own holdings request still answers).

VALUATION_ONLY 

Asserted: the venue only selects which venue's price values each position, and every position is listed (the more plausible reading, but unverified).

Definition at line 102 of file config.hpp.

◆ KiwoomRateLimitLayer

Which of Kiwoom's three rate limits a refusal reports (per API, account-wide, or per API group); backing off the wrong one does not help.

Enumerator
NONE 

Not a rate-limit code.

ENDPOINT 

1700: this API's own allowance.

TOTAL 

1701: the total allowance across every API.

GROUP 

1702: the allowance of the API group this endpoint belongs to.

Definition at line 17 of file errors.hpp.

◆ KiwoomSellableScope

What a Kiwoom holdings row's tradable quantity (trde_able_qty) covers; undocumented, so you assert it (see KiwoomConfig::holdings_sellable_scope_).

Enumerator
UNSPECIFIED 

Not stated: the sellable basis is unestablished, and a sell checked against it is refused.

WHOLE_HOLDING 

Asserted: it covers every share held of the instrument, on any venue.

Definition at line 138 of file config.hpp.

◆ MarketTape

Which venue's prices Kiwoom market-data requests read (see KiwoomConfig::market_tape_).

Kiwoom encodes it as a suffix on the symbol: 005930 is KRX, 005930_NX NXT, 005930_AL both combined (SOR).

Enumerator
CONSOLIDATED 

KRX and NXT combined, the SOR book (_AL).

KRX 

KRX alone (no suffix).

NXT 

NXT alone (_NX).

Definition at line 33 of file config.hpp.

Function Documentation

◆ chart_api_id()

const char * algotradelib::kiwoom::chart_api_id ( BarInterval interval)
inlineconstexprnoexcept

Returns the api-id of the chart endpoint for a bar interval.

Parameters
intervalThe interval.
Returns
The id, or null where this client requests none: 5, 15, 30 and 60 minutes, which Kiwoom serves through ka10080's tic_scope but whose row stamps are not established yet.

Definition at line 745 of file client.hpp.

Referenced by chart_api_id(), and unsupported_bar_interval().

◆ chart_rows_field()

const char * algotradelib::kiwoom::chart_rows_field ( BarInterval interval)
inlineconstexprnoexcept

Returns the array field a bar interval's chart endpoint returns its rows in.

Parameters
intervalThe interval.
Returns
The field name, or null where chart_api_id names no endpoint.

Definition at line 771 of file client.hpp.

Referenced by chart_rows_field(), and unsupported_bar_interval().

◆ exchange_code()

const char * algotradelib::kiwoom::exchange_code ( Venue venue)
inlinenoexcept

Returns Kiwoom's dmst_stex_tp value for a venue.

Parameters
venueThe venue.
Returns
The code, or an empty string where none is sent.

Definition at line 642 of file client.hpp.

Referenced by exchange_code().

◆ invalid_trigger()

std::optional< BrokerError > algotradelib::kiwoom::invalid_trigger ( OrderType type,
const std::optional< Decimal64 > & trigger )
inline

Checks that a trigger price is present exactly when the order type takes one (only STOP_LIMIT, Kiwoom's 28) and is a positive whole number of won.

Its direction relative to the limit is not checked (Kiwoom documents none).

Parameters
typeThe order type.
triggerThe trigger price.
Returns
An INVALID_ARGUMENT error, or std::nullopt.

Definition at line 241 of file client.hpp.

Referenced by invalid_trigger().

◆ kiwoom_declared_error()

std::optional< BrokerError > algotradelib::kiwoom::kiwoom_declared_error ( const boost::json::object & document)
inline

Reads the failure a Kiwoom response declares in its body (Kiwoom reports business failures with HTTP 200 and a nonzero return_code).

Parameters
documentThe response body.
Returns
The error (reached_broker_ set, classified by kiwoom_error_category, Kiwoom's code and return_msg kept), a PROTOCOL error if return_code is neither a number nor a string, or std::nullopt if it is 0 or absent.

Definition at line 97 of file errors.hpp.

Referenced by kiwoom_declared_error().

◆ kiwoom_effective_route()

Venue algotradelib::kiwoom::kiwoom_effective_route ( Venue asked)
inlineconstexprnoexcept

Returns the venue a Kiwoom order reaches: the one it names (Kiwoom requires one, so an order naming none is refused before sending).

Parameters
askedThe order's venue.
Returns
asked.

Definition at line 663 of file client.hpp.

Referenced by kiwoom_effective_route(), and algotradelib::kiwoom_route().

◆ kiwoom_error_category()

ErrorCategory algotradelib::kiwoom::kiwoom_error_category ( std::string_view code)
inlinenoexcept

Classifies a Kiwoom return_code.

  • AUTHENTICATION: 1512-1516, and any four-digit code starting with 8 (key, token, terminal, registered IP) except 8104 and 8200;
  • INVALID_ARGUMENT: 8104 (not offered on demo), 8200 (not offered to corporate customers), 1501, 1504, 1505, 1511, 1517 and 1901-1903;
  • RATE_LIMIT: 1700-1702 and 1687;
  • PROTOCOL: any other code.

The client does not discard a token Kiwoom refuses: requests may keep failing until five minutes before the token's stated expiry.

Parameters
codeThe code, as text.
Returns
The category.

Definition at line 62 of file errors.hpp.

Referenced by kiwoom_declared_error(), and kiwoom_error_category().

◆ kiwoom_position_scope_asserted()

bool algotradelib::kiwoom::kiwoom_position_scope_asserted ( KiwoomPositionScope scope)
inlineconstexprnoexcept

Tests whether a holdings scope states what Kiwoom's holdings figure covers, so holdings may be read and orders checked against them.

It is the operator's assertion, not a fact the library checked.

Parameters
scopeThe scope.
Returns
false for UNSPECIFIED; true for VALUATION_ONLY.

Definition at line 124 of file config.hpp.

Referenced by algotradelib::BrokerTraits< kiwoom::KiwoomBlockingClient >::holdings(), algotradelib::BrokerTraits< kiwoom::KiwoomClient >::holdings(), and kiwoom_position_scope_asserted().

◆ kiwoom_rate_limit_layer()

KiwoomRateLimitLayer algotradelib::kiwoom::kiwoom_rate_limit_layer ( std::string_view code)
inlinenoexcept

Classifies a Kiwoom return code as a rate-limit refusal.

Parameters
codeKiwoom's return_code, as text.
Returns
The layer, or NONE if the code is not a rate-limit refusal.

Definition at line 33 of file errors.hpp.

Referenced by kiwoom_error_category(), and kiwoom_rate_limit_layer().

◆ kiwoom_recognized_refusal()

std::optional< BrokerError > algotradelib::kiwoom::kiwoom_recognized_refusal ( int http_status,
const boost::json::object & document,
KiwoomOrderOperation operation,
bool demo )
inline

Reads the refusal a cash-order reply states, for the replies this client recognizes as one.

From the demo server: a placement answered 800033 (not enough to sell), RC4057 (the market has not opened) or RC4058 (the market has closed), and a cancellation answered RC4033 (nothing left to amend or cancel). From the real server: a placement answered 571445 (no securities balance) and a cancellation answered 506550 (no quantity left to cancel). Such a reply is INVALID_ARGUMENT with reached_broker_ set, which a runner reads as a rejection; any other reply with return_code 20 stays PROTOCOL, an unknown outcome.

Each code is recognized from the server it was seen from only: a demo code from the real server, or a real code from the demo server, is not. The reply must be HTTP 200 with return_code 20 (a JSON integer, or the string "20"), a return_msg of the shape kiwoom_refusal_code reads, and none of what an acknowledgement carries: ord_no absent or empty, and cncl_qty and mdfy_qty absent, empty or all zeros. A reply acknowledging a new order is never read as a refusal (the original order's number, echoed in base_orig_ord_no, is not an acknowledgement). A refused cancellation says only that the cancellation did nothing, not what became of the order it named.

Parameters
http_statusThe reply's HTTP status.
documentThe reply body.
operationThe instruction the reply answers.
demoWhether the request went to the demo server.
Returns
The error (broker_code_ the inner code, message_ Kiwoom's return_msg followed by the outer code and the rule that matched), or std::nullopt if the reply is not one of them.

Definition at line 204 of file errors.hpp.

Referenced by kiwoom_recognized_refusal().

◆ kiwoom_refusal_code()

std::string_view algotradelib::kiwoom::kiwoom_refusal_code ( std::string_view message)
inlinenoexcept

Reads the code inside an order refusal's return_msg, which Kiwoom writes as [2000](CODE:text) under the generic return_code 20.

The whole message must have that shape, from its first character to its last: the literal [2000](, a code of one or more of A-Z and 0-9, a colon, some text, and a closing parenthesis as the last character. A code that only appears somewhere in a message is not read.

Parameters
messageKiwoom's return_msg.
Returns
The code, a view into message, or an empty view if the message has another shape.

Definition at line 160 of file errors.hpp.

Referenced by kiwoom_recognized_refusal(), and kiwoom_refusal_code().

◆ listed_venue()

Venue algotradelib::kiwoom::listed_venue ( std::string_view stex_tp,
std::string_view sor_yn )
inlinenoexcept

Returns the venue of a working-order row (ka10075) from its stex_tp and sor_yn.

sor_yn Y means Venue::COMBINED (SOR) whatever stex_tp says; otherwise stex_tp decides. How Kiwoom lists a resting SOR order has not been observed.

Parameters
stex_tpThe row's stex_tp.
sor_ynThe row's sor_yn.
Returns
The venue.

Definition at line 693 of file client.hpp.

Referenced by listed_venue().

◆ normalized_order_side()

std::optional< OrderSide > algotradelib::kiwoom::normalized_order_side ( std::string_view text)
inlinenoexcept

Reads the side from Kiwoom's free-text io_tp_nm (such as +매수, 현금매도, 매수정정), by whether it contains 매수 or 매도.

Parameters
textThe text.
Returns
The side, or std::nullopt if neither (the listing being read then fails rather than default to BUY).

Definition at line 707 of file client.hpp.

Referenced by normalized_order_side().

◆ normalized_order_status()

OrderStatus algotradelib::kiwoom::normalized_order_status ( std::string_view text)
inlinenoexcept

Reads an order status from Kiwoom's Korean word.

Parameters
textThe word (ord_stt or acpt_tp).
Returns
PENDING for 접수 (received) and 확인 (confirmed), FILLED for 체결, CANCELED for 취소, and UNKNOWN for any other word.

Definition at line 723 of file client.hpp.

Referenced by normalized_order_status().

◆ normalized_venue()

Venue algotradelib::kiwoom::normalized_venue ( std::string_view code)
inlinenoexcept

Converts a venue Kiwoom names on a response (stex_tp, dmst_stex_tp).

Parameters
codeThe value.
Returns
The venue, or UNSPECIFIED if unrecognized.

Definition at line 670 of file client.hpp.

Referenced by listed_venue(), and normalized_venue().

◆ order_division()

std::optional< BrokerError > algotradelib::kiwoom::order_division ( OrderType type,
TimeInForce time_in_force,
OrderSession session,
std::string & division )
inline

Finds Kiwoom's order-type code for an order shape.

Parameters
typeThe order type.
time_in_forceThe execution condition.
sessionThe session.
divisionSet to the code on success.
Returns
An INVALID_ARGUMENT error (before any request) if Kiwoom has no code for the shape or the code cannot be sent, otherwise std::nullopt.

Definition at line 571 of file client.hpp.

Referenced by order_division().

◆ parse_compact_expiry()

std::chrono::system_clock::time_point algotradelib::kiwoom::parse_compact_expiry ( std::string_view text)
inline

Reads Kiwoom's token expiry, yyyyMMddHHmmss in Korean time.

Parameters
textThe text.
Returns
The instant, or the epoch if the text is not fourteen digits (out-of-range fields are not checked: they normalize into some instant).

Definition at line 65 of file config.hpp.

Referenced by algotradelib::kiwoom::KiwoomRest::from_json_impl(), and parse_compact_expiry().

◆ shape_by_code()

const KiwoomOrderShapeRow * algotradelib::kiwoom::shape_by_code ( std::string_view code)
inlinenoexcept

Looks up an order shape by Kiwoom's numeric trde_tp code.

Parameters
codeThe code.
Returns
The row, or null if the table has none.

Definition at line 628 of file client.hpp.

Referenced by shape_by_code().

◆ shape_by_name()

const KiwoomOrderShapeRow * algotradelib::kiwoom::shape_by_name ( std::string_view name)
inlinenoexcept

Looks up an order shape by the Korean name a response gives (either listing's spelling).

Parameters
nameThe name.
Returns
The row, or null if neither column has it (the caller then leaves the shape UNKNOWN).

Definition at line 611 of file client.hpp.

Referenced by shape_by_name().

◆ tape_suffix()

const char * algotradelib::kiwoom::tape_suffix ( MarketTape tape)
inlineconstexprnoexcept

Returns the symbol suffix for a tape.

Parameters
tapeThe tape.
Returns
"" for KRX, "_NX" or "_AL".

Definition at line 47 of file config.hpp.

Referenced by tape_suffix(), and algotradelib::kiwoom::KiwoomConfig::tape_symbol().

◆ today_in_seoul()

Date algotradelib::kiwoom::today_in_seoul ( )
inline

Returns today's date in Korea (UTC+9), the date Kiwoom requests are made in.

Returns
The date.

Definition at line 154 of file client.hpp.

Referenced by today_in_seoul().

◆ unestablished_holdings_scope()

std::optional< BrokerError > algotradelib::kiwoom::unestablished_holdings_scope ( )
inline

Makes the error that refuses a new order or an amendment while KiwoomConfig::holdings_position_scope_ is not stated.

Without it the library cannot establish what the account holds, so an order could be sized against an empty portfolio. An amendment is refused too, since repricing can make a resting order fill. Cancellations, including cancel_quantity(), are never refused. The client applies it to every placement and amendment, however they arrive.

Returns
An INVALID_ARGUMENT error (holdings_scope_unestablished, not sent) naming the setting.

Definition at line 183 of file client.hpp.

Referenced by unestablished_holdings_scope().

◆ unsupported_bar_interval()

std::optional< BrokerError > algotradelib::kiwoom::unsupported_bar_interval ( BarInterval interval)
inline

Refuses a bar interval this client requests no chart for (chart_api_id).

Parameters
intervalThe interval.
Returns
An INVALID_ARGUMENT error (not sent), or std::nullopt.

Definition at line 797 of file client.hpp.

Referenced by unsupported_bar_interval().

◆ unsupported_client_order_id()

std::optional< BrokerError > algotradelib::kiwoom::unsupported_client_order_id ( const OrderRequest & order)
inline

Refuses an idempotency key, which Kiwoom does not offer (an order carrying client_order_id_ is refused before sending).

Parameters
orderThe order.
Returns
An INVALID_ARGUMENT error if the order has a client order id, otherwise std::nullopt.

Definition at line 208 of file client.hpp.

Referenced by unsupported_client_order_id().

◆ valid_trigger_value()

bool algotradelib::kiwoom::valid_trigger_value ( const Decimal64 & trigger)
inline

Tests whether a trigger price is one Kiwoom can carry (cond_uv, mdfy_cond_uv).

Parameters
triggerThe trigger price.
Returns
true if it is a positive whole number of won.

Definition at line 227 of file client.hpp.

Referenced by invalid_trigger(), and valid_trigger_value().

Variable Documentation

◆ kOrderShapes

std::array<KiwoomOrderShapeRow, 21> algotradelib::kiwoom::kOrderShapes
inlineconstexpr
Initial value:
{{
{"0", "보통", "지정가", OrderType::LIMIT, TimeInForce::DAY, OrderSession::REGULAR, true},
{"3", "시장가", nullptr, OrderType::MARKET, TimeInForce::DAY, OrderSession::REGULAR, true},
{"5", "조건부지정가", nullptr, OrderType::CONDITIONAL_LIMIT, TimeInForce::DAY, OrderSession::REGULAR, true},
{"6", "최유리지정가", nullptr, OrderType::BEST_LIMIT, TimeInForce::DAY, OrderSession::REGULAR, true},
{"7", "최우선지정가", nullptr, OrderType::PRIMARY_LIMIT, TimeInForce::DAY, OrderSession::REGULAR, true},
{"10", "보통(IOC)", "지정가(IOC)", OrderType::LIMIT, TimeInForce::IMMEDIATE_OR_CANCEL, OrderSession::REGULAR, true},
{"13", "시장가(IOC)", nullptr, OrderType::MARKET, TimeInForce::IMMEDIATE_OR_CANCEL, OrderSession::REGULAR, true},
{"20", "보통(FOK)", "지정가(FOK)", OrderType::LIMIT, TimeInForce::FILL_OR_KILL, OrderSession::REGULAR, true},
{"23", "시장가(FOK)", nullptr, OrderType::MARKET, TimeInForce::FILL_OR_KILL, OrderSession::REGULAR, true},
{"26", "최유리(FOK)", nullptr, OrderType::BEST_LIMIT, TimeInForce::FILL_OR_KILL, OrderSession::REGULAR, true},
{"29", "중간가", nullptr, OrderType::MID_PRICE, TimeInForce::DAY, OrderSession::REGULAR, true},
{"31", "중간가(FOK)", nullptr, OrderType::MID_PRICE, TimeInForce::FILL_OR_KILL, OrderSession::REGULAR, true},
{"61", "장시작전시간외", nullptr, OrderType::CLOSING_PRICE, TimeInForce::DAY, OrderSession::PRE_MARKET, true},
{"81", "장마감후시간외", nullptr, OrderType::CLOSING_PRICE, TimeInForce::DAY, OrderSession::AFTER_HOURS, true},
{"40", "보통(GTP)", nullptr, OrderType::LIMIT, TimeInForce::DAY, OrderSession::GTP, true},
{"46", "최유리(GTP)", nullptr, OrderType::BEST_LIMIT, TimeInForce::DAY, OrderSession::GTP, true},
{"47", "최우선(GTP)", nullptr, OrderType::PRIMARY_LIMIT, TimeInForce::DAY, OrderSession::GTP, true},
{"28", "스톱지정가", nullptr, OrderType::STOP_LIMIT, TimeInForce::DAY, OrderSession::REGULAR, true},
{nullptr, "시간외단일가", nullptr, OrderType::LIMIT, TimeInForce::DAY, OrderSession::AFTER_HOURS_AUCTION, false},
}}
@ LIMIT
지정가: fills at the stated price or better.
Definition types.hpp:1710
@ BEST_LIMIT
최유리지정가: priced at the best quote on the opposite side.
Definition types.hpp:1716
@ PRIMARY_LIMIT
최우선지정가: priced at the best quote on the order's own side.
Definition types.hpp:1718
@ CONDITIONAL_LIMIT
조건부지정가: a limit that becomes a market order at the close.
Definition types.hpp:1714
@ MID_PRICE
중간가: priced at the midpoint of the spread.
Definition types.hpp:1720
@ STOP_LIMIT
스톱지정가: a limit released when a trigger price is reached.
Definition types.hpp:1722
@ CLOSING_PRICE
시간외종가: priced at a session's closing price.
Definition types.hpp:1724
@ MARKET
시장가: fills at whatever the book offers.
Definition types.hpp:1712
@ AFTER_HOURS
After the close, at that session's close (장후 시간외).
Definition types.hpp:1850
@ REGULAR
The continuous regular session.
Definition types.hpp:1842
@ AFTER_HOURS_AUCTION
The after-hours single-price auction (시간외 단일가).
Definition types.hpp:1852
@ PRE_MARKET
Before the open, at the previous session's close (장전 시간외).
Definition types.hpp:1848
@ GTP
NXT's GTP session.
Definition types.hpp:1856
@ FILL_OR_KILL
Fills entirely and immediately, or not at all.
Definition types.hpp:1804
@ DAY
Rests until the session ends; an unfilled remainder is cancelled then.
Definition types.hpp:1800
@ IMMEDIATE_OR_CANCEL
Fills what it can immediately and cancels the remainder.
Definition types.hpp:1802

Kiwoom's order-type (trde_tp) table, from its API specification.

시간외단일가 (after-hours single price) has no request code: it can be read, not placed. Kiwoom publishes no per-venue restriction, so a venue-specific refusal comes from Kiwoom with its own code.

Definition at line 537 of file client.hpp.

Referenced by order_division(), shape_by_code(), and shape_by_name().