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 of 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&N" is the symbol for event for SPDR S&P 500 ETF that originates only from the NYSE marketplace.
Symbol attributes
Market event symbols can have a number of attributes attached to them 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.
| std::string MarketEventSymbols::buildSpreadSymbol |
( |
const std::map< std::string, double > & | spread | ) |
|
|
static |
Builds the canonical spread symbol for the specified spread components.
The canonical representation uses a special prefix, leg ordering and formatting.
Spread legs with a zero ratio are ignored (not included in the spread symbol). If the spread is empty, then an empty string is returned. If the spread consists of one leg with a ratio of 1, then the pure leg symbol is returned. Legs with a NaN ratio, which have no order in Java, go last, by symbol.
Example:
static std::string buildSpreadSymbol(const std::map< std::string, double > &spread)
Builds the canonical spread symbol for the specified spread components.
Definition MarketEventSymbols.cpp:280
- Parameters
-
| spread | The map of the spread leg symbols to their ratios in the spread. |
- Returns
- The canonical spread symbol for the specified spread components.
| std::string MarketEventSymbols::getExchangesByPattern |
( |
StringParam | characterClass | ) |
|
|
static |
Returns a string with all exchange codes (the characters with codes 0..127) that match the specified character class.
For greater flexibility, the outer square brackets of the character class can be omitted.
The character class is an ECMAScript regular expression (std::regex): the Java-specific syntax, such as \p{Upper} or the && intersection, is not supported. Such syntax either throws InvalidArgumentException or, when it is also a valid ECMAScript expression (A-Z&&[^AB]), matches other characters than in Java.
Example:
static std::string getExchangesByPattern(StringParam characterClass)
Returns a string with all exchange codes (the characters with codes 0..127) that match the specified ...
Definition MarketEventSymbols.cpp:387
- Parameters
-
| characterClass | The regular expression character class. |
- Returns
- All exchange codes that match the specified character class.
- Exceptions
-