algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::tossinvest::TossBlockingClient Class Reference

Blocking facade that drives TossClient on a private event loop. More...

#include <algotradelib/src/brokers/tossinvest/client.hpp>

Public Member Functions

 TossBlockingClient (ssl::context &context, TossConfig config, network::HttpClientOptions options={})
 Constructs a blocking Toss Securities client.
Result< QuoteSnapshot > quote (InstrumentId instrument)
 Returns a quote for a Korean instrument (a US instrument is refused; use prices).
Result< std::vector< TossAccount > > accounts ()
 Discovers the brokerage accounts available to the current credentials.
Result< Instrument > instrument (InstrumentId subject)
 Returns static reference data for one instrument.
Result< TradingCalendar > calendar (Country country, std::optional< Date > from=std::nullopt)
 Returns the trading calendar around from for one market.
Result< PriceLimits > price_limits (InstrumentId instrument)
 Returns today's upper and lower price bound.
Result< std::vector< TradePrint > > trades (InstrumentId instrument, int count)
 Returns recent executions for one instrument.
Result< std::vector< QuoteSnapshot > > prices (std::vector< InstrumentId > instruments)
 Returns a quote for every instrument in one request.
Result< DepthSnapshot > depth (InstrumentId instrument)
 Returns the resting orders on both sides of the book.
Result< BarSeries > bars (BarQuery query)
 Returns up to count_ bars; see TossClient::async_bars.
Result< HoldingsSnapshot > holdings (std::int64_t account_sequence)
 Returns normalized positions and per-currency totals for one account.
Result< BuyingPower > buying_power (Currency currency, std::int64_t account_sequence)
 Returns what the account may spend in currency.
Result< Decimal64 > sellable_quantity (InstrumentId instrument, std::int64_t account_sequence)
 Returns how much of instrument the account may sell.
Result< CommissionSchedule > commissions (std::int64_t account_sequence)
 Returns the commission rates in force for the account.
Result< OrderAck > place_order (std::int64_t account_sequence, OrderRequest order)
 Places an order; see TossClient::async_place_order.
Result< OrderAck > replace_order (std::int64_t account_sequence, TossAmendment amendment)
 Amends an open order; the outcome can be unknown after an error. The acknowledgement carries a new id; see TossClient::async_replace_order.
Result< OrderAck > cancel_order (std::int64_t account_sequence, std::string order_id)
 Cancels an open order; the outcome can be unknown after an error. The acknowledgement carries a new id; see TossClient::async_cancel_order.
Result< OrderPage > orders (TossOrderQuery query)
 Returns one page of orders; see TossClient::async_orders for which orders are listed.
Result< OrderSnapshot > order (std::int64_t account_sequence, std::string order_id)
 Returns one order by id; see TossClient::async_order for which orders can be read.
const network::RateLimitStats * rate_limit_stats () const
 Returns the rate limiter's statistics (safe to read between calls).

Detailed Description

Blocking facade that drives TossClient on a private event loop.

Definition at line 3994 of file client.hpp.

Constructor & Destructor Documentation

◆ TossBlockingClient()

algotradelib::tossinvest::TossBlockingClient::TossBlockingClient ( ssl::context & context,
TossConfig config,
network::HttpClientOptions options = {} )
inline

Constructs a blocking Toss Securities client.

Parameters
contextThe TLS context; borrowed, and must outlive the client.
configThe credentials.
optionsHTTP options.

Definition at line 4002 of file client.hpp.

Member Function Documentation

◆ accounts()

Result< std::vector< TossAccount > > algotradelib::tossinvest::TossBlockingClient::accounts ( )
inline

Discovers the brokerage accounts available to the current credentials.

Returns
The result, or an error.

Definition at line 4027 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::accounts().

◆ bars()

Result< BarSeries > algotradelib::tossinvest::TossBlockingClient::bars ( BarQuery query)
inline

Returns up to count_ bars; see TossClient::async_bars.

Parameters
queryThe query.
Returns
The result, or an error.

Definition at line 4115 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::bars().

◆ buying_power()

Result< BuyingPower > algotradelib::tossinvest::TossBlockingClient::buying_power ( Currency currency,
std::int64_t account_sequence )
inline

Returns what the account may spend in currency.

Parameters
currencyThe currency.
account_sequenceThe account (TossAccount::sequence_).
Returns
The result, or an error.

Definition at line 4140 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::buying_power().

◆ calendar()

Result< TradingCalendar > algotradelib::tossinvest::TossBlockingClient::calendar ( Country country,
std::optional< Date > from = std::nullopt )
inline

Returns the trading calendar around from for one market.

Parameters
countryThe market.
fromThe date (empty: Toss's today).
Returns
The result, or an error.

Definition at line 4052 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::calendar().

◆ cancel_order()

Result< OrderAck > algotradelib::tossinvest::TossBlockingClient::cancel_order ( std::int64_t account_sequence,
std::string order_id )
inline

Cancels an open order; the outcome can be unknown after an error. The acknowledgement carries a new id; see TossClient::async_cancel_order.

Parameters
account_sequenceThe account (TossAccount::sequence_).
order_idToss's order id.
Returns
The result, or an error.

Definition at line 4219 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::cancel_order().

◆ commissions()

Result< CommissionSchedule > algotradelib::tossinvest::TossBlockingClient::commissions ( std::int64_t account_sequence)
inline

Returns the commission rates in force for the account.

Parameters
account_sequenceThe account (TossAccount::sequence_).
Returns
The result, or an error.

Definition at line 4169 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::commissions().

◆ depth()

Result< DepthSnapshot > algotradelib::tossinvest::TossBlockingClient::depth ( InstrumentId instrument)
inline

Returns the resting orders on both sides of the book.

Parameters
instrumentThe instrument.
Returns
The result, or an error.

Definition at line 4103 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::depth().

◆ holdings()

Result< HoldingsSnapshot > algotradelib::tossinvest::TossBlockingClient::holdings ( std::int64_t account_sequence)
inline

Returns normalized positions and per-currency totals for one account.

Parameters
account_sequenceThe account (TossAccount::sequence_).
Returns
The result, or an error.

Definition at line 4127 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::holdings().

◆ instrument()

Result< Instrument > algotradelib::tossinvest::TossBlockingClient::instrument ( InstrumentId subject)
inline

Returns static reference data for one instrument.

Parameters
subjectThe instrument.
Returns
The result, or an error.

Definition at line 4039 of file client.hpp.

Referenced by depth(), algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::instrument(), price_limits(), quote(), sellable_quantity(), and trades().

◆ order()

Result< OrderSnapshot > algotradelib::tossinvest::TossBlockingClient::order ( std::int64_t account_sequence,
std::string order_id )
inline

Returns one order by id; see TossClient::async_order for which orders can be read.

Parameters
account_sequenceThe account (TossAccount::sequence_).
order_idToss's order id.
Returns
The result, or an error.

Definition at line 4246 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::order_by_id(), and place_order().

◆ orders()

Result< OrderPage > algotradelib::tossinvest::TossBlockingClient::orders ( TossOrderQuery query)
inline

Returns one page of orders; see TossClient::async_orders for which orders are listed.

Parameters
queryThe query.
Returns
The result, or an error.

Definition at line 4233 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::order_history(), and algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::working_orders().

◆ place_order()

Result< OrderAck > algotradelib::tossinvest::TossBlockingClient::place_order ( std::int64_t account_sequence,
OrderRequest order )
inline

Places an order; see TossClient::async_place_order.

The outcome can be unknown after an error (see TossClient::async_place_order). With client_order_id_ set, sending the same order again within ten minutes is safe; without one, read orders() before placing again.

Parameters
account_sequenceThe account (TossAccount::sequence_).
orderThe order.
Returns
The acknowledgement or an error.

Definition at line 4187 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::place_order().

◆ price_limits()

Result< PriceLimits > algotradelib::tossinvest::TossBlockingClient::price_limits ( InstrumentId instrument)
inline

Returns today's upper and lower price bound.

Parameters
instrumentThe instrument.
Returns
The result, or an error.

Definition at line 4064 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::price_limits().

◆ prices()

Result< std::vector< QuoteSnapshot > > algotradelib::tossinvest::TossBlockingClient::prices ( std::vector< InstrumentId > instruments)
inline

Returns a quote for every instrument in one request.

Parameters
instrumentsThe instruments.
Returns
The result, or an error.

Definition at line 4091 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::prices().

◆ quote()

Result< QuoteSnapshot > algotradelib::tossinvest::TossBlockingClient::quote ( InstrumentId instrument)
inline

Returns a quote for a Korean instrument (a US instrument is refused; use prices).

Parameters
instrumentThe instrument.
Returns
The result, or an error.

Definition at line 4016 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::quote().

◆ rate_limit_stats()

const network::RateLimitStats * algotradelib::tossinvest::TossBlockingClient::rate_limit_stats ( ) const
inline

Returns the rate limiter's statistics (safe to read between calls).

Returns
The statistics, or null if the client has no rate-limit budget.

Definition at line 4259 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::rate_limit_stats().

◆ replace_order()

Result< OrderAck > algotradelib::tossinvest::TossBlockingClient::replace_order ( std::int64_t account_sequence,
TossAmendment amendment )
inline

Amends an open order; the outcome can be unknown after an error. The acknowledgement carries a new id; see TossClient::async_replace_order.

Parameters
account_sequenceThe account (TossAccount::sequence_).
amendmentThe amendment.
Returns
The result, or an error.

Definition at line 4203 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::replace_order().

◆ sellable_quantity()

Result< Decimal64 > algotradelib::tossinvest::TossBlockingClient::sellable_quantity ( InstrumentId instrument,
std::int64_t account_sequence )
inline

Returns how much of instrument the account may sell.

Parameters
instrumentThe instrument.
account_sequenceThe account (TossAccount::sequence_).
Returns
The result, or an error.

Definition at line 4155 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::sellable_quantity().

◆ trades()

Result< std::vector< TradePrint > > algotradelib::tossinvest::TossBlockingClient::trades ( InstrumentId instrument,
int count )
inline

Returns recent executions for one instrument.

Parameters
instrumentThe instrument.
countThe most trades to return, clamped to 1-50 (today's trades only).
Returns
The result, or an error.

Definition at line 4077 of file client.hpp.

Referenced by algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::trades().


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