Candle alignment attribute of CandleSymbol defines how candles are aligned with respect to time.
More...
#include <CandleAlignment.hpp>
|
| std::string | changeAttributeForSymbol (StringParam symbol) const override |
| | Returns candle event symbol string with this candle alignment set.
|
| std::string | toString () const |
| | Returns string representation of this candle alignment.
|
|
|
static const CandleAlignment | MIDNIGHT {"m"} |
| | Align candles at midnight.
|
|
static const CandleAlignment | SESSION {"s"} |
| | Align candles on trading sessions.
|
|
static const CandleAlignment | DEFAULT {"m"} |
| | Default alignment is CandleAlignment::MIDNIGHT.
|
| static constexpr char | ATTRIBUTE_KEY [] = "a" |
| | The attribute key that is used to store the value of CandleAlignment in a symbol string using methods of MarketEventSymbols class.
|
|
static const ConstantMap< std::string_view, CandleAlignment > | BY_STRING {CANDLE_ALIGNMENTS_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 CandleAlignment > > | VALUES |
| | All elements (constant-initialized, so the initializers of global variables can use it).
|
Candle alignment attribute of CandleSymbol defines how candles are aligned with respect to time.
Implementation details
This attribute is encoded in a symbol string with MarketEventSymbols.getAttributeStringByKey, changeAttributeStringByKey, and removeAttributeStringByKey methods. The key to use with these methods is available via CandleAlignment::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandleAlignment::toString()
◆ changeAttributeForSymbol()
| std::string CandleAlignment::changeAttributeForSymbol |
( |
StringParam | symbol | ) |
const |
|
overridevirtual |
Returns candle event symbol string with this candle alignment set.
- Parameters
-
| symbol | The original candle event symbol. |
- Returns
- candle event symbol string with this candle alignment set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
Returns candle alignment of the given candle symbol string.
The result is CandleAlignment::DEFAULT if the symbol does not have a candle alignment attribute.
- Parameters
-
| symbol | The candle symbol string. |
- Returns
- candle alignment of the given candle symbol string.
◆ normalizeAttributeForSymbol()
| std::string CandleAlignment::normalizeAttributeForSymbol |
( |
StringParam | symbol | ) |
|
|
static |
Returns candle symbol string with the normalized representation of the candle alignment attribute.
- Parameters
-
| symbol | The candle symbol string. |
- Returns
- candle symbol string with the normalized representation of the candle alignment attribute.
◆ parse()
Parses string representation of candle alignment into an object.
Any string returned by CandleAlignment::toString() can be parsed and a case is ignored for parsing.
- Parameters
-
| s | The string representation of candle alignment. |
- Returns
- The candle alignment (reference)
- Exceptions
-
◆ toString()
| std::string CandleAlignment::toString |
( |
| ) |
const |
◆ ATTRIBUTE_KEY
| char CandleAlignment::ATTRIBUTE_KEY[] = "a" |
|
staticconstexpr |