Class MarketEventSymbols
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&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".
For more details see Javadoc.
public static class MarketEventSymbols
- Inheritance
-
MarketEventSymbols
- Inherited Members
Methods
ChangeAttributeStringByKey(string?, string?, string?)
Changes value of one attribute value while leaving exchange code and other attributes intact.
The null
symbol is interpreted as empty one by this method.
public static string? ChangeAttributeStringByKey(string? symbol, string? key, string? value)
Parameters
Returns
- string
Returns new symbol with key attribute with the specified value and everything else from the old symbol.
Exceptions
- ArgumentNullException
If key is null.
ChangeBaseSymbol(string?, string)
Changes base symbol while leaving exchange code and attributes intact.
The result is null
if old symbol is null
.
public static string ChangeBaseSymbol(string? symbol, string baseSymbol)
Parameters
Returns
- string
Returns new symbol with new base symbol and old symbol's exchange code and attributes.
ChangeExchangeCode(string?, char)
Changes exchange code of the specified symbol or removes it
if new exchange code is '\0'
.
The result is null
if old symbol is null
.
public static string? ChangeExchangeCode(string? symbol, char exchangeCode)
Parameters
Returns
- string
Returns new symbol with the changed exchange code.
GetAttributeStringByKey(string?, string)
Returns value of the attribute with the specified key.
The result is null
if attribute with the specified key is not found.
The result is null
if symbol is null
.
public static string? GetAttributeStringByKey(string? symbol, string key)
Parameters
Returns
- string
Returns value of the attribute with the specified key.
Exceptions
- ArgumentNullException
If key is null.
GetBaseSymbol(string?)
Returns base symbol without exchange code and attributes.
The result is null
if symbol is null
.
public static string? GetBaseSymbol(string? symbol)
Parameters
symbol
stringThe specified symbol.
Returns
- string
Returns base symbol without exchange code and attributes.
GetExchangeCode(string?)
Returns exchange code of the specified symbol or '\0'
if none is defined.
The result is '\0'
if symbol is null
.
public static char GetExchangeCode(string? symbol)
Parameters
symbol
stringThe specified symbol.
Returns
- char
Returns exchange code of the specified symbol or
'\0'
if none is defined.
HasAttributes(string?)
Checks if the specified symbol has any attributes.
public static bool HasAttributes(string? symbol)
Parameters
symbol
stringThe symbol.
Returns
- bool
Returns
true
if the specified symbol has any attributes.
HasExchangeCode(string?)
Checks if the specified symbol has the exchange code specification.
The result is false
if symbol is null
.
public static bool HasExchangeCode(string? symbol)
Parameters
symbol
stringThe specified symbol.
Returns
- bool
Returns
true
is the specified symbol has the exchange code specification.
RemoveAttributeStringByKey(string?, string?)
Removes one attribute with the specified key while leaving exchange code and other attributes intact.
The result is null
if symbol is null
.
public static string? RemoveAttributeStringByKey(string? symbol, string? key)
Parameters
Returns
- string
Returns new symbol without the specified key and everything else from the old symbol.
Exceptions
- ArgumentNullException
If key is null.