com.dxfeed.event.candle
Enum CandleSession

java.lang.Object
  extended by java.lang.Enum<CandleSession>
      extended by com.dxfeed.event.candle.CandleSession
All Implemented Interfaces:
CandleSymbolAttribute<CandleSession>, Serializable, Comparable<CandleSession>

public enum CandleSession
extends Enum<CandleSession>
implements CandleSymbolAttribute<CandleSession>

Session attribute of CandleSymbol defines trading that is used to build the candles.

Implementation details

This attribute is encoded in a symbol string with MarketEventSymbols.getAttributeStringByKey, changeAttributeStringByKey, and removeAttributeStringByKey methods.

ANY session is a default. The key to use with these methods is available via ATTRIBUTE_KEY constant. The value that this key shall be set to is equal to the corresponding CandleSession.toString()


Enum Constant Summary
ANY
          All trading sessions are used to build candles.
REGULAR
          Only regular trading session data is used to build candles.
 
Field Summary
static String ATTRIBUTE_KEY
          The attribute key that is used to store the value of CandleSession in a symbol string using methods of MarketEventSymbols class.
static CandleSession DEFAULT
          Default trading session is ANY.
 
Method Summary
 String changeAttributeForSymbol(String symbol)
          Returns candle event symbol string with this session attribute set.
 void checkInAttributeImpl(CandleSymbol candleSymbol)
          Internal method that initializes attribute in the candle symbol.
static CandleSession getAttributeForSymbol(String symbol)
          Returns candle session attribute of the given candle symbol string.
 SessionFilter getSessionFilter()
          Returns session filter that corresponds to this session attribute.
static String normalizeAttributeForSymbol(String symbol)
          Returns candle symbol string with the normalized representation of the candle session attribute.
static CandleSession parse(String s)
          Parses string representation of candle session attribute into object.
 String toString()
          Returns string representation of this candle session attribute.
static CandleSession valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CandleSession[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ANY

public static final CandleSession ANY
All trading sessions are used to build candles.


REGULAR

public static final CandleSession REGULAR
Only regular trading session data is used to build candles.

Field Detail

DEFAULT

public static final CandleSession DEFAULT
Default trading session is ANY.


ATTRIBUTE_KEY

public static final String ATTRIBUTE_KEY
The attribute key that is used to store the value of CandleSession in a symbol string using methods of MarketEventSymbols class. The value of this constant is "tho", which is an abbreviation for "trading hours only". The value that this key shall be set to is equal to the corresponding CandleSession.toString()

See Also:
Constant Field Values
Method Detail

values

public static CandleSession[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CandleSession c : CandleSession.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CandleSession valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getSessionFilter

public SessionFilter getSessionFilter()
Returns session filter that corresponds to this session attribute.

Returns:
session filter that corresponds to this session attribute.

changeAttributeForSymbol

public String changeAttributeForSymbol(String symbol)
Returns candle event symbol string with this session attribute set.

Specified by:
changeAttributeForSymbol in interface CandleSymbolAttribute<CandleSession>
Parameters:
symbol - original candle event symbol.
Returns:
candle event symbol string with this session attribute set.

checkInAttributeImpl

public void checkInAttributeImpl(CandleSymbol candleSymbol)
Internal method that initializes attribute in the candle symbol.

Specified by:
checkInAttributeImpl in interface CandleSymbolAttribute<CandleSession>
Parameters:
candleSymbol - candle symbol.
Throws:
IllegalStateException - if used outside of internal initialization logic.

toString

public String toString()
Returns string representation of this candle session attribute. The string representation of candle session attribute is a lower case string that corresponds to its name. For example, ANY is represented as "any".

Overrides:
toString in class Enum<CandleSession>
Returns:
string representation of this candle session attribute.

parse

public static CandleSession parse(String s)
Parses string representation of candle session attribute into object. Any string that was returned by toString() can be parsed and case is ignored for parsing.

Parameters:
s - string representation of candle candle session attribute.
Returns:
candle session attribute.
Throws:
IllegalArgumentException - if the string representation is invalid.

getAttributeForSymbol

public static CandleSession getAttributeForSymbol(String symbol)
Returns candle session attribute of the given candle symbol string. The result is DEFAULT if the symbol does not have candle session attribute.

Parameters:
symbol - candle symbol string.
Returns:
candle session attribute of the given candle symbol string.

normalizeAttributeForSymbol

public static String normalizeAttributeForSymbol(String symbol)
Returns candle symbol string with the normalized representation of the candle session attribute.

Parameters:
symbol - candle symbol string.
Returns:
candle symbol string with the normalized representation of the the candle session attribute.


Copyright © 2013 Devexperts. All Rights Reserved.