dxFeed Graal CXX API v5.0.0
Loading...
Searching...
No Matches
CandleAlignment Struct Reference

Candle alignment attribute of CandleSymbol defines how candles are aligned with respect to time. More...

#include <CandleAlignment.hpp>

+ Inheritance diagram for CandleAlignment:

Public Member Functions

std::string changeAttributeForSymbol (const StringLike &symbol) const override
 Returns candle event symbol string with this candle alignment set.
 
std::string toString () const
 Returns string representation of this candle alignment.
 

Static Public Member Functions

static std::reference_wrapper< const CandleAlignmentparse (const StringLike &s)
 Parses string representation of candle alignment into an object.
 
static std::reference_wrapper< const CandleAlignmentgetAttributeForSymbol (const StringLike &symbol)
 Returns candle alignment of the given candle symbol string.
 
static std::string normalizeAttributeForSymbol (const StringLike &symbol)
 Returns candle symbol string with the normalized representation of the candle alignment attribute.
 

Static Public Attributes

static const CandleAlignment MIDNIGHT {"m"}
 Align candles at midnight.
 
static const CandleAlignment SESSION {"s"}
 Align candles on trading sessions.
 
static const CandleAlignment DEFAULT = MIDNIGHT
 Default alignment is CandleAlignment::MIDNIGHT.
 
static const std::string ATTRIBUTE_KEY {"a"}
 The attribute key that is used to store the value of CandleAlignment in a symbol string using methods of MarketEventSymbols class.
 

Detailed Description

Candle alignment attribute of CandleSymbol defines how candles are aligned with respect to time.

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 CandleAlignment::ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandleAlignment::toString()

Member Function Documentation

◆ changeAttributeForSymbol()

std::string CandleAlignment::changeAttributeForSymbol ( const StringLike & symbol) const
overridevirtual

Returns candle event symbol string with this candle alignment set.

Parameters
symbolThe original candle event symbol.
Returns
candle event symbol string with this candle alignment set.

Implements CandleSymbolAttribute.

References DEFAULT, and toString().

◆ getAttributeForSymbol()

std::reference_wrapper< const CandleAlignment > CandleAlignment::getAttributeForSymbol ( const StringLike & symbol)
static

Returns candle alignment of the given candle symbol string.

The result is CandleAlignment::DEFAULT if the symbol does not have a candle alignment attribute.

Parameters
symbolThe candle symbol string.
Returns
candle alignment of the given candle symbol string.

References DEFAULT.

◆ normalizeAttributeForSymbol()

std::string CandleAlignment::normalizeAttributeForSymbol ( const StringLike & symbol)
static

Returns candle symbol string with the normalized representation of the candle alignment attribute.

Parameters
symbolThe candle symbol string.
Returns
candle symbol string with the normalized representation of the candle alignment attribute.

References DEFAULT.

◆ parse()

std::reference_wrapper< const CandleAlignment > CandleAlignment::parse ( const StringLike & s)
static

Parses string representation of candle alignment into an object.

Any string returned by CandleAlignment::toString() can be parsed and a case is ignored for parsing.

Parameters
sThe string representation of candle alignment.
Returns
The candle alignment (reference)
Exceptions
InvalidArgumentExceptionif the string representation is invalid.

◆ toString()

std::string CandleAlignment::toString ( ) const

Returns string representation of this candle alignment.

The string representation of candle alignment "m" for CandleAlignment::MIDNIGHT and "s" for CandleAlignment::SESSION.

Returns
string representation of this candle alignment.

Referenced by changeAttributeForSymbol().

Member Data Documentation

◆ ATTRIBUTE_KEY

const std::string CandleAlignment::ATTRIBUTE_KEY {"a"}
static

The attribute key that is used to store the value of CandleAlignment in a symbol string using methods of MarketEventSymbols class.

The value of this constant is "a". The value that this key shall be set to is equal to the corresponding CandleAlignment::toString()