dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
CandleDataType Struct Referencefinal

Candle data type attribute of CandleSymbol defines which types of data shall be used for candles aggregation. More...

#include <CandleDataType.hpp>

Inheritance diagram for CandleDataType:

Public Member Functions

 CandleDataType () noexcept
 Creates the CandleDataType::UNDEFINED data type.
std::string getValue () const
 Returns string representation of this data type attribute.
std::string toString () const
 Returns string representation of this data type attribute (the same as CandleDataType::getValue()).
bool operator== (const CandleDataType &candleDataType) const noexcept
 Compares the values of the data types (case-sensitive).
std::string changeAttributeForSymbol (StringParam symbol) const override
 Returns candle event symbol string with this data type attribute set.

Static Public Member Functions

static CandleDataType parse (StringParam s)
 Parses string representation of candle data type attribute into an object (the same as CandleDataType::valueOf()).
static CandleDataType valueOf (StringParam value)
 Returns the candle data type with the given value.
static CandleDataType getAttributeForSymbol (StringParam symbol)
 Returns candle data type attribute of the given candle symbol string.
static std::string normalizeAttributeForSymbol (StringParam symbol)
 Returns candle symbol string with the normalized representation of the candle data type attribute.

Static Public Attributes

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.

Detailed Description

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()

Member Function Documentation

◆ 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
symboloriginal candle event symbol.
Returns
candle event symbol string with this data type attribute set.

Implements CandleSymbolAttribute.

◆ getAttributeForSymbol()

CandleDataType CandleDataType::getAttributeForSymbol ( StringParam symbol)
static

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
symbolcandle 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
symbolcandle 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
candleDataTypeThe other data type.
Returns
true if the values are equal.

◆ parse()

CandleDataType CandleDataType::parse ( StringParam s)
static

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
sstring 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()

CandleDataType CandleDataType::valueOf ( StringParam value)
static

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
valuestring representation of a candle data type attribute.
Returns
candle data type attribute.

Member Data Documentation

◆ 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()