|
dxFeed Graal CXX API v4.3.1
|
Session represents a continuous period of time during which apply same rules regarding trading activity. More...
#include <Session.hpp>
Public Types | |
| using | Ptr = std::shared_ptr<Session> |
| The alias to a type of shared pointer to the Session object. | |
| using | Unique = std::unique_ptr<Session> |
| The alias to a type of unique pointer to the Session object. | |
Public Member Functions | |
| std::shared_ptr< Day > | getDay () const |
| Returns day to which this session belongs. | |
| const SessionType & | getType () const & |
| Returns type of this session. | |
| bool | isTrading () const |
| bool | isEmpty () const |
| std::int64_t | getStartTime () const |
| std::int64_t | getEndTime () const |
| bool | containsTime (std::int64_t time) const |
| Session::Ptr | getPrevSession (const SessionFilter &filter) const |
| Returns previous session accepted by specified filter. | |
| Session::Ptr | getNextSession (const SessionFilter &filter) const |
| Returns following session accepted by specified filter. | |
| Session::Ptr | findPrevSession (const SessionFilter &filter) const |
| Returns previous session accepted by specified filter. | |
| Session::Ptr | findNextSession (const SessionFilter &filter) const |
| Returns following session accepted by specified filter. | |
| bool | operator== (const Session &other) const |
Returns true if this object is equal to other object. | |
| bool | operator== (const Session::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 | Day |
Session represents a continuous period of time during which apply same rules regarding trading activity.
For example, regular trading session is a period of time consisting of one day of business activities in a financial market, from the opening bell to the closing bell, when regular trading occurs.
Sessions can be either trading or non-trading, with different sets of rules and reasons to exist. Sessions 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 session that starts there. Each session completely fits inside a certain day. 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.
| bool Session::containsTime | ( | std::int64_t | time | ) | const |
true if specified time belongs to this session. | Session::Ptr Session::findNextSession | ( | const SessionFilter & | filter | ) | const |
Returns following session accepted by specified filter.
This method may cross the day boundary and return appropriate session from following days - up to a year in the future. If no such session was found within one year this method will return Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr}).
To find following trading session of any type use this code:
session = session->findNextSession(SessionFilter::TRADING);
To find following regular trading session use this code:
session = session->findNextSession(SessionFilter::REGULAR);
| filter | The filter to test sessions |
Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr}) | Session::Ptr Session::findPrevSession | ( | const SessionFilter & | filter | ) | const |
Returns previous session accepted by specified filter.
This method may cross the day boundary and return appropriate session from previous days - up to a year back in time. If no such session was found within one year this method will return Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr}).
To find previous trading session of any type use this code:
session = session->findPrevSession(SessionFilter::TRADING);
To find previous regular trading session use this code:
session = session->findPrevSession(SessionFilter::REGULAR);
| filter | The filter to test sessions |
Session::Ptr{nullptr} (std::shared_ptr<Session>{nullptr}) | std::shared_ptr< Day > Session::getDay | ( | ) | const |
Returns day to which this session belongs.
| std::int64_t Session::getEndTime | ( | ) | const |
| std::size_t Session::getHashCode | ( | ) | const |
| Session::Ptr Session::getNextSession | ( | const SessionFilter & | filter | ) | const |
Returns following session accepted by specified filter.
This method may cross the day boundary and return appropriate session from following days - up to a year in the future. If no such session was found within one year this method will throw JavaException "NoSuchElementException".
To find following trading session of any type use this code:
session = session->getNextSession(SessionFilter::TRADING);
To find following regular trading session use this code:
session = session->getNextSession(SessionFilter::REGULAR);
| filter | The filter to test sessions |
| JavaException | "NoSuchElementException" if no such session was found within one year. |
| Session::Ptr Session::getPrevSession | ( | const SessionFilter & | filter | ) | const |
Returns previous session accepted by specified filter.
This method may cross the day boundary and return appropriate session from previous days - up to a year back in time. If no such session was found within one year this method will throw JavaException "NoSuchElementException".
To find previous trading session of any type use this code:
session = session->getPrevSession(SessionFilter::TRADING);
To find previous regular trading session use this code:
session = session->getPrevSession(SessionFilter::REGULAR);
| filter | The filter to test sessions |
| JavaException | "NoSuchElementException" if no such session was found within one year. |
| std::int64_t Session::getStartTime | ( | ) | const |
| const SessionType & Session::getType | ( | ) | const & |
Returns type of this session.
References SessionType::AFTER_MARKET, SessionType::NO_TRADING, SessionType::PRE_MARKET, and SessionType::REGULAR.
| bool Session::isEmpty | ( | ) | const |
true if this session has zero duration. Empty sessions can be used for indices that post value once a day or for convenience. Such sessions can be of any appropriate type, trading or non-trading. | bool Session::isTrading | ( | ) | const |
true if trading activity is allowed within this session. This method is equivalent to expression getType().isTrading(). Some sessions may have zero duration - e.g. indices that post value once a day. Such sessions can be of any appropriate type, trading or non-trading.
| bool Session::operator== | ( | const Session & | 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 Session::toString | ( | ) | const |
Returns a string representation of the current object.