com.dxfeed.event.candle
Enum CandleAlignment

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

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

Candle alignment attribute of CandleSymbol defines how candle are aligned with respect to time.

Implementation details

This attribute is encoded in a symbol string with MarketEventSymbols.getAttributeStringByKey, changeAttributeStringByKey, and removeAttributeStringByKey methods. 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 CandleAlignment.toString()


Enum Constant Summary
MIDNIGHT
          Align candles on midnight.
SESSION
          Align candles on trading sessions.
 
Field Summary
static String ATTRIBUTE_KEY
          The attribute key that is used to store the value of CandleAlignment in a symbol string using methods of MarketEventSymbols class.
static CandleAlignment DEFAULT
          Default alignment is MIDNIGHT.
 
Method Summary
 String changeAttributeForSymbol(String symbol)
          Returns candle event symbol string with this candle alignment set.
 void checkInAttributeImpl(CandleSymbol candleSymbol)
          Internal method that initializes attribute in the candle symbol.
static CandleAlignment getAttributeForSymbol(String symbol)
          Returns candle alignment of the given candle symbol string.
static String normalizeAttributeForSymbol(String symbol)
          Returns candle symbol string with the normalized representation of the candle alignment attribute.
static CandleAlignment parse(String s)
          Parses string representation of candle alignment into object.
 String toString()
          Returns string representation of this candle alignment.
static CandleAlignment valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CandleAlignment[] 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

MIDNIGHT

public static final CandleAlignment MIDNIGHT
Align candles on midnight.


SESSION

public static final CandleAlignment SESSION
Align candles on trading sessions.

Field Detail

DEFAULT

public static final CandleAlignment DEFAULT
Default alignment is MIDNIGHT.


ATTRIBUTE_KEY

public static final String ATTRIBUTE_KEY
The attribute key that is used to store the value of CandleAlignment in a symbol string using methods of MarketEventSymbols class. The value of this constant is "a". The value that this key shall be set to is equal to the corresponding CandleAlignment.toString()

See Also:
Constant Field Values
Method Detail

values

public static CandleAlignment[] 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 (CandleAlignment c : CandleAlignment.values())
    System.out.println(c);

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

valueOf

public static CandleAlignment 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

changeAttributeForSymbol

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

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

checkInAttributeImpl

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

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

toString

public String toString()
Returns string representation of this candle alignment. The string representation of candle alignment "m" for MIDNIGHT and "s" for SESSION.

Overrides:
toString in class Enum<CandleAlignment>
Returns:
string representation of this candle alignment.

parse

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

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

getAttributeForSymbol

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

Parameters:
symbol - candle symbol string.
Returns:
candle alignment of the given candle symbol string.

normalizeAttributeForSymbol

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

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


Copyright © 2013 Devexperts. All Rights Reserved.