algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::network::CalendarCache Class Referenceabstract

Where blocking broker clients share a market's trading calendar, across threads and processes. More...

#include <algotradelib/src/network/calendar_cache.hpp>

Inheritance diagram for algotradelib::network::CalendarCache:

Public Member Functions

virtual Result< std::optional< TradingCalendar > > load (const std::string &name)=0
 Reads the calendar stored under a name.
virtual std::optional< BrokerError > publish (const std::string &name, const TradingCalendar &calendar)=0
 Stores a calendar under a name, replacing what was stored.

Detailed Description

Where blocking broker clients share a market's trading calendar, across threads and processes.

Give one to KisBlockingClient: KIS asks that its holiday inquiry be made at most once a day, and one inquiry takes up to 20 pages. The client reuses a stored calendar received on the same day in Seoul; see KisBlockingClient::calendar.

Each function returns storage failures, rather than throwing them, as calendar_cache_error (an allocation can still throw). Stored contents that cannot be read as a calendar are no calendar, not an error. received_at_ is stored and returned as given. An implementation must allow calls from several threads at once.

Definition at line 23 of file calendar_cache.hpp.

Member Function Documentation

◆ load()

virtual Result< std::optional< TradingCalendar > > algotradelib::network::CalendarCache::load ( const std::string & name)
pure virtual

Reads the calendar stored under a name.

Parameters
nameThe name, such as kis-kr.
Returns
The calendar, nothing if none is stored or it cannot be read, or the cache's error.

Implemented in algotradelib::network::FileCalendarCache.

◆ publish()

virtual std::optional< BrokerError > algotradelib::network::CalendarCache::publish ( const std::string & name,
const TradingCalendar & calendar )
pure virtual

Stores a calendar under a name, replacing what was stored.

Parameters
nameThe name.
calendarThe calendar.
Returns
The cache's error, or nothing.

Implemented in algotradelib::network::FileCalendarCache.


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