|
dxFeed Graal CXX API v5.0.0
|
Period attribute of CandleSymbol defines an aggregation period of the candles. More...
#include <CandlePeriod.hpp>
Inheritance diagram for CandlePeriod:Public Member Functions | |
| std::int64_t | getPeriodIntervalMillis () const noexcept |
| Returns an aggregation period in milliseconds as closely as possible. | |
| std::string | changeAttributeForSymbol (const StringLike &symbol) const override |
| Returns candle event symbol string with this aggregation period set. | |
| double | getValue () const noexcept |
| Returns aggregation period value. | |
| const CandleType & | getType () const &noexcept |
| Returns aggregation period type. | |
| const std::string & | toString () const & |
| Returns string representation of this aggregation period. | |
Static Public Member Functions | |
| static CandlePeriod | parse (const StringLike &s) |
| Parses string representation of an aggregation period into an object. | |
| static CandlePeriod | valueOf (double value, const CandleType &type) noexcept |
| Returns candle period with the given value and type. | |
| static CandlePeriod | getAttributeForSymbol (const StringLike &symbol) noexcept |
| Returns candle period of the given candle symbol string. | |
| static std::string | normalizeAttributeForSymbol (const StringLike &symbol) |
| Returns candle symbol string with the normalized representation of the candle period attribute. | |
Static Public Attributes | |
| static const CandlePeriod | TICK {1, CandleType::TICK} |
| Tick aggregation where each candle represents an individual tick. | |
| static const CandlePeriod | DAY {1, CandleType::DAY} |
| Day aggregation where each candle represents a day. | |
| static const CandlePeriod | DEFAULT = TICK |
| The default period is CandlePeriod::TICK. | |
| static const std::string | ATTRIBUTE_KEY {} |
The attribute key that is used to store the value of CandlePeriod in a symbol string using methods of MarketEventSymbols class. | |
Period attribute of CandleSymbol defines an aggregation period of the candles.
Aggregation period is defined as a pair of a value and type.
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 CandlePeriod::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandlePeriod::toString() "CandlePeriod.toString()"
|
overridevirtual |
Returns candle event symbol string with this aggregation period set.
| symbol | original candle event symbol. |
Implements CandleSymbolAttribute.
References DEFAULT, and toString().
|
staticnoexcept |
Returns candle period of the given candle symbol string.
The result is CandlePeriod::DEFAULT if the symbol does not have a candle period attribute.
| symbol | candle symbol string. |
|
noexcept |
Returns an aggregation period in milliseconds as closely as possible.
Certain aggregation types like SECOND and DAY span a specific number of milliseconds. CandleType::MONTH, CandleType::OPTEXP and CandleType::YEAR are approximate. Candle period of CandleType::TICK, CandleType::VOLUME, CandleType::PRICE, CandleType::PRICE_MOMENTUM and CandleType::PRICE_RENKO is not defined and this method returns 0. The result of this method is equal to static_cast<std::int64_t>(this->getType().getPeriodIntervalMillis() * this->getValue())
|
noexcept |
Returns aggregation period type.
|
noexcept |
Returns aggregation period value.
For example, the value of 5 with the candle type of MINUTE represents 5 minute aggregation period.
|
static |
|
static |
Parses string representation of an aggregation period into an object.
Any string returned by CandlePeriod::toString() can be parsed. This method is flexible in the way candle types can be specified. See CandleType::parse() for details.
| s | The string representation of an aggregation period. |
References DAY, CandleType::DAY, CandleType::parse(), TICK, CandleType::TICK, CandleType::toString(), and valueOf().
Referenced by getAttributeForSymbol(), and normalizeAttributeForSymbol().
| const std::string & CandlePeriod::toString | ( | ) | const & |
Returns string representation of this aggregation period.
The string representation is composed of value and type string. For example, 5-minute aggregation is represented as "5m". The value of 1 is omitted in the string representation, so CandlePeriod::DAY (one day) is represented as "d". This string representation can be converted back into an object with the CandlePeriod::parse() method.
Referenced by changeAttributeForSymbol().
|
staticnoexcept |
Returns candle period with the given value and type.
| value | candle period value. |
| type | candle period type. |
References DAY, CandleType::DAY, TICK, and CandleType::TICK.
Referenced by parse().
|
static |
The attribute key that is used to store the value of CandlePeriod in a symbol string using methods of MarketEventSymbols class.
The value of this constant is an empty string because this is the main attribute that every CandleSymbol must have. The value that this key shall be set to is equal to the corresponding CandlePeriod::toString()