dxFeed Graal CXX API
Loading...
Searching...
No Matches
dxfcpp::CandleSession Struct Reference

Session attribute of CandleSymbol defines trading that is used to build the candles. More...

#include <CandleSession.hpp>

+ Inheritance diagram for dxfcpp::CandleSession:

Public Member Functions

const SessionFiltergetSessionFilter () const noexcept
 Returns session filter that corresponds to this session attribute.
 
std::string changeAttributeForSymbol (const std::string &symbol) const noexcept override
 Returns candle event symbol string with this session attribute set.
 
const std::string & toString () const &noexcept
 Returns string representation of this candle session attribute.
 

Static Public Member Functions

static std::optional< std::reference_wrapper< const CandleSession > > parse (const std::string &s) noexcept
 Parses string representation of candle session attribute into object.
 
static std::optional< std::reference_wrapper< const CandleSession > > getAttributeForSymbol (const std::string &symbol) noexcept
 Returns candle session attribute of the given candle symbol string.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string normalizeAttributeForSymbol (const std::string &symbol) noexcept
 Returns candle symbol string with the normalized representation of the candle session attribute.
 

Static Public Attributes

static const CandleSession ANY {SessionFilter::ANY, "false"}
 All trading sessions are used to build candles.
 
static const CandleSession REGULAR {SessionFilter::REGULAR, "true"}
 Only regular trading session data is used to build candles.
 
static const CandleSession DEFAULT = ANY
 Default trading session is CandleSession::ANY.
 
static const std::string ATTRIBUTE_KEY = "tho"
 The attribute key that is used to store the value of CandleSession in a symbol string using methods of MarketEventSymbols class.
 

Detailed Description

Session attribute of CandleSymbol defines trading that is used to build the candles.

Implementation details

This attribute is encoded in a symbol string with MarketEventSymbols.getAttributeStringByKey, changeAttributeStringByKey, and removeAttributeStringByKey methods.

CandleSession::ANY session is a default. The key to use with these methods is available via CandleSession::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandleSession::toString()

Member Function Documentation

◆ changeAttributeForSymbol()

std::string dxfcpp::CandleSession::changeAttributeForSymbol ( const std::string & symbol) const
inlineoverridevirtualnoexcept

Returns candle event symbol string with this session attribute set.

Parameters
symboloriginal candle event symbol.
Returns
candle event symbol string with this session attribute set.

Implements dxfcpp::CandleSymbolAttribute.

◆ getAttributeForSymbol()

static std::optional< std::reference_wrapper< const CandleSession > > dxfcpp::CandleSession::getAttributeForSymbol ( const std::string & symbol)
inlinestaticnoexcept

Returns candle session attribute of the given candle symbol string.

The result is CandleSession::DEFAULT if the symbol does not have candle session attribute or std::nullopt if there is no supported attribute's value.

Parameters
symbolThe candle symbol string.
Returns
candle session attribute of the given candle symbol string or std::nullopt if there is no supported attribute's value.

◆ getSessionFilter()

const SessionFilter & dxfcpp::CandleSession::getSessionFilter ( ) const
inlinenoexcept

Returns session filter that corresponds to this session attribute.

Returns
session filter that corresponds to this session attribute.

◆ normalizeAttributeForSymbol()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::CandleSession::normalizeAttributeForSymbol ( const std::string & symbol)
inlinestaticnoexcept

Returns candle symbol string with the normalized representation of the candle session attribute.

Parameters
symbolcandle symbol string.
Returns
candle symbol string with the normalized representation of the the candle session attribute.

◆ parse()

static std::optional< std::reference_wrapper< const CandleSession > > dxfcpp::CandleSession::parse ( const std::string & s)
inlinestaticnoexcept

Parses string representation of candle session attribute into object.

Any string that was returned by CandleSession::toString() can be parsed and case is ignored for parsing.

Parameters
sThe string representation of candle session attribute.
Returns
The candle session attribute (reference) or std::nullopt if there is no supported attribute's value.

◆ toString()

const std::string & dxfcpp::CandleSession::toString ( ) const &
inlinenoexcept

Returns string representation of this candle session attribute.

The string representation of candle session attribute is a lower case string that corresponds to its name. For example, CandleSession::ANY is represented as "any".

Returns
string representation of this candle session attribute.

Member Data Documentation

◆ ATTRIBUTE_KEY

const std::string dxfcpp::CandleSession::ATTRIBUTE_KEY = "tho"
static

The attribute key that is used to store the value of CandleSession in a symbol string using methods of MarketEventSymbols class.

The value of this constant is "tho", which is an abbreviation for "trading hours only". The value that this key shall be set to is equal to the corresponding CandleSession::toString()