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

Price type attribute of CandleSymbol defines price that is used to build the candles. More...

#include <CandlePrice.hpp>

+ Inheritance diagram for dxfcpp::CandlePrice:

Public Member Functions

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

Static Public Member Functions

static std::optional< std::reference_wrapper< const CandlePrice > > parse (const std::string &s) noexcept
 Parses string representation of candle price type into object.
 
static std::optional< std::reference_wrapper< const CandlePrice > > getAttributeForSymbol (const std::string &symbol) noexcept
 Returns candle price type 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 price type attribute.
 

Static Public Attributes

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
 Default price type is CandlePrice::LAST.
 
static const std::string ATTRIBUTE_KEY {"price"}
 The attribute key that is used to store the value of CandlePrice in a symbol string using methods of MarketEventSymbols class.
 

Detailed Description

Price type attribute of CandleSymbol defines price that is 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()

Member Function Documentation

◆ changeAttributeForSymbol()

std::string dxfcpp::CandlePrice::changeAttributeForSymbol ( const std::string & symbol) const
inlineoverridevirtualnoexcept

Returns candle event symbol string with this candle price type set.

Parameters
symboloriginal candle event symbol.
Returns
candle event symbol string with this candle price type set.

Implements dxfcpp::CandleSymbolAttribute.

◆ getAttributeForSymbol()

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

Returns candle price type of the given candle symbol string.

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

Parameters
symbolThe candle symbol string.
Returns
candle price type 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::CandlePrice::normalizeAttributeForSymbol ( const std::string & symbol)
inlinestaticnoexcept

Returns candle symbol string with the normalized representation of the candle price type attribute.

Parameters
symbolcandle symbol string.
Returns
candle symbol string with the normalized representation of the the candle price type attribute.

◆ parse()

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

Parses string representation of candle price type into object.

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

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

◆ toString()

const std::string & dxfcpp::CandlePrice::toString ( ) const &
inlinenoexcept

Returns string representation of this candle price type.

The string representation of 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.

Member Data Documentation

◆ ATTRIBUTE_KEY

const std::string dxfcpp::CandlePrice::ATTRIBUTE_KEY {"price"}
static

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

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

◆ SETTLEMENT

const CandlePrice dxfcpp::CandlePrice::SETTLEMENT {"s"}
static

Official settlement price that is defined by exchange or last trading price otherwise.

It updates based on all PriceType values: PriceType::INDICATIVE, PriceType::PRELIMINARY, and PriceType::FINAL}.