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

Helper class to compose and parse symbols for market events. More...

#include <MarketEventSymbols.hpp>

Static Public Member Functions

static bool hasExchangeCode (const std::string &symbol) noexcept
 Returns true is the specified symbol has the exchange code specification.
 
static char getExchangeCode (const std::string &symbol) noexcept
 Returns exchange code of the specified symbol or ‘’\0'` if none is defined.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeExchangeCode (const std::string &symbol, char exchangeCode) noexcept
 Changes exchange code of the specified symbol or removes it if new exchange code is ‘’\0'`.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string getBaseSymbol (const std::string &symbol) noexcept
 Returns base symbol without exchange code and attributes.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeBaseSymbol (const std::string &symbol, const std::string &baseSymbol) noexcept
 Changes base symbol while leaving exchange code and attributes intact.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::optional< std::string > getAttributeStringByKey (const std::string &symbol, const std::string &key) noexcept
 Returns value of the attribute with the specified key.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string changeAttributeStringByKey (const std::string &symbol, const std::string &key, const std::string &value) noexcept
 Changes value of one attribute value while leaving exchange code and other attributes intact.
 
static DXFCPP_CXX20_CONSTEXPR_STRING std::string removeAttributeStringByKey (const std::string &symbol, const std::string &key) noexcept
 Removes one attribute with the specified key while leaving exchange code and other attributes intact.
 

Detailed Description

Helper class to compose and parse symbols for market events.

Regional symbols

Regional symbol subscription receives events only from a designated exchange, marketplace, or venue instead of receiving composite events from all venues (by default). Regional symbol is composed from a base symbol, ampersand character ('&'), and an exchange code character. For example,

  • "SPY" is the symbol for composite events for SPDR S&P 500 ETF from all exchanges,
  • "SPY&amp;N" is the symbol for event for SPDR S&P 500 ETF that originate only from NYSE marketplace.

Symbol attributes

Market event symbols can have a number of attributes attached to then in curly braces with <key>=<value> paris separated by commas. For example,

  • "SPY{price=bid}" is the market symbol "SPY" with an attribute key "price" set to value "bid".
  • "SPY(=5m,tho=true}" is the market symbol "SPY" with two attributes. One has an empty key and value "5m", while the other has key "tho" and value "true".

The methods in this class always maintain attribute keys in alphabetic order.

Member Function Documentation

◆ changeAttributeStringByKey()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::MarketEventSymbols::changeAttributeStringByKey ( const std::string & symbol,
const std::string & key,
const std::string & value )
inlinestaticnoexcept

Changes value of one attribute value while leaving exchange code and other attributes intact.

Parameters
symbolold symbol.
keyattribute key.
valueattribute value.
Returns
new symbol with key attribute with the specified value and everything else from the old symbol.

◆ changeBaseSymbol()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::MarketEventSymbols::changeBaseSymbol ( const std::string & symbol,
const std::string & baseSymbol )
inlinestaticnoexcept

Changes base symbol while leaving exchange code and attributes intact.

Parameters
symbolold symbol.
baseSymbolnew base symbol.
Returns
new symbol with new base symbol and old symbol's exchange code and attributes.

◆ changeExchangeCode()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::MarketEventSymbols::changeExchangeCode ( const std::string & symbol,
char exchangeCode )
inlinestaticnoexcept

Changes exchange code of the specified symbol or removes it if new exchange code is ‘’\0'`.

Parameters
symbolThe old symbol.
exchangeCodeThe new exchange code.
Returns
new symbol with the changed exchange code.

◆ getAttributeStringByKey()

static DXFCPP_CXX20_CONSTEXPR_STRING std::optional< std::string > dxfcpp::MarketEventSymbols::getAttributeStringByKey ( const std::string & symbol,
const std::string & key )
inlinestaticnoexcept

Returns value of the attribute with the specified key.

The result is std::nullopt if attribute with the specified key is not found.

Parameters
symbolsymbol.
keyattribute key.
Returns
value of the attribute with the specified key | std::nullopt if attribute with the specified key is not found.

◆ getBaseSymbol()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::MarketEventSymbols::getBaseSymbol ( const std::string & symbol)
inlinestaticnoexcept

Returns base symbol without exchange code and attributes.

Parameters
symbolsymbol.
Returns
base symbol without exchange code and attributes.

◆ getExchangeCode()

static char dxfcpp::MarketEventSymbols::getExchangeCode ( const std::string & symbol)
inlinestaticnoexcept

Returns exchange code of the specified symbol or ‘’\0'` if none is defined.

Parameters
symbolThe symbol.
Returns
exchange code of the specified symbol or ‘’\0'` if none is defined.

◆ hasExchangeCode()

static bool dxfcpp::MarketEventSymbols::hasExchangeCode ( const std::string & symbol)
inlinestaticnoexcept

Returns true is the specified symbol has the exchange code specification.

Parameters
symbolThe symbol.
Returns
true is the specified symbol has the exchange code specification.

◆ removeAttributeStringByKey()

static DXFCPP_CXX20_CONSTEXPR_STRING std::string dxfcpp::MarketEventSymbols::removeAttributeStringByKey ( const std::string & symbol,
const std::string & key )
inlinestaticnoexcept

Removes one attribute with the specified key while leaving exchange code and other attributes intact.

Parameters
symbolold symbol.
keyattribute key.
Returns
new symbol without the specified key and everything else from the old symbol.