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

The BlockingSession adapter for tossinvest::TossBlockingClient. More...

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

Inheritance diagram for algotradelib::BrokerTraits< tossinvest::TossBlockingClient >:
Collaboration diagram for algotradelib::BrokerTraits< tossinvest::TossBlockingClient >:

Public Types

using Client = tossinvest::TossBlockingClient
 The client type.
using Config = tossinvest::TossConfig
 The configuration type.
using Account = std::int64_t
 The account type: the account sequence.
using BrokerTag = tossinvest::Broker
 The broker tag.
using PlaceAck = OrderAck
 The order acknowledgement type.
using Amendment = tossinvest::TossAmendment
 The amendment type.
using HistoryQuery = tossinvest::TossOrderQuery
 The order-history query type.
using WorkingOrdersResult = OrderPage
 The working-order result type.
using AccountListItem = tossinvest::TossAccount
 The account-listing item type.

Static Public Member Functions

static constexpr Venue effective_route (Venue) noexcept
 Returns the venue a Toss order reaches: none in particular (Toss does not route by venue, and its listings carry none).
static const network::RateLimitStats * rate_limit_stats (const Client &client)
 Returns this client's pacing statistics, or null when it is unpaced.
static Result< Instrument > instrument (Client &client, InstrumentId subject)
 Returns static reference data for one instrument.
static Result< TradingCalendar > calendar (Client &client, Country country, std::optional< Date > from)
 Returns the calendar for one market.
static Result< PriceLimits > price_limits (Client &client, InstrumentId instrument)
 Returns today's price bounds.
static Result< std::vector< TradePrint > > trades (Client &client, InstrumentId instrument, int count)
 Returns recent executions.
static Result< std::vector< QuoteSnapshot > > prices (Client &client, std::vector< InstrumentId > instruments)
 Returns a quote for every instrument in one request.
static Result< DepthSnapshot > depth (Client &client, InstrumentId instrument)
 Returns the order book.
static Result< BarSeries > bars (Client &client, BarQuery query)
 Returns bars, paging inside the client.
static Result< QuoteSnapshot > quote (Client &client, InstrumentId instrument)
 Returns a quote.
static Result< std::vector< AccountListItem > > accounts (Client &client)
 Returns the broker's own account listing.
static Result< HoldingsSnapshot > holdings (Client &client, const Account &account)
 Returns holdings for the bound account.
static Result< BuyingPower > buying_power (Client &client, const Account &account, Currency currency)
 Returns what the bound account may spend in currency.
static Result< Decimal64 > sellable_quantity (Client &client, const Account &account, InstrumentId instrument)
 Returns how much of instrument the bound account may sell.
static Result< CommissionSchedule > commissions (Client &client, const Account &account)
 Returns the commission rates in force for the bound account.
static Result< PlaceAck > place_order (Client &client, const Account &account, OrderRequest order)
 Submits an order for the bound account.
static Result< PlaceAck > replace_order (Client &client, const Account &account, Amendment amendment)
 Modifies an order for the bound account.
static Result< PlaceAck > cancel_order (Client &client, const Account &account, Amendment amendment)
 Cancels an order for the bound account, transmitting the identifier only.
static Result< WorkingOrdersResult > working_orders (Client &client, const Account &account)
 Returns the OPEN listing for the bound account.
static Result< OrderPage > order_history (Client &client, const Account &account, HistoryQuery query)
 Returns the CLOSED listing for the bound account.
static Result< OrderSnapshot > order_by_id (Client &client, const Account &account, std::string order_id)
 Returns one order by id for the bound account; see TossClient::async_order for which orders can be read.

Static Public Attributes

static constexpr std::string_view name = tossinvest::Broker::name
 The broker's name.
static constexpr bool blocking = true
 true: requests return their result directly.

Detailed Description

The BlockingSession adapter for tossinvest::TossBlockingClient.

Definition at line 749 of file traits.hpp.

Member Typedef Documentation

◆ Account

The account type: the account sequence.

Definition at line 768 of file traits.hpp.

◆ AccountListItem

The account-listing item type.

Definition at line 786 of file traits.hpp.

◆ Amendment

The amendment type.

Definition at line 777 of file traits.hpp.

◆ BrokerTag

The broker tag.

Definition at line 771 of file traits.hpp.

◆ Client

The client type.

Definition at line 762 of file traits.hpp.

◆ Config

The configuration type.

Definition at line 765 of file traits.hpp.

◆ HistoryQuery

The order-history query type.

Definition at line 780 of file traits.hpp.

◆ PlaceAck

The order acknowledgement type.

Definition at line 774 of file traits.hpp.

◆ WorkingOrdersResult

The working-order result type.

Definition at line 783 of file traits.hpp.

Member Function Documentation

◆ accounts()

Result< std::vector< AccountListItem > > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::accounts ( Client & client)
inlinestatic

Returns the broker's own account listing.

Parameters
clientThe client.
Returns
The result, or an error.

Definition at line 897 of file traits.hpp.

◆ bars()

Returns bars, paging inside the client.

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

Definition at line 878 of file traits.hpp.

◆ buying_power()

Result< BuyingPower > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::buying_power ( Client & client,
const Account & account,
Currency currency )
inlinestatic

Returns what the bound account may spend in currency.

Parameters
clientThe client.
accountThe bound account.
currencyThe currency.
Returns
The result, or an error.

Definition at line 918 of file traits.hpp.

◆ calendar()

Result< TradingCalendar > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::calendar ( Client & client,
Country country,
std::optional< Date > from )
inlinestatic

Returns the calendar for one market.

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

Definition at line 820 of file traits.hpp.

◆ cancel_order()

Result< PlaceAck > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::cancel_order ( Client & client,
const Account & account,
Amendment amendment )
inlinestatic

Cancels an order for the bound account, transmitting the identifier only.

Parameters
clientThe client.
accountThe bound account.
amendmentThe amendment.
Returns
The result, or an error.

Definition at line 984 of file traits.hpp.

◆ commissions()

Result< CommissionSchedule > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::commissions ( Client & client,
const Account & account )
inlinestatic

Returns the commission rates in force for the bound account.

Parameters
clientThe client.
accountThe bound account.
Returns
The result, or an error.

Definition at line 947 of file traits.hpp.

◆ depth()

Returns the order book.

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

Definition at line 868 of file traits.hpp.

◆ effective_route()

constexpr Venue algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::effective_route ( Venue )
inlinestaticconstexprnoexcept

Returns the venue a Toss order reaches: none in particular (Toss does not route by venue, and its listings carry none).

The venue asked for is ignored.

Returns
Venue::UNSPECIFIED.

Definition at line 759 of file traits.hpp.

◆ holdings()

Result< HoldingsSnapshot > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::holdings ( Client & client,
const Account & account )
inlinestatic

Returns holdings for the bound account.

Parameters
clientThe client.
accountThe bound account.
Returns
The result, or an error.

Definition at line 907 of file traits.hpp.

◆ instrument()

Result< Instrument > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::instrument ( Client & client,
InstrumentId subject )
inlinestatic

Returns static reference data for one instrument.

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

Definition at line 809 of file traits.hpp.

Referenced by depth(), price_limits(), quote(), sellable_quantity(), and trades().

◆ order_by_id()

Result< OrderSnapshot > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::order_by_id ( Client & client,
const Account & account,
std::string order_id )
inlinestatic

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

Parameters
clientThe client.
accountThe bound account.
order_idToss's order id.
Returns
The result, or an error.

Definition at line 1026 of file traits.hpp.

◆ order_history()

Result< OrderPage > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::order_history ( Client & client,
const Account & account,
HistoryQuery query )
inlinestatic

Returns the CLOSED listing for the bound account.

Parameters
clientThe client.
accountThe bound account.
queryThe query.
Returns
The result, or an error.

Definition at line 1009 of file traits.hpp.

◆ place_order()

Result< PlaceAck > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::place_order ( Client & client,
const Account & account,
OrderRequest order )
inlinestatic

Submits an order for the bound account.

Parameters
clientThe client.
accountThe bound account.
orderThe order.
Returns
The result, or an error.

Definition at line 958 of file traits.hpp.

◆ price_limits()

Result< PriceLimits > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::price_limits ( Client & client,
InstrumentId instrument )
inlinestatic

Returns today's price bounds.

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

Definition at line 830 of file traits.hpp.

◆ prices()

Result< std::vector< QuoteSnapshot > > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::prices ( Client & client,
std::vector< InstrumentId > instruments )
inlinestatic

Returns a quote for every instrument in one request.

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

Definition at line 855 of file traits.hpp.

◆ quote()

Returns a quote.

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

Definition at line 888 of file traits.hpp.

◆ rate_limit_stats()

const network::RateLimitStats * algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::rate_limit_stats ( const Client & client)
inlinestatic

Returns this client's pacing statistics, or null when it is unpaced.

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

Definition at line 799 of file traits.hpp.

◆ replace_order()

Result< PlaceAck > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::replace_order ( Client & client,
const Account & account,
Amendment amendment )
inlinestatic

Modifies an order for the bound account.

Parameters
clientThe client.
accountThe bound account.
amendmentThe amendment.
Returns
The result, or an error.

Definition at line 969 of file traits.hpp.

◆ sellable_quantity()

Result< Decimal64 > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::sellable_quantity ( Client & client,
const Account & account,
InstrumentId instrument )
inlinestatic

Returns how much of instrument the bound account may sell.

Parameters
clientThe client.
accountThe bound account.
instrumentThe instrument.
Returns
The result, or an error.

Definition at line 933 of file traits.hpp.

◆ trades()

Result< std::vector< TradePrint > > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::trades ( Client & client,
InstrumentId instrument,
int count )
inlinestatic

Returns recent executions.

Parameters
clientThe client.
instrumentThe instrument.
countThe most trades to return, clamped to 1-50.
Returns
The result, or an error.

Definition at line 841 of file traits.hpp.

◆ working_orders()

Result< WorkingOrdersResult > algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::working_orders ( Client & client,
const Account & account )
inlinestatic

Returns the OPEN listing for the bound account.

Parameters
clientThe client.
accountThe bound account.
Returns
The result, or an error.

Definition at line 998 of file traits.hpp.

Member Data Documentation

◆ blocking

bool algotradelib::BrokerTraits< tossinvest::TossBlockingClient >::blocking = true
staticconstexpr

true: requests return their result directly.

Definition at line 792 of file traits.hpp.

◆ name

The broker's name.

Definition at line 789 of file traits.hpp.


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