dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
Schedule Struct Reference

Schedule class provides API to retrieve and explore trading schedules of different exchanges and different classes of financial instruments. More...

#include <Schedule.hpp>

Public Types

using Ptr = std::shared_ptr<Schedule>
 The alias to a type of shared pointer to the Schedule object.
 
using Unique = std::unique_ptr<Schedule>
 The alias to a type of unique pointer to the Schedule object.
 

Public Member Functions

std::shared_ptr< SessiongetSessionByTime (std::int64_t time) const
 Returns session that contains specified time.
 
std::shared_ptr< DaygetDayByTime (std::int64_t time) const
 Returns day that contains specified time.
 
std::shared_ptr< DaygetDayById (std::int32_t dayId) const
 Returns day for specified day identifier.
 
std::shared_ptr< DaygetDayByYearMonthDay (std::int32_t yearMonthDay) const
 Returns day for specified year, month and day numbers.
 
std::shared_ptr< SessiongetNearestSessionByTime (std::int64_t time, const SessionFilter &filter) const
 Returns session that is nearest to the specified time and that is accepted by specified filter.
 
std::shared_ptr< SessionfindNearestSessionByTime (std::int64_t time, const SessionFilter &filter) const
 Returns session that is nearest to the specified time and that is accepted by specified filter.
 
std::string getName () const
 Returns name of this schedule.
 
std::string getTimeZoneDisplayName () const
 Returns time zone display name in which this schedule is defined.
 
std::string getTimeZoneId () const
 Returns time zone id in which this schedule is defined.
 

Static Public Member Functions

static Schedule::Ptr getInstance (std::shared_ptr< InstrumentProfile > profile)
 Returns default schedule instance for specified instrument profile.
 
static Schedule::Ptr getInstance (const StringLikeWrapper &scheduleDefinition)
 Returns default schedule instance for specified schedule definition.
 
static Schedule::Ptr getInstance (std::shared_ptr< InstrumentProfile > profile, const StringLikeWrapper &venue)
 Returns schedule instance for specified instrument profile and trading venue.
 
static std::vector< std::string > getTradingVenues (std::shared_ptr< InstrumentProfile > profile)
 Returns trading venues for specified instrument profile.
 
static void downloadDefaults (const StringLikeWrapper &downloadConfig)
 Downloads defaults using specified download config and optionally start periodic download.
 
static void setDefaults (const std::vector< char > &data)
 Sets shared defaults that are used by individual schedule instances.
 

Friends

struct Day
 

Detailed Description

Schedule class provides API to retrieve and explore trading schedules of different exchanges and different classes of financial instruments.

Each instance of schedule covers separate trading schedule of some class of instruments, i.e. NYSE stock trading schedule or CME corn futures trading schedule. Each schedule splits entire time scale into separate days that are aligned to the specific trading hours of covered trading schedule.

Member Function Documentation

◆ downloadDefaults()

void Schedule::downloadDefaults ( const StringLikeWrapper & downloadConfig)
static

Downloads defaults using specified download config and optionally start periodic download.

The specified config can be one of the following:

  • "" - stop periodic download
  • URL - download once from specified URL and stop periodic download
  • URL,period - start periodic download from specified URL
  • "auto" - start periodic download from default location
Parameters
downloadConfigdownload config

◆ findNearestSessionByTime()

std::shared_ptr< Session > Schedule::findNearestSessionByTime ( std::int64_t time,
const SessionFilter & filter ) const

Returns session that is nearest to the specified time and that is accepted by specified filter.

This method will throw JavaException "IllegalArgumentException" if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30. If no sessions acceptable by specified filter are found within one year this method will return Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr}).

To find nearest trading session of any type use this code:

session = schedule->findNearestSessionByTime(time, SessionFilter::TRADING);

To find nearest regular trading session use this code:

session = schedule->findNearestSessionByTime(time, SessionFilter::REGULAR);
Parameters
timeThe time to search for
filterThe filter to test sessions
Returns
The session that is nearest to the specified time and that is accepted by specified filter.
Exceptions
JavaException"IllegalArgumentException" if specified time falls outside of valid date range

◆ getDayById()

std::shared_ptr< Day > Schedule::getDayById ( std::int32_t dayId) const

Returns day for specified day identifier.

This method will throw JavaException "IllegalArgumentException" if specified day identifier falls outside of valid date range from 0001-01-02 to 9999-12-30.

Parameters
dayIdThe day identifier to search for
Returns
The day for specified day identifier
Exceptions
JavaException"IllegalArgumentException" if specified day identifier falls outside of valid date range
See also
Day::getDayId()

◆ getDayByTime()

std::shared_ptr< Day > Schedule::getDayByTime ( std::int64_t time) const

Returns day that contains specified time.

This method will throw JavaException "IllegalArgumentException" if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30.

Parameters
timeThe time to search for
Returns
The day that contains specified time
Exceptions
JavaException"IllegalArgumentException" if specified time falls outside of valid date range

◆ getDayByYearMonthDay()

std::shared_ptr< Day > Schedule::getDayByYearMonthDay ( std::int32_t yearMonthDay) const

Returns day for specified year, month and day numbers.

Year, month, and day numbers shall be packed in the following way:

YearMonthDay = year * 10000 + month * 100 + day

For example, September 28, 1977 has value 19770928.

If specified day does not exist then this method returns day with the lowest valid YearMonthDay that is greater than specified one. This method will throw JavaException "IllegalArgumentException" if specified year, month and day numbers fall outside of valid date range from 0001-01-02 to 9999-12-30.

Parameters
yearMonthDayThe year, month and day numbers to search for
Returns
The day for specified year, month and day numbers
Exceptions
JavaException"IllegalArgumentException" if specified year, month and day numbers fall outside of valid date range
See also
Day::getYearMonthDay()

◆ getInstance() [1/3]

Schedule::Ptr Schedule::getInstance ( const StringLikeWrapper & scheduleDefinition)
static

Returns default schedule instance for specified schedule definition.

Parameters
scheduleDefinitionThe schedule definition of requested schedule
Returns
The default schedule instance for specified schedule definition

◆ getInstance() [2/3]

Schedule::Ptr Schedule::getInstance ( std::shared_ptr< InstrumentProfile > profile)
static

Returns default schedule instance for specified instrument profile.

Parameters
profileThe instrument profile those schedule is requested
Returns
The default schedule instance for specified instrument profile

◆ getInstance() [3/3]

Schedule::Ptr Schedule::getInstance ( std::shared_ptr< InstrumentProfile > profile,
const StringLikeWrapper & venue )
static

Returns schedule instance for specified instrument profile and trading venue.

Parameters
profileThe instrument profile those schedule is requested
venueThe trading venue those schedule is requested
Returns
The schedule instance for specified instrument profile and trading venue

◆ getName()

std::string Schedule::getName ( ) const

Returns name of this schedule.

Returns
The name of this schedule

◆ getNearestSessionByTime()

std::shared_ptr< Session > Schedule::getNearestSessionByTime ( std::int64_t time,
const SessionFilter & filter ) const

Returns session that is nearest to the specified time and that is accepted by specified filter.

This method will throw JavaException "IllegalArgumentException" if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30. If no sessions acceptable by specified filter are found within one year this method this method will throw JavaException "NoSuchElementException".

To find nearest trading session of any type use this code:

session = schedule->getNearestSessionByTime(time, SessionFilter::TRADING);

To find nearest regular trading session use this code:

session = schedule->getNearestSessionByTime(time, SessionFilter::REGULAR);
Parameters
timeThe time to search for
filterthe filter to test sessions
Returns
session that is nearest to the specified time and that is accepted by specified filter.
Exceptions
JavaException"IllegalArgumentException" if specified time falls outside of valid date range
JavaException"NoSuchElementException" if no such day was found within one year

◆ getSessionByTime()

std::shared_ptr< Session > Schedule::getSessionByTime ( std::int64_t time) const

Returns session that contains specified time.

This method will throw JavaException "IllegalArgumentException" if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30.

Parameters
timethe time to search for
Returns
session that contains specified time or Session::Ptr{nullptr} if specified time falls outside of valid date range from 0001-01-02 to 9999-12-30.
Exceptions
JavaException"IllegalArgumentException" if specified time falls outside of valid date range
JavaException"NoSuchElementException" if no such session was found within this day

◆ getTimeZoneDisplayName()

std::string Schedule::getTimeZoneDisplayName ( ) const

Returns time zone display name in which this schedule is defined.

Returns
time zone display name in which this schedule is defined

◆ getTimeZoneId()

std::string Schedule::getTimeZoneId ( ) const

Returns time zone id in which this schedule is defined.

Returns
time zone id in which this schedule is defined

◆ getTradingVenues()

std::vector< std::string > Schedule::getTradingVenues ( std::shared_ptr< InstrumentProfile > profile)
static

Returns trading venues for specified instrument profile.

Parameters
profileThe instrument profile those trading venues are requested
Returns
trading venues for specified instrument profile

◆ setDefaults()

void Schedule::setDefaults ( const std::vector< char > & data)
static

Sets shared defaults that are used by individual schedule instances.

Parameters
dataThe content of default data