Session attribute of CandleSymbol defines trading used to build the candles.
More...
#include <CandleSession.hpp>
|
| const SessionFilter & | getSessionFilter () const &noexcept |
| | Returns a session filter that corresponds to this session attribute.
|
| std::string | changeAttributeForSymbol (StringParam symbol) const override |
| | Returns candle event symbol string with this session attribute set.
|
| std::string | toString () const |
| | Returns string representation of this candle session attribute.
|
|
|
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 {SessionFilter::ANY, "false"} |
| | The default trading session is CandleSession::ANY.
|
| static constexpr char | ATTRIBUTE_KEY [] = "tho" |
| | The attribute key that is used to store the value of CandleSession in a symbol string using methods of MarketEventSymbols class.
|
|
static const ConstantMap< std::string_view, CandleSession > | BY_STRING {CANDLE_SESSIONS_BY_STRING} |
| | The elements by their string representations (constant-initialized, so it can be used in the dynamic initialization and the destruction of global variables).
|
|
static const std::span< const std::reference_wrapper< const CandleSession > > | VALUES {CANDLE_SESSIONS} |
| | All elements (constant-initialized, so the initializers of global variables can use it).
|
Session attribute of CandleSymbol defines trading 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()
◆ changeAttributeForSymbol()
| std::string CandleSession::changeAttributeForSymbol |
( |
StringParam | symbol | ) |
const |
|
overridevirtual |
Returns candle event symbol string with this session attribute set.
- Parameters
-
| symbol | original candle event symbol. |
- Returns
- candle event symbol string with this session attribute set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
Returns candle session attribute of the given candle symbol string.
The result is CandleSession::DEFAULT if the symbol does not have a candle session attribute.
- Parameters
-
| symbol | The candle symbol string. |
- Returns
- The candle session attribute of the given candle symbol string.
References ATTRIBUTE_KEY.
◆ getSessionFilter()
| const SessionFilter & CandleSession::getSessionFilter |
( |
| ) |
const & |
|
noexcept |
Returns a session filter that corresponds to this session attribute.
- Returns
- The session filter that corresponds to this session attribute.
◆ normalizeAttributeForSymbol()
| std::string CandleSession::normalizeAttributeForSymbol |
( |
StringParam | symbol | ) |
|
|
staticnoexcept |
Returns candle symbol string with the normalized representation of the candle session attribute.
- Parameters
-
| symbol | candle symbol string. |
- Returns
- The candle symbol string with the normalized representation of the candle session attribute.
References ATTRIBUTE_KEY, DEFAULT, and REGULAR.
◆ parse()
Parses string representation of the candle session attribute into an object.
Any string returned by CandleSession::toString() can be parsed, and a case is ignored for parsing.
- Parameters
-
| s | The string representation of the candle session attribute. |
- Returns
- The candle session attribute (reference).
- Exceptions
-
◆ toString()
| std::string CandleSession::toString |
( |
| ) |
const |
Returns string representation of this candle session attribute.
The string representation of the 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.
◆ ATTRIBUTE_KEY
| char CandleSession::ATTRIBUTE_KEY[] = "tho" |
|
staticconstexpr |