public abstract class TradeBase extends MarketEvent implements LastingEvent<String>
Trade
and TradeETH
events.
Trade events represent the most recent information that is available about the last trade on the market
at any given moment of time.
Trade
event represents last trade information for regular trading hours (RTH)
with an official volume and turnover for the whole trading day identified by dayId
field.
TradeETH
event is defined only for symbols (typically stocks and ETFs) with a designated
extended trading hours (ETH, pre market and post market trading sessions). It represents
last trade price during ETH and also accumulated volume and turnover during ETH for current trading day.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_SEQUENCE
Maximum allowed sequence value.
|
Modifier and Type | Method and Description |
---|---|
double |
getChange()
Returns change of the last trade.
|
int |
getDayId()
Returns identifier of the current trading day.
|
double |
getDayTurnover()
Returns total turnover traded for a day.
|
long |
getDayVolume()
Returns total volume traded for a day as integer number (rounded toward zero).
|
double |
getDayVolumeAsDouble()
Returns total volume traded for a day as floating number with fractions.
|
char |
getExchangeCode()
Returns exchange code of the last trade.
|
double |
getPrice()
Returns price of the last trade.
|
int |
getSequence()
Returns sequence number of the last trade to distinguish trades that have the same
time . |
long |
getSize()
Returns size of the last trade as integer number (rounded toward zero).
|
double |
getSizeAsDouble()
Returns size of the last trade as floating number with fractions.
|
Direction |
getTickDirection()
Returns tick direction of the last trade.
|
long |
getTime()
Returns time of the last trade.
|
int |
getTimeNanoPart()
Returns microseconds and nanoseconds time part of the last trade.
|
long |
getTimeNanos()
Returns time of the last trade in nanoseconds.
|
long |
getTimeSequence()
Returns time and sequence of last trade packaged into single long value.
|
boolean |
isExtendedTradingHours()
Returns whether last trade was in extended trading hours.
|
void |
setChange(double change)
Changes change of the last trade.
|
void |
setDayId(int dayId)
Changes identifier of the current trading day.
|
void |
setDayTurnover(double dayTurnover)
Changes total turnover traded for a day.
|
void |
setDayVolume(long dayVolume)
Changes total volume traded for a day as integer number (rounded toward zero).
|
void |
setDayVolumeAsDouble(double dayVolume)
Changes total volume traded for a day as floating number with fractions.
|
void |
setExchangeCode(char exchangeCode)
Changes exchange code of the last trade.
|
void |
setExtendedTradingHours(boolean extendedTradingHours)
Changes whether last trade was in extended trading hours.
|
void |
setPrice(double price)
Changes price of the last trade.
|
void |
setSequence(int sequence)
Changes
getSequence() sequence number} of the last trade. |
void |
setSize(long size)
Changes size of the last trade as integer number (rounded toward zero).
|
void |
setSizeAsDouble(double size)
Changes size of the last trade as floating number with fractions.
|
void |
setTickDirection(Direction direction)
Changes tick direction of the last trade.
|
void |
setTime(long time)
Changes time of the last trade.
|
void |
setTimeNanoPart(int timeNanoPart)
Changes microseconds and nanoseconds time part of the last trade.
|
void |
setTimeNanos(long timeNanos)
Changes time of the last trade.
|
void |
setTimeSequence(long timeSequence)
Changes time and sequence of last trade.
|
String |
toString()
Returns string representation of this trade event.
|
getEventSymbol, getEventTime, setEventSymbol, setEventTime
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEventSymbol, getEventTime, setEventSymbol, setEventTime
public static final int MAX_SEQUENCE
setSequence(int)
,
Constant Field Valuespublic long getTimeSequence()
public void setTimeSequence(long timeSequence)
time
and/or sequence
.timeSequence
- the time and sequence.getTimeSequence()
public long getTime()
public void setTime(long time)
time
- time of the last trade.public long getTimeNanos()
public void setTimeNanos(long timeNanos)
timeNanos
- time of the last trade in nanoseconds.public void setTimeNanoPart(int timeNanoPart)
timeNanoPart
- microseconds and nanoseconds time part of the last trade.public int getTimeNanoPart()
public int getSequence()
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
.public void setSequence(int sequence)
getSequence()
sequence number} of the last trade.sequence
- the sequence.IllegalArgumentException
- if sequence is below zero or above MAX_SEQUENCE
.getSequence()
public char getExchangeCode()
public void setExchangeCode(char exchangeCode)
exchangeCode
- exchange code of the last trade.public double getPrice()
public void setPrice(double price)
price
- price of the last trade.public long getSize()
public void setSize(long size)
size
- size of the last trade as integer number (rounded toward zero).public double getSizeAsDouble()
public void setSizeAsDouble(double size)
size
- size of the last trade as floating number with fractions.public int getDayId()
public void setDayId(int dayId)
dayId
- identifier of the current trading day.public long getDayVolume()
public void setDayVolume(long dayVolume)
dayVolume
- total volume traded for a day as integer number (rounded toward zero).public double getDayVolumeAsDouble()
public void setDayVolumeAsDouble(double dayVolume)
dayVolume
- total volume traded for a day as floating number with fractions.public double getDayTurnover()
getDayTurnover() / getDayVolume
()
.public void setDayTurnover(double dayTurnover)
dayTurnover
- total turnover traded for a day.public Direction getTickDirection()
public void setTickDirection(Direction direction)
direction
- tick direction of the last trade.public boolean isExtendedTradingHours()
true
if last trade was in extended trading hours.public void setExtendedTradingHours(boolean extendedTradingHours)
extendedTradingHours
- true
if last trade was in extended trading hours.public double getChange()
public void setChange(double change)
change
- price of the last trade.Copyright © 2002–2023 Devexperts LLC. All rights reserved.