![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
A blocking KIS client: each call runs a KisClient request on a private event loop and returns its result. Not thread-safe. More...
#include <algotradelib/src/brokers/kis/client.hpp>
Public Member Functions | |
| KisBlockingClient (ssl::context &context, KisConfig config, network::HttpClientOptions options={}) | |
| Constructs a client. | |
| Result< QuoteSnapshot > | quote (InstrumentId instrument) |
| Returns a quote; see KisClient::async_quote. | |
| Result< Instrument > | instrument (InstrumentId subject) |
| Returns an instrument's reference data. | |
| Result< TradingCalendar > | calendar (Date from, bool refresh=false) |
| Returns the trading calendar from a date on; see KisClient::async_calendar (cached). | |
| Result< PriceLimits > | price_limits (InstrumentId instrument) |
| Returns an instrument's price band for today. | |
| Result< std::vector< TradePrint > > | trades (InstrumentId instrument, int count) |
| Returns an instrument's recent trades. | |
| Result< DepthSnapshot > | depth (InstrumentId instrument) |
| Returns the order book (ten levels a side). | |
| Result< BarSeries > | bars (BarQuery query) |
| Returns bars; see KisClient::async_bars. | |
| Result< HoldingsSnapshot > | holdings (KisAccount account) |
| Returns the account's holdings. | |
| Result< BuyingPower > | buying_power (Currency currency, KisAccount account) |
| Returns the account's buying power, in won. | |
| Result< KisOrderAck > | place_order (KisAccount account, OrderRequest order) |
| Places a cash order; see KisClient::async_place_order. | |
| Result< KisOrderAck > | replace_order (KisAccount account, KisAmendment amendment) |
| Amends an order's price or quantity; the outcome can be unknown after an error (see KisClient::async_replace_order). | |
| Result< KisOrderAck > | cancel_order (KisAccount account, KisAmendment amendment) |
| Cancels an order; the outcome can be unknown after an error, and the order may still rest (see KisClient::async_cancel_order). | |
| Result< KisOpenOrderPage > | open_orders (KisAccount account) |
| Returns the orders that can still be amended or cancelled; see KisClient::async_open_orders (including how demo accounts are answered). | |
| Result< OrderPage > | order_history (KisAccount account, KisHistoryRange range) |
| Returns the orders placed over a date range, with their fills. | |
| const network::RateLimitStats * | rate_limit_stats () const |
| Returns the rate limiter's statistics (safe to read between calls). | |
| KisRest | token () const |
| Returns the access token; see KisClient::token. | |
| bool | adopt_token (KisRest token) |
| Uses a token issued earlier; see KisClient::adopt_token. | |
A blocking KIS client: each call runs a KisClient request on a private event loop and returns its result. Not thread-safe.
A call whose loop stops before the request completes returns a TRANSPORT error (event_loop_stopped).
Definition at line 4540 of file client.hpp.
|
inline |
Constructs a client.
| context | The TLS context; borrowed, and must outlive the client. |
| config | The credentials and environment. |
| options | HTTP options. |
Definition at line 4548 of file client.hpp.
|
inline |
Uses a token issued earlier; see KisClient::adopt_token.
| token | The token. |
Definition at line 4769 of file client.hpp.
Returns bars; see KisClient::async_bars.
| query | The query. |
Definition at line 4636 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::bars().
|
inline |
Returns the account's buying power, in won.
| currency | The currency; anything but KRW is refused before sending. |
| account | The account. |
Definition at line 4661 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::buying_power().
|
inline |
Returns the trading calendar from a date on; see KisClient::async_calendar (cached).
| from | The first date; an invalid date is refused (invalid_date) before sending. |
| refresh | true to request again even if the cache covers from. |
Definition at line 4585 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::calendar().
|
inline |
Cancels an order; the outcome can be unknown after an error, and the order may still rest (see KisClient::async_cancel_order).
| account | The account. |
| amendment | The order and quantity. |
Definition at line 4713 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::cancel_order().
|
inline |
Returns the order book (ten levels a side).
| instrument | The instrument. |
Definition at line 4624 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::depth().
|
inline |
Returns the account's holdings.
| account | The account. |
Definition at line 4648 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::holdings().
|
inline |
Returns an instrument's reference data.
| subject | The instrument. |
Definition at line 4572 of file client.hpp.
Referenced by depth(), algotradelib::BrokerTraits< kis::KisBlockingClient >::instrument(), price_limits(), quote(), and trades().
|
inline |
Returns the orders that can still be amended or cancelled; see KisClient::async_open_orders (including how demo accounts are answered).
| account | The account. |
Definition at line 4728 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::working_orders().
|
inline |
Returns the orders placed over a date range, with their fills.
| account | The account. |
| range | The dates (an invalid range, or to_ before from_, is refused before sending). |
Definition at line 4741 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::order_history().
|
inline |
Places a cash order; see KisClient::async_place_order.
Never resent. After an error of unknown outcome (see KisClient::async_place_order), read open_orders() or order_history() before placing again.
| account | The account. |
| order | The order. |
Definition at line 4681 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::place_order().
|
inline |
Returns an instrument's price band for today.
| instrument | The instrument. |
Definition at line 4597 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::price_limits().
|
inline |
Returns a quote; see KisClient::async_quote.
| instrument | The instrument. |
Definition at line 4560 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::quote().
|
inline |
Returns the rate limiter's statistics (safe to read between calls).
Definition at line 4754 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::rate_limit_stats().
|
inline |
Amends an order's price or quantity; the outcome can be unknown after an error (see KisClient::async_replace_order).
| account | The account. |
| amendment | The amendment. |
Definition at line 4697 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::replace_order().
|
inline |
Returns the access token; see KisClient::token.
Definition at line 4762 of file client.hpp.
Referenced by adopt_token().
|
inline |
Returns an instrument's recent trades.
| instrument | The instrument. |
| count | The most trades to return (zero or less: the whole window). |
Definition at line 4610 of file client.hpp.
Referenced by algotradelib::BrokerTraits< kis::KisBlockingClient >::trades().