public class TradeETH extends TradeBase
TradeETH 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;
TradeETH event defines last trade price as officially defined
by the corresponding exchange for its extended trading hours (ETH).
It also includes dayVolumeAsDouble and dayTurnover
for the extended trading hours only of the trading day identified by dayId.
This event is not defined for symbols that has no concept of ETH.
When the first trade of regular trading hours (RTH) happens, then TradeETH event is generated
with extendedTradingHours property set to false. Afterwards, during RTH,
TradeETH event is not updated and retains information about the last trade, volume and turnover of the pre market trading session.
When the first trade of extended trading hours (ETH) happens, then TradeETH event is generated
with extendedTradingHours property set to true. Afterwards, during ETH,
TradeETH event is updated on each trade with the last trade information from post market trading session
and total volume and turnover of the pre and post market trading session (excluding the volume and turnover of a regular trading session).
Note, that during pre- and post-market sessions, Trade event also updates, but only its
dayVolumeAsDouble and dayTurnover properties change
to reflect the overall official volume and turnover as reported by exchanges.
During post market trading session, exchanges may correct their official RTH last trading price, which results
in the update to Trade event.
Note that one can compute volume-weighted average price (VWAP) for extended trading hours by this formula:
vwap =
dayTurnover / dayVolumeAsDouble;
TradeETH
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 ETH trade until the next ETH trade happens.
Trade and TradeETH events using isExtendedTradingHours method to figure out
which trading session had the most recent trade. The following piece of code finds the most
recent last trade price from the given feed for a given symbol,
assuming there is a subscription for both Trade and TradeETH events
for the given symbol:
Trade trade = feed.getLastEvent(new Trade(symbol));
TradeETH tradeEth = feed.getLastEvent(new TradeETH(symbol));
double extLast = tradeEth.isExtendedTradingHours() ? tradeEth.getPrice() : trade.getPrice();
Note, that the above code works correctly for symbols that has no concept of ETH, too, because in this
case the DXFeed.getLastEvent leaves default values in TradeETH
event properties, which means that extendedTradingHours flag is false
and a regular Trade.getPrice is used.
TradeETH and TradeETH&X
for regional exchange extended trade hours.
extendedTradingHours property is internally represented as a last bit of the "Flags" field of the record.
Regional records do not explicitly store a field for exchangeCode property.MAX_SEQUENCE| Constructor and Description |
|---|
TradeETH()
Creates new trade with default values.
|
TradeETH(String eventSymbol)
Creates new trade with the specified event symbol.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isETH()
Deprecated.
Use
TradeBase.isExtendedTradingHours() instead. |
void |
setETH(boolean extendedTradingHours)
Deprecated.
Use
TradeBase.setExtendedTradingHours(boolean) instead. |
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, setTimeSequencegetEventSymbol, getEventTime, setEventSymbol, setEventTimeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEventSymbol, getEventTime, setEventSymbol, setEventTimepublic TradeETH()
public TradeETH(String eventSymbol)
eventSymbol - event symbol.@Deprecated public boolean isETH()
TradeBase.isExtendedTradingHours() instead.true if last trade was in extended trading hours.@Deprecated public void setETH(boolean extendedTradingHours)
TradeBase.setExtendedTradingHours(boolean) instead.extendedTradingHours - true if last trade was in extended trading hours.Copyright © 2002–2023 Devexperts LLC. All rights reserved.