dxFeed Graal CXX API
Loading...
Searching...
No Matches
dxfcpp::CandleAlignment Struct Reference

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

#include <CandleAlignment.hpp>

+ Inheritance diagram for dxfcpp::CandleAlignment:

Public Member Functions

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

Static Public Member Functions

static std::optional< std::reference_wrapper< const CandleAlignment > > parse (const std::string &s) noexcept
 Parses string representation of candle alignment into object.
 
static std::optional< std::reference_wrapper< const CandleAlignment > > getAttributeForSymbol (const std::string &symbol) noexcept
 Returns candle alignment of the given candle symbol string.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string normalizeAttributeForSymbol (const std::string &symbol) noexcept
 Returns candle symbol string with the normalized representation of the candle alignment attribute.
 

Static Public Attributes

static const CandleAlignment MIDNIGHT {"m"}
 Align candles on 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 candle 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 dxfcpp::CandleAlignment::changeAttributeForSymbol ( const std::string & symbol) const
inlineoverridevirtualnoexcept

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 dxfcpp::CandleSymbolAttribute.

◆ getAttributeForSymbol()

static std::optional< std::reference_wrapper< const CandleAlignment > > dxfcpp::CandleAlignment::getAttributeForSymbol ( const std::string & symbol)
inlinestaticnoexcept

Returns candle alignment of the given candle symbol string.

The result is CandleAlignment::DEFAULT if the symbol does not have candle alignment attribute or std::nullopt if there is no supported attribute's value.

Parameters
symbolThe candle symbol string.
Returns
candle alignment of the given candle symbol string or std::nullopt if there is no supported attribute's value.

◆ normalizeAttributeForSymbol()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::CandleAlignment::normalizeAttributeForSymbol ( const std::string & symbol)
inlinestaticnoexcept

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 the candle alignment attribute.

◆ parse()

static std::optional< std::reference_wrapper< const CandleAlignment > > dxfcpp::CandleAlignment::parse ( const std::string & s)
inlinestaticnoexcept

Parses string representation of candle alignment into object.

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

Parameters
sThe string representation of candle alignment.
Returns
The candle alignment (reference) or std::nullopt if there is no supported attribute's value.

◆ toString()

std::string dxfcpp::CandleAlignment::toString ( ) const
inlinenoexcept

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.

Member Data Documentation

◆ ATTRIBUTE_KEY

const std::string dxfcpp::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()