public class Trade extends TradeBase
Trade
event has the following properties:
eventSymbol
- symbol of this event;
time
- time of the last trade;
timeNanoPart
- microseconds and nanoseconds time part of the last trade;
sequence
- sequence of the last trade;
exchangeCode
- exchange code of the last trade;
price
- price of the last trade;
change
- change of the last trade;
size
- size of the last trade as integer number (rounded toward zero);
sizeAsDouble
- size of the last trade as floating number with fractions;
tickDirection
- tick direction of the last trade;
extendedTradingHours
- whether the last trade was in extended trading hours;
dayId
- identifier of the current trading day;
dayVolume
- total volume traded for a day as integer number (rounded toward zero);
dayVolumeAsDouble
- total volume traded for a day as floating number with fractions;
dayTurnover
- total turnover traded for a day;
Trade
event defines last trade price
as officially defined
by the corresponding exchange for its regular trading hours (RTH).
It also include an official exchange dayVolumeAsDouble
and dayTurnover
for the whole trading day identified by dayId
.
So, Trade
event captures all the official numbers that are typically reported by exchange.
Trades that happen in extended trading hours (ETH, pre-market and post-market trading sessions),
which are typically defined for stocks and ETFs, do not update last trade time
,
exchangeCode
, price
, change
,
sizeAsDouble
, and tickDirection
in the Trade
event, but they do update dayVolumeAsDouble
and dayTurnover
.
During extended trading hours a TradeETH
event is generated on each trade with its
extendedTradingHours
property set to true
.
The volume and turnover are included into the Trade
event instead
of Summary
event, because both volume and turnover typically update with each trade.
The dayId
field identifies current trading day for which volume and turnover statistics are computed.
This solution avoids generation of multiple events on each trade during regular trading hours.
Summary
event is generated during the trading day only when new highs
or lows are reached or other properties change.
Note that one can compute volume-weighted average price (VWAP) for a day by this formula:
vwap =
dayTurnover
/ dayVolumeAsDouble
;
Trade
dayVolumeAsDouble
and dayTurnover
to NaN
and sets dayId
to the next trading day in preparation to the next day's pre-market trading session
(or for regular trading if there is no pre-market) while leaving all other properties intact.
They reflect information about the last known RTH trade until the next RTH trade happens.
Trade
and Trade&X
for regional exchange trades.
Regional records do not explicitly store a field for exchangeCode
property.MAX_SEQUENCE
Constructor and Description |
---|
Trade()
Creates new trade with default values.
|
Trade(String eventSymbol)
Creates new trade with the specified event symbol.
|
Modifier and Type | Method and Description |
---|---|
String |
toString()
Returns string representation of this trade event.
|
getChange, getDayId, getDayTurnover, getDayVolume, getDayVolumeAsDouble, getExchangeCode, getPrice, getSequence, getSize, getSizeAsDouble, getTickDirection, getTime, getTimeNanoPart, getTimeNanos, getTimeSequence, isExtendedTradingHours, setChange, setDayId, setDayTurnover, setDayVolume, setDayVolumeAsDouble, setExchangeCode, setExtendedTradingHours, setPrice, setSequence, setSize, setSizeAsDouble, setTickDirection, setTime, setTimeNanoPart, setTimeNanos, setTimeSequence
getEventSymbol, getEventTime, setEventSymbol, setEventTime
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEventSymbol, getEventTime, setEventSymbol, setEventTime
public Trade()
public Trade(String eventSymbol)
eventSymbol
- event symbol.Copyright © 2002–2023 Devexperts LLC. All rights reserved.