com.dxfeed.event.candle
Enum CandlePrice

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

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

Price type attribute of CandleSymbol defines price that is used to build the candles.

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 CandlePrice.toString()


Enum Constant Summary
ASK
          Quote ask price.
BID
          Quote bid price.
LAST
          Last trading price.
MARK
          Market price defined as average between quote bid and ask prices.
SETTLEMENT
          Official settlement price that is defined by exchange or last trading price otherwise.
 
Field Summary
static String ATTRIBUTE_KEY
          The attribute key that is used to store the value of CandlePrice in a symbol string using methods of MarketEventSymbols class.
static CandlePrice DEFAULT
          Default price type is LAST.
 
Method Summary
 String changeAttributeForSymbol(String symbol)
          Returns candle event symbol string with this candle price type set.
 void checkInAttributeImpl(CandleSymbol candleSymbol)
          Internal method that initializes attribute in the candle symbol.
static CandlePrice getAttributeForSymbol(String symbol)
          Returns candle price type of the given candle symbol string.
static String normalizeAttributeForSymbol(String symbol)
          Returns candle symbol string with the normalized representation of the candle price type attribute.
static CandlePrice parse(String s)
          Parses string representation of candle price type into object.
 String toString()
          Returns string representation of this candle price type.
static CandlePrice valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CandlePrice[] 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

LAST

public static final CandlePrice LAST
Last trading price.


BID

public static final CandlePrice BID
Quote bid price.


ASK

public static final CandlePrice ASK
Quote ask price.


MARK

public static final CandlePrice MARK
Market price defined as average between quote bid and ask prices.


SETTLEMENT

public static final CandlePrice SETTLEMENT
Official settlement price that is defined by exchange or last trading price otherwise. It updates based on all PriceType values: PriceType.INDICATIVE, PriceType.PRELIMINARY, and PriceType.FINAL.

Field Detail

DEFAULT

public static final CandlePrice DEFAULT
Default price type is LAST.


ATTRIBUTE_KEY

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

See Also:
Constant Field Values
Method Detail

values

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

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

valueOf

public static CandlePrice 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 price type set.

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

checkInAttributeImpl

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

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

toString

public String toString()
Returns string representation of this candle price type. The string representation of candle price type is a lower case string that corresponds to its name. For example, LAST is represented as "last".

Overrides:
toString in class Enum<CandlePrice>
Returns:
string representation of this candle price type.

parse

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

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

getAttributeForSymbol

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

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

normalizeAttributeForSymbol

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

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


Copyright © 2013 Devexperts. All Rights Reserved.