|
std::shared_ptr< Session > | getSessionByTime (std::int64_t time) const |
| Returns session that contains specified time.
|
|
std::shared_ptr< Day > | getDayByTime (std::int64_t time) const |
| Returns day that contains specified time.
|
|
std::shared_ptr< Day > | getDayById (std::int32_t dayId) const |
| Returns day for specified day identifier.
|
|
std::shared_ptr< Day > | getDayByYearMonthDay (std::int32_t yearMonthDay) const |
| Returns day for specified year, month and day numbers.
|
|
std::shared_ptr< Session > | 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.
|
|
std::shared_ptr< Session > | 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.
|
|
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.
|
|
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.
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
-
time | The time to search for |
filter | The 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 |
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
-
yearMonthDay | The 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()
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
-
time | The time to search for |
filter | the 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 |