Candle price level attribute of CandleSymbol defines how candles shall be aggregated in respect to price interval.
More...
#include <CandlePriceLevel.hpp>
|
double | getValue () const noexcept |
| Returns price level value.
|
|
std::string | toString () const noexcept |
| Returns string representation of this price level.
|
|
std::string | changeAttributeForSymbol (const dxfcpp::StringLikeWrapper &symbol) const override |
| Returns candle event symbol string with this candle price level set.
|
|
|
static CandlePriceLevel | parse (const dxfcpp::StringLikeWrapper &s) |
| Parses string representation of candle price level into object.
|
|
static CandlePriceLevel | valueOf (double value) |
| Returns candle price level with the given value.
|
|
static CandlePriceLevel | getAttributeForSymbol (const dxfcpp::StringLikeWrapper &symbol) |
| Returns candle price level 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 price level attribute.
|
|
Candle price level attribute of CandleSymbol defines how candles shall be aggregated in respect to price interval.
The negative or infinite values of price interval are treated as exceptional.
-
Price interval may be equal to zero. It means every unique price creates a particular candle to aggregate all events with this price for the chosen CandlePeriod.
-
Non-zero price level creates sequence of intervals starting from 0: ...,[-pl;0),[0;pl),[pl;2*pl),...,[n*pl,n*pl+pl). Events aggregated by chosen CandlePeriod and price intervals.
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 CandlePriceLevel::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandlePriceLevel::toString()
◆ changeAttributeForSymbol()
std::string CandlePriceLevel::changeAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
const |
|
inlineoverridevirtual |
Returns candle event symbol string with this candle price level set.
- Parameters
-
symbol | original candle event symbol. |
- Returns
- candle event symbol string with this candle price level set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
static CandlePriceLevel CandlePriceLevel::getAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
|
|
inlinestatic |
Returns candle price level of the given candle symbol string.
The result is CandlePriceLevel::DEFAULT if the symbol does not have candle price level attribute.
- Parameters
-
symbol | candle symbol string. |
- Returns
- candle price level of the given candle symbol string.
◆ getValue()
double CandlePriceLevel::getValue |
( |
| ) |
const |
|
inlinenoexcept |
Returns price level value.
For example, the value of 1
represents [0;1), [1;2)
and so on intervals to build candles.
- Returns
- price level value.
◆ normalizeAttributeForSymbol()
static std::string CandlePriceLevel::normalizeAttributeForSymbol |
( |
const dxfcpp::StringLikeWrapper & | symbol | ) |
|
|
inlinestatic |
Returns candle symbol string with the normalized representation of the candle price level attribute.
- Parameters
-
symbol | candle symbol string. |
- Returns
- candle symbol string with the normalized representation of the the candle price level attribute.
◆ parse()
static CandlePriceLevel CandlePriceLevel::parse |
( |
const dxfcpp::StringLikeWrapper & | s | ) |
|
|
inlinestatic |
Parses string representation of candle price level into object.
Any string that was returned by CandlePriceLevel::toString() can be parsed and case is ignored for parsing.
- Parameters
-
s | string representation of candle price level. |
- Returns
- candle price level.
References valueOf().
◆ toString()
std::string CandlePriceLevel::toString |
( |
| ) |
const |
|
inlinenoexcept |
Returns string representation of this price level.
The string representation is composed of value. This string representation can be converted back into object with CandlePriceLevel::parse() method.
- Returns
- string representation of this price level.
◆ valueOf()
Returns candle price level with the given value.
- Parameters
-
value | candle price level value. |
- Returns
- candle price level with the given value and type.
Referenced by parse().
◆ ATTRIBUTE_KEY
const std::string CandlePriceLevel::ATTRIBUTE_KEY {"pl"} |
|
static |