public class CandleSymbol extends Object implements Serializable
DXFeedSubscription
class
to subscribe for Candle
events. DXFeedSubscription
also accepts a string
representation of the candle symbol for subscription.
baseSymbol
followed by
an optional '&' with an exchange
code letter and followed by
an optional list of comma-separated key=value pairs in curly braces:
<baseSymbol> [ '&' <exchange> ] [ '{' <key1>=<value1> [ ',' <key2>=<value2> ] ... '}' ]
Properties of the candle symbol correspond to the keys in the string representation in the following way:
period
— aggregation period of this symbol.
The period value is composed of an optional
value
which defaults to 1 when not specified, followed by
a type
string which is defined by one of the
CandleType
enum values and can be abbreviated to first letters. For example, a daily candle of "IBM" base
symbol can be specified as "IBM{=d}" and 15 minute candle on it as "IBM{=15m}". The shortest
possible abbreviation for CandleType.MONTH
is "mo", so the monthly
candle can be specified as "IBM{=mo}". When period is not specified, then the
TICK
aggregation period is assumed as default. Note, that tick aggregation may
not be available on the demo system which is limited to a subset of symbols and aggregation periods.
price
— price type attribute of this symbol.
The CandlePrice
enum defines possible values with LAST
being default.
For legacy backwards-compatibility purposes, most of the price values cannot be abbreviated, so a one-minute candle
of "EUR/USD" bid price shall be specified with "EUR/USD{=m,price=bid}" candle symbol string. However,
the SETTLEMENT
can be abbreviated to "s", so a daily candle on
"/ES" futures settlement prices can be specified with "/ES{=d,price=s}" string.
session
set to CandleSession.REGULAR
which limits the candle to trading hours only, so a 133 tick candles on "GOOG" base symbol collected over
trading hours only can be specified with "GOOG{=133t,tho=true}" string. Note, that the default daily candles for
US equities are special for historical reasons and correspond to the way US equity exchange report their
daily summary data. The volume the US equity default daily candle corresponds to the total daily traded volume,
while open, high, low, and close correspond to the regular trading hours only.
alignment
— alignment attribute of this symbol.
The CandleAlignment
enum defines possible values with MIDNIGHT
being default.
The alignment values can be abbreviated to the first letter. So, a 1 hour candle on a symbol "AAPL" that starts
at the regular trading session at 9:30 am ET can be specified with "AAPL{=h,a=s,tho=true}". Contrast that
to the "AAPL{=h,tho=true}" candle that is aligned at midnight and thus starts at 9:00 am.
price level
— price level attribute of this symbol.
The CandlePriceLevel
defines additional axis to split candles within particular price corridor in
addition to CandlePeriod
attribute with the default value Double.NaN
. So a one-minute candles
of "AAPL" with price level 0.1 shall be specified with "AAPL{=m,pl=0.1}".
valueOf(String)
method parses
any valid string representation into a candle symbol object.
The result of the candle symbol
toString()
method is always normalized: keys are ordered lexicographically, values are in lower-case
and are abbreviated to their shortest possible form.Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Indicates whether this symbol is the same as another one.
|
CandleAlignment |
getAlignment()
Returns alignment attribute of this symbol.
|
String |
getBaseSymbol()
Returns base market symbol without attributes.
|
CandleExchange |
getExchange()
Returns exchange attribute of this symbol.
|
CandlePeriod |
getPeriod()
Returns aggregation period of this symbol.
|
CandlePrice |
getPrice()
Returns price type attribute of this symbol.
|
CandlePriceLevel |
getPriceLevel()
Returns price level attribute of this symbol.
|
CandleSession |
getSession()
Returns session attribute of this symbol.
|
int |
hashCode()
Returns hash code of this symbol.
|
String |
toString()
Returns string representation of this symbol.
|
static CandleSymbol |
valueOf(String symbol)
Converts the given string symbol into the candle symbol object.
|
static CandleSymbol |
valueOf(String symbol,
CandleSymbolAttribute<?> attribute)
Converts the given string symbol into the candle symbol object with the specified attribute set.
|
static CandleSymbol |
valueOf(String symbol,
CandleSymbolAttribute<?> attribute,
CandleSymbolAttribute<?>... attributes)
Converts the given string symbol into the candle symbol object with the specified attributes set.
|
public String getBaseSymbol()
public CandleExchange getExchange()
public CandlePrice getPrice()
public CandleSession getSession()
public CandlePeriod getPeriod()
public CandleAlignment getAlignment()
public CandlePriceLevel getPriceLevel()
public String toString()
valueOf(String)
method.public boolean equals(Object o)
public int hashCode()
public static CandleSymbol valueOf(String symbol)
symbol
- the string symbol.IllegalArgumentException
- if the string does not represent a valid symbol.public static CandleSymbol valueOf(String symbol, CandleSymbolAttribute<?> attribute)
symbol
- the string symbol.attribute
- the attribute to set.IllegalArgumentException
- if the string does not represent a valid symbol.public static CandleSymbol valueOf(String symbol, CandleSymbolAttribute<?> attribute, CandleSymbolAttribute<?>... attributes)
symbol
- the string symbol.attribute
- the attribute to set.attributes
- more attributes to set.IllegalArgumentException
- if the string does not represent a valid symbol.Copyright © 2002–2023 Devexperts LLC. All rights reserved.