dxFeed Graal CXX API v4.0.0
|
Day represents a continuous period of time approximately 24 hours long. More...
#include <Day.hpp>
Public Types | |
using | Ptr = std::shared_ptr<Day> |
The alias to a type of shared pointer to the Day object. | |
using | Unique = std::unique_ptr<Day> |
The alias to a type of unique pointer to the Day object. | |
Public Member Functions | |
std::shared_ptr< Schedule > | getSchedule () const |
std::int32_t | getDayId () const |
std::int32_t | getYearMonthDay () const |
Returns year, month and day numbers packed in the following way: | |
std::int32_t | getYear () const |
std::int32_t | getMonthOfYear () const |
std::int32_t | getDayOfMonth () const |
std::int32_t | getDayOfWeek () const |
bool | isHoliday () const |
bool | isShortDay () const |
bool | isTrading () const |
std::int64_t | getStartTime () const |
std::int64_t | getEndTime () const |
bool | containsTime (std::int64_t time) const |
std::int64_t | getResetTime () const |
std::vector< std::shared_ptr< Session > > | getSessions () const |
std::shared_ptr< Session > | getSessionByTime (std::int64_t time) const |
Returns session belonging to this day that contains specified time. | |
std::shared_ptr< Session > | getFirstSession (const SessionFilter &filter) const |
Returns first session belonging to this day accepted by specified filter. | |
std::shared_ptr< Session > | getLastSession (const SessionFilter &filter) const |
Returns last session belonging to this day accepted by specified filter. | |
std::shared_ptr< Session > | findFirstSession (const SessionFilter &filter) const |
Returns first session belonging to this day accepted by specified filter. | |
std::shared_ptr< Session > | findLastSession (const SessionFilter &filter) const |
Returns last session belonging to this day accepted by specified filter. | |
Day::Ptr | getPrevDay (const DayFilter &filter) const |
Returns previous day accepted by specified filter. | |
Day::Ptr | getNextDay (const DayFilter &filter) const |
Returns following day accepted by specified filter. | |
Day::Ptr | findPrevDay (const DayFilter &filter) const |
Returns previous day accepted by specified filter. | |
Day::Ptr | findNextDay (const DayFilter &filter) const |
Returns following day accepted by specified filter. | |
bool | operator== (const Day &other) const |
Returns true if this object is equal to other object. | |
bool | operator== (const Day::Ptr &other) const |
Returns true if this object is equal to other object. | |
std::size_t | getHashCode () const |
std::string | toString () const |
Returns a string representation of the current object. | |
Friends | |
struct | Schedule |
struct | Session |
Day represents a continuous period of time approximately 24 hours long.
The day is aligned to the start and the end of business activities of a certain business entity or business process. For example, the day may be aligned to a trading schedule of a particular instrument on an exchange. Thus, different days may start and end at various local times depending on the related trading schedules.
The length of the day depends on the trading schedule and other circumstances. For example, it is possible that day for Monday is longer than 24 hours because it includes part of Sunday; consequently, the day for Sunday will be shorter than 24 hours to avoid overlapping with Monday.
Days do not overlap with each other - rather they form consecutive chain of adjacent periods of time that cover entire time scale. The point on a border line is considered to belong to following day that starts there.
Each day consists of sessions that cover entire duration of the day. If day contains at least one trading session (i.e. session within which trading activity is allowed), then the day is considered trading day. Otherwise the day is considered non-trading day (e.g. weekend or holiday).
Day may contain sessions with zero duration - e.g. indices that post value once a day. Such sessions can be of any appropriate type, trading or non-trading. Day may have zero duration as well - e.g. when all time within it is transferred to other days.
bool Day::containsTime | ( | std::int64_t | time | ) | const |
true
if specified time belongs to this day. std::shared_ptr< Session > Day::findFirstSession | ( | const SessionFilter & | filter | ) | const |
Returns first session belonging to this day accepted by specified filter.
This method does not cross the day boundary. If no such session was found within this day this method will return Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr})
To find first trading session of any type use this code:
auto session = day->findFirstSession(SessionFilter::TRADING);
To find first regular trading session use this code:
auto session = day->findFirstSession(SessionFilter::REGULAR);
filter | The filter to test sessions |
std::shared_ptr< Session > Day::findLastSession | ( | const SessionFilter & | filter | ) | const |
Returns last session belonging to this day accepted by specified filter.
This method does not cross the day boundary. If no such session was found within this day this method will return Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr})
To find last trading session of any type use this code:
auto session = day->findLastSession(SessionFilter::TRADING);
To find last regular trading session use this code:
auto session = day->findLastSession(SessionFilter::REGULAR);
filter | The filter to test sessions |
Returns following day accepted by specified filter.
This method looks for appropriate day up to a year in the future. If no such day was found within one year this method will return Day::Ptr{nullptr} (std::shared_ptr<Day>{nullptr}).
filter | The filter to test days |
Returns previous day accepted by specified filter.
This method looks for appropriate day up to a year back in time. If no such day was found within one year this method will return Day::Ptr{nullptr} (std::shared_ptr<Day>{nullptr}).
filter | The filter to test days |
std::int32_t Day::getDayId | ( | ) | const |
std::int32_t Day::getDayOfMonth | ( | ) | const |
std::int32_t Day::getDayOfWeek | ( | ) | const |
std::int64_t Day::getEndTime | ( | ) | const |
std::shared_ptr< Session > Day::getFirstSession | ( | const SessionFilter & | filter | ) | const |
Returns first session belonging to this day accepted by specified filter.
This method does not cross the day boundary. If no such session was found within this day this method will throw JavaException "NoSuchElementException"
To find first trading session of any type use this code:
Session session = day->getFirstSession(SessionFilter::TRADING);
To find first regular trading session use this code:
Session session = day->getFirstSession(SessionFilter::REGULAR);
filter | The filter to test sessions |
JavaException | "NoSuchElementException" if no such session was found within this day. |
std::size_t Day::getHashCode | ( | ) | const |
std::shared_ptr< Session > Day::getLastSession | ( | const SessionFilter & | filter | ) | const |
Returns last session belonging to this day accepted by specified filter.
This method does not cross the day boundary. If no such session was found within this day this method will throw JavaException "NoSuchElementException"
To find last trading session of any type use this code:
auto session = day->getLastSession(SessionFilter::TRADING);
To find last regular trading session use this code:
auto session = day->getLastSession(SessionFilter::REGULAR);
filter | The filter to test sessions |
JavaException | "NoSuchElementException" if no such session was found within this day. |
std::int32_t Day::getMonthOfYear | ( | ) | const |
Returns following day accepted by specified filter.
This method looks for appropriate day up to a year in the future. If no such day was found within one year this method will throw JavaException "NoSuchElementException".
filter | The filter the filter to test days |
JavaException | "NoSuchElementException" if no such day was found within one year |
Returns previous day accepted by specified filter.
This method looks for appropriate day up to a year back in time. If no such day was found within one year this method will throw JavaException "NoSuchElementException".
filter | The filter the filter to test days |
JavaException | "NoSuchElementException" if no such day was found within one year |
std::int64_t Day::getResetTime | ( | ) | const |
std::shared_ptr< Schedule > Day::getSchedule | ( | ) | const |
std::shared_ptr< Session > Day::getSessionByTime | ( | std::int64_t | time | ) | const |
Returns session belonging to this day that contains specified time.
If no such session was found within this day this method will throw JavaException "NoSuchElementException"
time | The time to search for |
JavaException | "NoSuchElementException" if no such session was found within this day |
std::vector< std::shared_ptr< Session > > Day::getSessions | ( | ) | const |
std::int64_t Day::getStartTime | ( | ) | const |
std::int32_t Day::getYear | ( | ) | const |
1977
for the year 1977
. std::int32_t Day::getYearMonthDay | ( | ) | const |
Returns year, month and day numbers packed in the following way:
YearMonthDay = year * 10000 + month * 100 + day
For example, September 28, 1977 has value 19770928.
bool Day::isHoliday | ( | ) | const |
true
if this day is an exchange holiday. Usually there are no trading takes place on an exchange holiday. bool Day::isShortDay | ( | ) | const |
true
if this day is a short day. Usually trading stops earlier on a short day. bool Day::isTrading | ( | ) | const |
true
if trading activity is allowed within this day. Positive result assumes that day has at least one trading session. bool Day::operator== | ( | const Day & | other | ) | const |
Returns true
if this object is equal to other
object.
other | Another object |
true
if this object is equal to other
object
|
inline |
Returns true
if this object is equal to other
object.
other | Another object |
true
if this object is equal to other
object std::string Day::toString | ( | ) | const |
Returns a string representation of the current object.