Candle data type attribute of CandleSymbol defines which types of data shall be used for candles aggregation.
More...
#include <CandleDataType.hpp>
|
|
static const CandleDataType | SOURCE {"source"} |
| | Aggregation rules are defined per data source (e.g., an exchange).
|
|
static const CandleDataType | THO {"tho"} |
| | Selected types of data are identical to those used for CandleSession::REGULAR.
|
|
static const CandleDataType | ALL {"all"} |
| | All valid TimeAndSales or Quotes are used to build candles.
|
|
static const CandleDataType | RTH {"rth"} |
| | All valid non-ETH TimeAndSales or Quotes from a regular trading hours are used to build candles.
|
|
static const CandleDataType | ETH {"eth"} |
| | All valid ETH TimeAndSales or Quotes from an extended trading hours are used to build candles.
|
|
static const CandleDataType | UNDEFINED {""} |
| | Data type is selected by a chart server.
|
|
static const CandleDataType | DEFAULT {""} |
| | Default data type is CandleDataType::UNDEFINED.
|
| static constexpr char | ATTRIBUTE_KEY [] = "dt" |
| | The attribute key that is used to store the value of CandleDataType in a symbol string using methods of MarketEventSymbols class.
|
Candle data type attribute of CandleSymbol defines which types of data shall be used for candles aggregation.
This attribute is designed as an open-ended replacement for CandleSession attribute: besides the constants of this class, any string is a valid data 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 CandleDataType::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandleDataType::toString()
◆ changeAttributeForSymbol()
| std::string CandleDataType::changeAttributeForSymbol |
( |
StringParam | symbol | ) |
const |
|
overridevirtual |
Returns candle event symbol string with this data type attribute set.
CandleDataType::DEFAULT removes the attribute.
- Parameters
-
| symbol | original candle event symbol. |
- Returns
- candle event symbol string with this data type attribute set.
Implements CandleSymbolAttribute.
◆ getAttributeForSymbol()
Returns candle data type attribute of the given candle symbol string.
The result is CandleDataType::DEFAULT if the symbol does not have the candle data type attribute.
- Parameters
-
| symbol | candle symbol string. |
- Returns
- candle data type attribute of the given candle symbol string.
◆ getValue()
| std::string CandleDataType::getValue |
( |
| ) |
const |
Returns string representation of this data type attribute.
Typically, the string representation of candle data type attribute is a lower case string that corresponds to its name. For example, CandleDataType::THO is represented as "tho".
- Returns
- string representation of this candle data type attribute.
◆ normalizeAttributeForSymbol()
| std::string CandleDataType::normalizeAttributeForSymbol |
( |
StringParam | symbol | ) |
|
|
static |
Returns candle symbol string with the normalized representation of the candle data type attribute.
- Parameters
-
| symbol | candle symbol string. |
- Returns
- candle symbol string with the normalized representation of the candle data type attribute.
◆ operator==()
| bool CandleDataType::operator== |
( |
const CandleDataType & | candleDataType | ) |
const |
|
noexcept |
Compares the values of the data types (case-sensitive).
- Parameters
-
| candleDataType | The other data type. |
- Returns
- true if the values are equal.
◆ parse()
Parses string representation of candle data type attribute into an object (the same as CandleDataType::valueOf()).
Any string that was returned by CandleDataType::toString() can be parsed.
- Parameters
-
| s | string representation of a candle data type attribute. |
- Returns
- candle data type attribute.
◆ toString()
| std::string CandleDataType::toString |
( |
| ) |
const |
Returns string representation of this data type attribute (the same as CandleDataType::getValue()).
This string representation can be converted back into an object with the CandleDataType::parse() method.
- Returns
- string representation of this candle data type attribute.
◆ valueOf()
Returns the candle data type with the given value.
The value is case-sensitive: the constant if it is equal to the value of a constant, CandleDataType::DEFAULT for an empty string, otherwise a new data type with this value.
A new data type refers to a copy of its value that the library keeps (one per distinct value) until the program exits, so it must not be used by the destructor of a global variable that was constructed before the first data type with this value.
- Parameters
-
| value | string representation of a candle data type attribute. |
- Returns
- candle data type attribute.
◆ ATTRIBUTE_KEY
| char CandleDataType::ATTRIBUTE_KEY[] = "dt" |
|
staticconstexpr |
The attribute key that is used to store the value of CandleDataType in a symbol string using methods of MarketEventSymbols class.
The value of this constant is "dt", which is an abbreviation for "data type". The value that this key shall be set to is equal to the corresponding CandleDataType::toString()