Price type attribute of CandleSymbol defines the price used to build the candles.
More...
#include <CandlePrice.hpp>
|
| std::string | changeAttributeForSymbol (StringParam symbol) const override |
| | Returns candle event symbol string with this candle price type set.
|
| std::string | toString () const |
| | Returns string representation of this candle price type.
|
|
|
static const CandlePrice | LAST {"last"} |
| | Last trading price.
|
|
static const CandlePrice | BID {"bid"} |
| | Quote bid price.
|
|
static const CandlePrice | ASK {"ask"} |
| | Quote ask price.
|
|
static const CandlePrice | MARK {"mark"} |
| | Market price defined as average between quote bid and ask prices.
|
| static const CandlePrice | SETTLEMENT {"s"} |
| | Official settlement price that is defined by exchange or last trading price otherwise.
|
|
static const CandlePrice | DEFAULT {"last"} |
| | The default price type is CandlePrice::LAST.
|
| static constexpr char | ATTRIBUTE_KEY [] = "price" |
| | The attribute key that is used to store the value of CandlePrice in a symbol string using methods of MarketEventSymbols class.
|
|
static const ConstantMap< std::string_view, CandlePrice > | BY_STRING {CANDLE_PRICES_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 CandlePrice > > | VALUES {CANDLE_PRICES} |
| | All elements (constant-initialized, so the initializers of global variables can use it).
|
Price type attribute of CandleSymbol defines the price used to build the candles.
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 CandlePrice::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandlePrice::toString()
◆ changeAttributeForSymbol()
| std::string CandlePrice::changeAttributeForSymbol |
( |
StringParam | symbol | ) |
const |
|
overridevirtual |
Returns candle event symbol string with this candle price type set.
- Parameters
-
| symbol | original candle event symbol. |
- Returns
- candle event symbol string with this candle price type set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
Returns the candle price type of the given candle symbol string.
The result is CandlePrice::DEFAULT if the symbol does not have a candle price type attribute.
- Parameters
-
| symbol | The candle symbol string. |
- Returns
- candle price type of the given candle symbol string.
References ATTRIBUTE_KEY.
◆ normalizeAttributeForSymbol()
| std::string CandlePrice::normalizeAttributeForSymbol |
( |
StringParam | symbol | ) |
|
|
static |
Returns candle symbol string with the normalized representation of the candle price type attribute.
- Parameters
-
| symbol | candle symbol string. |
- Returns
- candle symbol string with the normalized representation of the candle price type attribute.
References ATTRIBUTE_KEY, and DEFAULT.
◆ parse()
Parses string representation of a candle price type into an object.
Any string returned by CandlePrice::toString() can be parsed, and a case is ignored for parsing.
- Parameters
-
| s | The string representation of a candle price type. |
- Returns
- The candle price type (reference).
- Exceptions
-
◆ toString()
| std::string CandlePrice::toString |
( |
| ) |
const |
Returns string representation of this candle price type.
The string representation of a candle price type is a lower case string that corresponds to its name. For example, CandlePrice::LAST is represented as "last".
- Returns
- string representation of this candle price type.
◆ ATTRIBUTE_KEY
| char CandlePrice::ATTRIBUTE_KEY[] = "price" |
|
staticconstexpr |
◆ SETTLEMENT