com.dxfeed.event.market
Class TimeAndSale

java.lang.Object
  extended by com.dxfeed.event.market.MarketEvent
      extended by com.dxfeed.event.market.TimeAndSale
All Implemented Interfaces:
TimeSeriesEvent, java.io.Serializable

public final class TimeAndSale
extends MarketEvent
implements TimeSeriesEvent

Time and Sale represents a trade (or other market event with price, e.g. market open/close price, etc.). Time and Sales are intended to provide information about trades in a continuous time slice (unlike Trade events which are supposed to provide information about the current last trade). Time and Sale events have unique event IDs which can be used for later correction/cancellation processing.

See Also:
Serialized Form

Field Summary
static int MAX_SEQUENCE
           
 
Constructor Summary
TimeAndSale()
           
TimeAndSale(java.lang.String eventSymbol)
           
 
Method Summary
 double getAskPrice()
           
 double getBidPrice()
           
 long getEventId()
          Returns identifier of this event.
 char getExchangeCode()
           
 java.lang.String getExchangeSaleConditions()
          Returns sale conditions provided for this event by data feed.
 double getPrice()
           
 int getSequence()
          Returns sequence number of this event to distinguish events that has the same time.
 long getSize()
           
 long getTime()
          Returns timestamp of original event in milliseconds.
 boolean isCancel()
          Returns whether this is a cancellation of a previous event.
 boolean isCorrection()
          Returns whether this is a correction of a previous event.
 boolean isNew()
          Returns whether this is a new event (not cancellation or correction).
 boolean isTrade()
          Deprecated. use isValidTick() instead.
 boolean isValidTick()
          Returns whether this event represents a valid intraday tick.
 void setAskPrice(double askPrice)
           
 void setBidPrice(double bidPrice)
           
 void setCancel()
           
 void setCorrection()
           
 void setEventId(long eventId)
          Changes identifier for this event.
 void setExchangeCode(char exchangeCode)
           
 void setExchangeSaleConditions(java.lang.String exchangeSaleConditions)
           
 void setNew()
           
 void setPrice(double price)
           
 void setSequence(int sequence)
          Changes getSequence() sequence number} of this event.
 void setSize(long size)
           
 void setTime(long time)
          Changes time spate of event in milliseconds.
 void setTrade(boolean isValidTick)
          Deprecated. use setValidTick(boolean) instead.
 void setValidTick(boolean isValidTick)
           
 java.lang.String toString()
           
 
Methods inherited from class com.dxfeed.event.market.MarketEvent
getEventSymbol, setEventSymbol
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SEQUENCE

public static final int MAX_SEQUENCE
See Also:
Constant Field Values
Constructor Detail

TimeAndSale

public TimeAndSale()

TimeAndSale

public TimeAndSale(java.lang.String eventSymbol)
Method Detail

getEventId

public long getEventId()
Returns identifier of this event. Event identifiers are unique within event symbol. If this event is correction or cancel, then its identifier repeats original event identifier. 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.

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

setTime

public void setTime(long time)
Changes time spate 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:
java.lang.IllegalArgumentException - if sequence is below zero or above MAX_SEQUENCE.
See Also:
getSequence()

getExchangeCode

public char getExchangeCode()

setExchangeCode

public void setExchangeCode(char exchangeCode)

getPrice

public double getPrice()

setPrice

public void setPrice(double price)

getSize

public long getSize()

setSize

public void setSize(long size)

getBidPrice

public double getBidPrice()

setBidPrice

public void setBidPrice(double bidPrice)

getAskPrice

public double getAskPrice()

setAskPrice

public void setAskPrice(double askPrice)

getExchangeSaleConditions

public java.lang.String getExchangeSaleConditions()
Returns sale conditions provided for this event by data feed. This field format is specific for every particular data feed.

Returns:
sale conditions

setExchangeSaleConditions

public void setExchangeSaleConditions(java.lang.String exchangeSaleConditions)

isTrade

@Deprecated
public boolean isTrade()
Deprecated. use isValidTick() instead.

Returns whether this event represents a valid intraday tick.
Note, that a correction for a previously distributed valid tick represents a new valid tick itself, but a cancellation of a previous valid tick does not.

Returns:
true if this event represents a valid intraday tick.

setTrade

@Deprecated
public void setTrade(boolean isValidTick)
Deprecated. use setValidTick(boolean) instead.

Sets whether this event represents a valid tick.

Parameters:
isValidTick - whether this event is a valid tick

isValidTick

public boolean isValidTick()
Returns whether this event represents a valid intraday tick.
Note, that a correction for a previously distributed valid tick represents a new valid tick itself, but a cancellation of a previous valid tick does not.

Returns:
true if this event represents a valid intraday tick.

setValidTick

public void setValidTick(boolean isValidTick)

isNew

public boolean isNew()
Returns whether this is a new event (not cancellation or correction).

Returns:
whether this is a new event (not cancellation or correction)

setNew

public void setNew()

isCorrection

public boolean isCorrection()
Returns whether this is a correction of a previous event.

Returns:
whether this is a correction of a previous event

setCorrection

public void setCorrection()

isCancel

public boolean isCancel()
Returns whether this is a cancellation of a previous event.

Returns:
whether this is a cancellation of a previous event

setCancel

public void setCancel()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object