![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
The trading days a broker reported for one market, ascending by date. More...
#include <algotradelib/src/core/calendar.hpp>
Public Member Functions | |
| std::optional< bool > | is_trading_day (const Date &date) const |
| Looks up whether the market opens on a date. | |
| std::optional< Date > | next_trading_day (const Date &date) const |
| Finds the first trading day after a date. | |
| std::optional< Date > | previous_trading_day (const Date &date) const |
| Finds the last trading day before a date. | |
| std::optional< std::pair< Date, Date > > | covered () const |
| Returns the first and last dates the calendar covers. | |
Public Attributes | |
| Country | country_ {Country::KR} |
| The market this calendar is for. | |
| std::vector< TradingDay > | days_ |
| The days the broker reported, ascending. A date outside them is uncovered, not closed. | |
| std::chrono::system_clock::time_point | received_at_ |
| When the calendar was received, on this machine's clock. | |
| std::size_t | unreadable_days_ {0} |
| How many rows from the broker had a date that could not be read. | |
The trading days a broker reported for one market, ascending by date.
A calendar covers a finite set of dates. is_trading_day tells "closed" apart from "not covered": a date the broker did not report, or one whose row could not be read, has no answer rather than a guessed one. The searches return reported days only, and do not say whether unreported dates are open.
Keep days_ ascending if you fill it yourself.
Intraday session hours are not part of this type, and the library does not expose them yet (Toss publishes them).
Definition at line 44 of file calendar.hpp.
Returns the first and last dates the calendar covers.
Definition at line 119 of file calendar.hpp.
|
inline |
Looks up whether the market opens on a date.
| date | The date to look up. |
Definition at line 69 of file calendar.hpp.
|
inline |
Finds the first trading day after a date.
| date | The date to search from; it is not itself a candidate. |
Definition at line 85 of file calendar.hpp.
|
inline |
Finds the last trading day before a date.
| date | The date to search from; it is not itself a candidate. |
Definition at line 101 of file calendar.hpp.
| Country algotradelib::TradingCalendar::country_ {Country::KR} |
| std::vector<TradingDay> algotradelib::TradingCalendar::days_ |
The days the broker reported, ascending. A date outside them is uncovered, not closed.
Definition at line 48 of file calendar.hpp.
Referenced by covered(), is_trading_day(), main(), next_trading_day(), and previous_trading_day().
| std::chrono::system_clock::time_point algotradelib::TradingCalendar::received_at_ |
When the calendar was received, on this machine's clock.
Definition at line 50 of file calendar.hpp.
Referenced by main().
| std::size_t algotradelib::TradingCalendar::unreadable_days_ {0} |
How many rows from the broker had a date that could not be read.
Each such row is dropped, and the day it described is uncovered: is_trading_day returns nothing for it.
Definition at line 60 of file calendar.hpp.