Period attribute of CandleSymbol defines aggregation period of the candles.
More...
#include <CandlePeriod.hpp>
|
std::int64_t | getPeriodIntervalMillis () const noexcept |
| Returns aggregation period in milliseconds as closely as possible.
|
|
std::string | changeAttributeForSymbol (const dxfcpp::StringLikeWrapper &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 CandlePeriod | parse (const dxfcpp::StringLikeWrapper &s) |
| Parses string representation of aggregation period into object.
|
|
static CandlePeriod | valueOf (double value, const CandleType &type) noexcept |
| Returns candle period with the given value and type.
|
|
static CandlePeriod | getAttributeForSymbol (const dxfcpp::StringLikeWrapper &symbol) noexcept |
| Returns candle period of the given candle symbol string.
|
|
static std::string | normalizeAttributeForSymbol (const dxfcpp::StringLikeWrapper &symbol) |
| Returns candle symbol string with the normalized representation of the candle period attribute.
|
|
Period attribute of CandleSymbol defines aggregation period of the candles.
Aggregation period is defined as pair of a value and type.
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 CandlePeriod::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandlePeriod::toString() "CandlePeriod.toString()"
◆ changeAttributeForSymbol()
std::string CandlePeriod::changeAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
const |
|
inlineoverridevirtual |
Returns candle event symbol string with this aggregation period set.
- Parameters
-
symbol | original candle event symbol. |
- Returns
- candle event symbol string with this aggregation period set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
static CandlePeriod CandlePeriod::getAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
|
|
inlinestaticnoexcept |
Returns candle period of the given candle symbol string.
The result is CandlePeriod::DEFAULT if the symbol does not have candle period attribute.
- Parameters
-
symbol | candle symbol string. |
- Returns
- candle period of the given candle symbol string
◆ getPeriodIntervalMillis()
std::int64_t CandlePeriod::getPeriodIntervalMillis |
( |
| ) |
const |
|
inlinenoexcept |
◆ getType()
const CandleType & CandlePeriod::getType |
( |
| ) |
const & |
|
inlinenoexcept |
Returns aggregation period type.
- Returns
- aggregation period type.
◆ getValue()
double CandlePeriod::getValue |
( |
| ) |
const |
|
inlinenoexcept |
Returns aggregation period value.
For example, the value of 5
with the candle type of MINUTE represents 5
minute aggregation period.
- Returns
- aggregation period value.
◆ normalizeAttributeForSymbol()
static std::string CandlePeriod::normalizeAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
|
|
inlinestatic |
Returns candle symbol string with the normalized representation of the candle period attribute.
- Parameters
-
symbol | candle symbol string. |
- Returns
- candle symbol string with the normalized representation of the the candle period attribute.
◆ parse()
static CandlePeriod CandlePeriod::parse |
( |
const dxfcpp::StringLikeWrapper & | s | ) |
|
|
inlinestatic |
◆ toString()
const std::string & CandlePeriod::toString |
( |
| ) |
const & |
|
inline |
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 object with CandlePeriod::parse() method.
- Returns
- string representation of this aggregation period.
◆ valueOf()
Returns candle period with the given value and type.
- Parameters
-
value | candle period value. |
type | candle period type. |
- Returns
- candle period with the given value and type.
References DAY, CandleType::DAY, TICK, and CandleType::TICK.
◆ ATTRIBUTE_KEY
const std::string CandlePeriod::ATTRIBUTE_KEY {} |
|
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()