public class TradeETH extends TradeBase
TradeETH event has the following properties:
eventSymbol - symbol of this event;
eth - true when last trade was in extended trading hours;
time - time 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 volume traded for a day.
TradeETH event defines last trade Price and DayVolume
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 ETH property set to false. Afterwards, during RTH, TradeETH event is not
updated and retains information about the last trade and volume of the pre market trading session.
When the first trade of ETH happens, then TradeETH event is generated with ETH 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 of the pre and post market trading session
(excluding the volume of a regular trading session).
Note, that during per and post market sessions, Trade event also updates, but only its
DayVolume property changes to reflect the overall official volume 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.
TradeETH
DayVolume to zero in preparation to the next day's pre-market trading session
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 TradeETH.isETH method to figure out
which trading session had the most recent trade. The following piece of 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.isETH() ? 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 ETH flag is false and a regular
Trade.getPrice is used.
TradeETH and TradeETH&X
for regional exchange extended trade hours.
ETH 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.| 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()
Returns
true when last trade was in extended trading hours. |
void |
setETH(boolean eth)
Changes flag as to whether last trade was in extended trading hours.
|
String |
toString()
Returns string representation of this trade event.
|
getDayVolume, getExchangeCode, getPrice, getSize, getTime, setDayVolume, setExchangeCode, setPrice, setSize, setTimegetEventSymbol, setEventSymbolclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEventSymbol, setEventSymbolpublic TradeETH()
public TradeETH(String eventSymbol)
eventSymbol - event symbol.public boolean isETH()
true when last trade was in extended trading hours.true when last trade was in extended trading hours.public void setETH(boolean eth)
eth - flag as to whether last trade was in extended trading hours.Copyright © 2016 Devexperts. All Rights Reserved.