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;
size - size of the last trade;
dayVolume - total extended trading hours volume traded for a day;
dayTurnover - total extended trading hours turnover traded for a day;
tickDirection - tick direction of the last trade;
extendedTradingHours - whether the last trade was in extended trading hours.
TradeETH event defines last trade price, size,
dayVolume and dayTurnover
for trades that happen during extended trading hours. 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 per and post market sessions, Trade event also updates, but only its
dayVolume 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 / dayVolume;
TradeETH
dayVolume to zero and dayTurnover to NaN
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 TradeBase.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.
|
getDayTurnover, getDayVolume, getExchangeCode, getPrice, getSequence, getSize, getTickDirection, getTime, getTimeNanoPart, getTimeNanos, getTimeSequence, isExtendedTradingHours, setDayTurnover, setDayVolume, setExchangeCode, setExtendedTradingHours, setPrice, setSequence, setSize, 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 © 2017 Devexperts. All Rights Reserved.