org.otfeed.event
Class OTTrade

java.lang.Object
  extended by org.otfeed.event.OTTrade
All Implemented Interfaces:
java.lang.Comparable<OTTrade>

public final class OTTrade
extends java.lang.Object
implements java.lang.Comparable<OTTrade>

Provides either real-time or historical trade information. This event indicates that shares were sold and purchased (excepting some tracing messages). OTTrade stores price, size and other information about the deal.


Constructor Summary
OTTrade()
          Default constructor.
OTTrade(java.util.Date timestamp, int size, double price, long volume, int sequenceNumber, char indicator, char tickIndicator, java.util.Set<TradePropertyEnum> properties, java.lang.String exchange, java.lang.String symbol)
          Constructor.
 
Method Summary
 int compareTo(OTTrade other)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getExchange()
           
 char getIndicator()
           
 double getPrice()
           
 int getSequenceNumber()
           
 int getSize()
           
 java.lang.String getSymbol()
           
 char getTickIndicator()
           
 java.util.Date getTimestamp()
           
 java.util.Set<TradePropertyEnum> getTradeProperties()
          Returns set of boolean properties of this trade.
 long getVolume()
           
 int hashCode()
           
 boolean isCancel()
           
 boolean isClose()
           
 boolean isFromBook()
           
 boolean isHigh()
           
 boolean isLow()
           
 boolean isOpen()
           
 boolean isUpdateLast()
           
 boolean isUpdateVolume()
           
 void setExchange(java.lang.String exchange)
          Sets exchange code.
 void setIndicator(char indicator)
          Sets indicator.
 void setPrice(double price)
          Sets trade price.
 void setSequenceNumber(int sequenceNumber)
          Sets sequence number of trade.
 void setSize(int size)
          Sets number of shares traded in this transaction.
 void setSymbol(java.lang.String symbol)
          Sets symbol code.
 void setTickIndicator(char tickIndicator)
          Sets tick indicator: D - Down, U - Up, N - Not provided.
 void setTimestamp(java.util.Date timestamp)
          Sets time of the event.
 void setTradeProperties(java.util.Set<TradePropertyEnum> p)
           
 void setVolume(long volume)
          Sets accumulated volume for the trading day.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OTTrade

public OTTrade()
Default constructor.


OTTrade

public OTTrade(java.util.Date timestamp,
               int size,
               double price,
               long volume,
               int sequenceNumber,
               char indicator,
               char tickIndicator,
               java.util.Set<TradePropertyEnum> properties,
               java.lang.String exchange,
               java.lang.String symbol)
Constructor.

Parameters:
timestamp - Time when the event occurred.
size - Number of shares traded in this transaction.
price - Trade price.
volume - Accumulated volume for the trading day.
sequenceNumber - Sequence number of trade.
indicator - Indicator.
tickIndicator - Tick indicator: D - Down, U - Up, N - Not provided.
properties - Trade properties.
exchange - Exchange code.
symbol - Symbol code.
Method Detail

getTimestamp

public java.util.Date getTimestamp()
Returns:
Time when the event occurred.

setTimestamp

public void setTimestamp(java.util.Date timestamp)
Sets time of the event.

Parameters:
timestamp - Time when the event occurred.

getSize

public int getSize()
Returns:
Number of shares traded in this transaction.

setSize

public void setSize(int size)
Sets number of shares traded in this transaction.

Parameters:
size - Number of shares traded in this transaction.

getPrice

public double getPrice()
Returns:
Trade price.

setPrice

public void setPrice(double price)
Sets trade price.

Parameters:
price - Trade price.

getVolume

public long getVolume()
Returns:
Accumulated volume for the trading day.

setVolume

public void setVolume(long volume)
Sets accumulated volume for the trading day.

Parameters:
volume - Accumulated volume for the trading day.

getSequenceNumber

public int getSequenceNumber()
Returns:
Sequence number of trade; used to correct trades in cancellations.

setSequenceNumber

public void setSequenceNumber(int sequenceNumber)
Sets sequence number of trade.

Parameters:
sequenceNumber - Sequence number of trade.

getIndicator

public char getIndicator()
Returns:
Indicator: See the Trade Indicators section for details.

setIndicator

public void setIndicator(char indicator)
Sets indicator.

Parameters:
indicator - Indicator.

getTickIndicator

public char getTickIndicator()
Returns:
Tick indicator: D - Down, U - Up, N - Not provided.

setTickIndicator

public void setTickIndicator(char tickIndicator)
Sets tick indicator: D - Down, U - Up, N - Not provided.

Parameters:
tickIndicator - Sets tick indicator: D - Down, U - Up, N - Not provided.

isOpen

public boolean isOpen()
Returns:
Notes whether the trade provides the opening price for the day.

isHigh

public boolean isHigh()
Returns:
Notes whether the trade provides the high price for the day.

getTradeProperties

public java.util.Set<TradePropertyEnum> getTradeProperties()
Returns set of boolean properties of this trade. One can check these properties individually by calling one of isXXX methods of this calsss.


setTradeProperties

public void setTradeProperties(java.util.Set<TradePropertyEnum> p)

isLow

public boolean isLow()
Returns:
Notes whether the trade provides the low price for the day.

isClose

public boolean isClose()
Returns:
Notes whether the trade provides the closing price for the day.

isUpdateLast

public boolean isUpdateLast()
Returns:
Notes whether the trade updates the last trade price.

isUpdateVolume

public boolean isUpdateVolume()
Returns:
Notes whether the volume is a replacement consolidated volume.

isCancel

public boolean isCancel()
Returns:
Notes whether the trade is a cancel for a previous trade.

isFromBook

public boolean isFromBook()
Returns:
Notes whether the trade is from an ECN book.

getExchange

public java.lang.String getExchange()
Returns:
Exchange code.

setExchange

public void setExchange(java.lang.String exchange)
Sets exchange code.

Parameters:
exchange - Exchange code.

getSymbol

public java.lang.String getSymbol()
Returns:
Symbol code; this field is provided for option chains only, because there can be more than one symbol appropriate to the requested underlyer and expiry date.

setSymbol

public void setSymbol(java.lang.String symbol)
Sets symbol code.

Parameters:
symbol - Symbol code.

toString

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(OTTrade other)
Specified by:
compareTo in interface java.lang.Comparable<OTTrade>


Copyright © 2007 Mike Kroutikov. All Rights Reserved.