com.dxfeed.event.candle
Class Candle

java.lang.Object
  extended by com.dxfeed.event.candle.Candle
All Implemented Interfaces:
LastingEvent, TimeSeriesEvent, Serializable

@EventType
public final class Candle
extends Object
implements TimeSeriesEvent, LastingEvent, Serializable

Candle event with open, high, low, close prices and other information for a specific period. Candles are build with a specified aggregation period using a specified price type with a data taken from the specified exchange from the specified trading session.

See Also:
Serialized Form

Field Summary
static int MAX_SEQUENCE
          Maximal allowed sequence value.
 
Constructor Summary
Candle()
          Creates new candle with default values.
Candle(CandleSymbol eventSymbol)
          Creates new candle with the specified candle event symbol.
 
Method Summary
 long getAskVolume()
          Returns ask volume in this candle.
 long getBidVolume()
          Returns bid volume in this candle.
 double getClose()
          Returns the last (close) price of this candle.
 long getCount()
          Returns total number of original trade (or quote) events in this candle.
 long getEventId()
          Returns identifier of this event.
 CandleSymbol getEventSymbol()
          Returns candle event symbol.
 double getHigh()
          Returns the maximal (high) price of this candle.
 double getLow()
          Returns the minimal (low) price of this candle.
 double getOpen()
          Returns the first (open) price of this candle.
 int getSequence()
          Returns sequence number of this event to distinguish events that has the same time.
 long getTime()
          Returns timestamp of original event in milliseconds.
 long getVolume()
          Returns total volume in this candle.
 double getVWAP()
          Returns volume-weighted average price (VWAP) in this candle.
 void setAskVolume(long askVolume)
          Changes ask volume in this candle.
 void setBidVolume(long bidVolume)
          Changes bid volume in this candle.
 void setClose(double close)
          Changes the last (close) price of this candle.
 void setCount(long count)
          Changes total number of original trade (or quote) events in this candle.
 void setEventId(long eventId)
          Changes identifier for this event.
 void setEventSymbol(CandleSymbol eventSymbol)
          Changes candle event symbol.
 void setHigh(double high)
          Changes the maximal (high) price of this candle.
 void setLow(double low)
          Changes the minimal (low) price of this candle.
 void setOpen(double open)
          Changes the first (open) price of this candle.
 void setSequence(int sequence)
          Changes getSequence() sequence number} of this event.
 void setTime(long time)
          Changes timestamp of event in milliseconds.
 void setVolume(long volume)
          Changes total volume in this candle.
 void setVWAP(double vwap)
          Changes volume-weighted average price (VWAP) in this candle.
 String toString()
          Returns string representation of this candle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SEQUENCE

public static final int MAX_SEQUENCE
Maximal allowed sequence value.

See Also:
setSequence(int), Constant Field Values
Constructor Detail

Candle

public Candle()
Creates new candle with default values.


Candle

public Candle(CandleSymbol eventSymbol)
Creates new candle with the specified candle event symbol.

Parameters:
eventSymbol - candle event symbol.
Method Detail

getEventSymbol

public CandleSymbol getEventSymbol()
Returns candle event symbol.

Returns:
candle event symbol.

setEventSymbol

public void setEventSymbol(CandleSymbol eventSymbol)
Changes candle event symbol.

Parameters:
eventSymbol - candle event symbol.

getEventId

public long getEventId()
Returns identifier of this event. Event identifiers are unique within event symbol. Event identifier is composed of time and sequence. Changing either time or sequence changes event identifier.

Specified by:
getEventId in interface TimeSeriesEvent
Returns:
unique event identifier.

setEventId

public void setEventId(long eventId)
Changes identifier for this event. Because, event identifier is composed of time and sequence, invocation of this method changes time and sequence. Do not use this method directly. Change time and/or sequence.

Parameters:
eventId - the event identifier.
See Also:
getEventId()

getTime

public long getTime()
Returns timestamp of original event in milliseconds.

Specified by:
getTime in interface TimeSeriesEvent
Returns:
timestamp of original event in milliseconds
See Also:
System.currentTimeMillis()

setTime

public void setTime(long time)
Changes timestamp of event in milliseconds.

Parameters:
time - timestamp in milliseconds.
See Also:
getTime()

getSequence

public int getSequence()
Returns sequence number of this event to distinguish events that has the same time. This sequence number does not have to be unique and does not need to be sequential. Sequence can range from 0 to MAX_SEQUENCE.


setSequence

public void setSequence(int sequence)
Changes getSequence() sequence number} of this event.

Parameters:
sequence - the sequence.
Throws:
IllegalArgumentException - if sequence is below zero or above MAX_SEQUENCE.
See Also:
getSequence()

getCount

public long getCount()
Returns total number of original trade (or quote) events in this candle.

Returns:
total number of original trade (or quote) events in this candle.

setCount

public void setCount(long count)
Changes total number of original trade (or quote) events in this candle.

Parameters:
count - total number of original trade (or quote) events in this candle.

getOpen

public double getOpen()
Returns the first (open) price of this candle.

Returns:
the first (open) price of this candle.

setOpen

public void setOpen(double open)
Changes the first (open) price of this candle.

Parameters:
open - the first (open) price of this candle.

getHigh

public double getHigh()
Returns the maximal (high) price of this candle.

Returns:
the maximal (high) price of this candle.

setHigh

public void setHigh(double high)
Changes the maximal (high) price of this candle.

Parameters:
high - the maximal (high) price of this candle.

getLow

public double getLow()
Returns the minimal (low) price of this candle.

Returns:
the minimal (low) price of this candle.

setLow

public void setLow(double low)
Changes the minimal (low) price of this candle.

Parameters:
low - the minimal (low) price of this candle.

getClose

public double getClose()
Returns the last (close) price of this candle.

Returns:
the last (close) price of this candle.

setClose

public void setClose(double close)
Changes the last (close) price of this candle.

Parameters:
close - the last (close) price of this candle.

getVolume

public long getVolume()
Returns total volume in this candle.

Returns:
total volume in this candle.

setVolume

public void setVolume(long volume)
Changes total volume in this candle.

Parameters:
volume - total volume in this candle.

getVWAP

public double getVWAP()
Returns volume-weighted average price (VWAP) in this candle.

Returns:
volume-weighted average price (VWAP) in this candle.

setVWAP

public void setVWAP(double vwap)
Changes volume-weighted average price (VWAP) in this candle.

Parameters:
vwap - volume-weighted average price (VWAP) in this candle.

getBidVolume

public long getBidVolume()
Returns bid volume in this candle.

Returns:
bid volume in this candle.

setBidVolume

public void setBidVolume(long bidVolume)
Changes bid volume in this candle.

Parameters:
bidVolume - bid volume in this candle.

getAskVolume

public long getAskVolume()
Returns ask volume in this candle.

Returns:
ask volume in this candle.

setAskVolume

public void setAskVolume(long askVolume)
Changes ask volume in this candle.

Parameters:
askVolume - ask volume in this candle.

toString

public String toString()
Returns string representation of this candle.

Overrides:
toString in class Object
Returns:
string representation of this candle.


Copyright © 2013 Devexperts. All Rights Reserved.