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

The commission rates a broker published for an account, or a caller stated. More...

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

Classes

struct  RateSelection
 The result of rate_for: a rate, or why there is none. More...

Public Member Functions

RateSelection rate_for (Country country, const VenueKey &asserted, const Date &date) const
 Finds the rate in force for a market and venue on a date.
bool any_dated_rate_for (Country country) const
 Tests whether any rate for a market has a date bound, readable or not.
RateSelection rate_for (Country country, const Date &date) const
 Finds the venue-neutral rate in force for a market on a date.

Public Attributes

std::vector< CommissionRate > rates_
 The rate rows.
std::chrono::system_clock::time_point received_at_ {}
 When the schedule was received, on this machine's clock.
CommissionOrigin origin_ {CommissionOrigin::BROKER_PUBLISHED}
 Whether a broker published the rates or a caller stated them.
std::string tariff_
 Which tariff the rates are, in the source's own words.
std::size_t dropped_ {0}
 How many broker rows were skipped because their market code could not be stored.
std::size_t unreadable_bounds_ {0}
 How many rows have a date bound that could not be read.

Detailed Description

The commission rates a broker published for an account, or a caller stated.

An empty schedule from a broker that publishes rates is a real answer: the account has none.

Definition at line 1535 of file types.hpp.

Member Function Documentation

◆ any_dated_rate_for()

bool algotradelib::CommissionSchedule::any_dated_rate_for ( Country country) const
inline

Tests whether any rate for a market has a date bound, readable or not.

Parameters
countryThe market.
Returns
true if a rate for country has from_, until_, or an unreadable bound.

Definition at line 1649 of file types.hpp.

◆ rate_for() [1/2]

RateSelection algotradelib::CommissionSchedule::rate_for ( Country country,
const Date & date ) const
inline

Finds the venue-neutral rate in force for a market on a date.

Same as rate_for(country, VenueKey::any(), date).

Parameters
countryThe market.
dateThe trading date.
Returns
The rate, or none with bounds_unreadable_ saying whether damage is why.

Definition at line 1672 of file types.hpp.

◆ rate_for() [2/2]

RateSelection algotradelib::CommissionSchedule::rate_for ( Country country,
const VenueKey & asserted,
const Date & date ) const
inline

Finds the rate in force for a market and venue on a date.

First the rows keyed to asserted's venue are searched, then the venue-neutral ones; within each pass the first applicable row wins. If a row reached before any match has an unreadable window, the search stops and reports bounds_unreadable_. Asking with VenueKey::any() reads neutral rows only, so a schedule with only KRX and NXT rows answers nothing.

Parameters
countryThe market.
assertedThe venue the fill happened at, or VenueKey::any().
dateThe trading date.
Returns
The rate, or none with bounds_unreadable_ saying whether damage is why.

Definition at line 1592 of file types.hpp.

Referenced by algotradelib::backtest::commission_model_from(), and rate_for().

Member Data Documentation

◆ dropped_

std::size_t algotradelib::CommissionSchedule::dropped_ {0}

How many broker rows were skipped because their market code could not be stored.

Nonzero means the schedule is incomplete.

Definition at line 1556 of file types.hpp.

◆ origin_

CommissionOrigin algotradelib::CommissionSchedule::origin_ {CommissionOrigin::BROKER_PUBLISHED}

Whether a broker published the rates or a caller stated them.

Definition at line 1541 of file types.hpp.

Referenced by algotradelib::backtest::commission_model_from(), and algotradelib::backtest::CommissionPolicy::scheduled().

◆ rates_

std::vector<CommissionRate> algotradelib::CommissionSchedule::rates_

The rate rows.

Definition at line 1537 of file types.hpp.

Referenced by any_dated_rate_for(), and rate_for().

◆ received_at_

std::chrono::system_clock::time_point algotradelib::CommissionSchedule::received_at_ {}

When the schedule was received, on this machine's clock.

Definition at line 1539 of file types.hpp.

◆ tariff_

std::string algotradelib::CommissionSchedule::tariff_

Which tariff the rates are, in the source's own words.

Required for a caller-stated schedule: a backtest's cost model refuses one without it, because fee pages differ by account channel (온라인 영업점 개설 계좌, 온라인 뱅키스 계좌, 영업점매매), which no API states. A broker-published schedule carries the broker's own name.

Definition at line 1549 of file types.hpp.

Referenced by algotradelib::backtest::CommissionPolicy::scheduled().

◆ unreadable_bounds_

std::size_t algotradelib::CommissionSchedule::unreadable_bounds_ {0}

How many rows have a date bound that could not be read.

Nonzero means some rows' windows are unknown, so a lookup they could affect returns no rate (RateSelection::bounds_unreadable_). Unlike dropped_, these rows are kept.

Definition at line 1564 of file types.hpp.


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