public final class TimeAndSale extends MarketEvent implements TimeSeriesEvent<String>
Trade
events which are supposed to provide snapshot about the current last trade).
Time and Sale events have unique event identifiers
which can be used for later
correction/cancellation processing.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_SEQUENCE |
Constructor and Description |
---|
TimeAndSale()
Creates new time and sale event with default values.
|
TimeAndSale(String eventSymbol)
Creates new time and sale event with the specified event symbol.
|
Modifier and Type | Method and Description |
---|---|
Side |
getAggressorSide()
Returns aggressor side of this time and sale event.
|
double |
getAskPrice()
Returns the current ask price on the market when this time and sale event had occurred.
|
double |
getBidPrice()
Returns the current bid price on the market when this time and sale event had occurred.
|
long |
getEventId()
Returns identifier of this event.
|
char |
getExchangeCode()
Returns exchange code of this time and sale event.
|
String |
getExchangeSaleConditions()
Returns sale conditions provided for this event by data feed.
|
int |
getFlags()
Returns implementation-specific flags.
|
double |
getPrice()
Returns price of this time and sale event.
|
int |
getSequence()
Returns sequence number of this event to distinguish events that has the same
time . |
long |
getSize()
Returns size of this time and sale event.
|
long |
getTime()
Returns timestamp of the original event.
|
boolean |
isCancel()
Returns whether this is a cancellation of a previous event.
|
boolean |
isCorrection()
Returns whether this is a correction of a previous event.
|
boolean |
isExtendedTradingHours()
Returns whether this event represents an extended trading hours sale.
|
boolean |
isNew()
Returns whether this is a new event (not cancellation or correction).
|
boolean |
isSpreadLeg()
Returns whether this event represents a spread leg.
|
boolean |
isValidTick()
Returns whether this event represents a valid intraday tick.
|
void |
setAggressorSide(Side side)
Changes aggressor side of this time and sale event.
|
void |
setAskPrice(double askPrice)
Changes the current ask price on the market when this time and sale event had occurred.
|
void |
setBidPrice(double bidPrice)
Changes the current bid price on the market when this time and sale event had occurred.
|
void |
setCancel()
Marks this event as a cancellation of a previous event.
|
void |
setCorrection()
Marks this is event as a correction of a previous event.
|
void |
setEventId(long eventId)
Changes identifier for this event.
|
void |
setExchangeCode(char exchangeCode)
Changes exchange code of this time and sale event.
|
void |
setExchangeSaleConditions(String exchangeSaleConditions)
Changes sale conditions provided for this event by data feed.
|
void |
setExtendedTradingHours(boolean extendedTradingHours)
Changes whether this event represents an extended trading hours sale.
|
void |
setFlags(int flags)
Changes implementation-specific flags.
|
void |
setNew()
Marks this event as a new event (not cancellation or correction).
|
void |
setPrice(double price)
Changes price of this time and sale event.
|
void |
setSequence(int sequence)
Changes
getSequence() sequence number} of this event. |
void |
setSize(long size)
Changes size of this time and sale event.
|
void |
setSpreadLeg(boolean spreadLeg)
Changes whether this event represents a spread leg.
|
void |
setTime(long time)
Changes timestamp of event in milliseconds.
|
void |
setValidTick(boolean validTick)
Changes whether this event represents a valid intraday tick.
|
String |
toString()
Returns string representation of this time and sale event.
|
getEventSymbol, setEventSymbol
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEventSymbol, setEventSymbol
public static final int MAX_SEQUENCE
public TimeAndSale()
public TimeAndSale(String eventSymbol)
eventSymbol
- event symbol.public long getEventId()
time
and sequence
.
Changing either time or sequence changes event identifier.getEventId
in interface TimeSeriesEvent<String>
public void setEventId(long eventId)
time
and sequence
,
invocation of this method changes time and sequence.
Do not use this method directly.
Change time
and/or sequence
.eventId
- the event identifier.getEventId()
public long getTime()
getTime
in interface TimeSeriesEvent<String>
System.currentTimeMillis()
public void setTime(long time)
time
- timestamp in milliseconds.getTime()
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 this event.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 this time and sale event.public double getPrice()
public void setPrice(double price)
price
- price of this time and sale event.public long getSize()
public void setSize(long size)
size
- size of this time and sale event.public double getBidPrice()
public void setBidPrice(double bidPrice)
bidPrice
- the current bid price on the market when this time and sale event had occurred.public double getAskPrice()
public void setAskPrice(double askPrice)
askPrice
- the current ask price on the market when this time and sale event had occurred.public String getExchangeSaleConditions()
public void setExchangeSaleConditions(String exchangeSaleConditions)
exchangeSaleConditions
- sale conditions.public Side getAggressorSide()
public void setAggressorSide(Side side)
side
- aggressor side of this time and sale event.public boolean isSpreadLeg()
true
if this event represents a spread leg.public void setSpreadLeg(boolean spreadLeg)
spreadLeg
- true
if this event represents a spread leg.public boolean isExtendedTradingHours()
true
if this event represents an extended trading hours sale.public void setExtendedTradingHours(boolean extendedTradingHours)
extendedTradingHours
- true
if this event represents an extended trading hours sale.public boolean isValidTick()
true
if this event represents a valid intraday tick.public void setValidTick(boolean validTick)
validTick
- true
if this event represents a valid intraday tick.public boolean isNew()
true
for newly created time and sale event.true
if this is a new event (not cancellation or correction).public void setNew()
isCancel()
and isCorrection()
false.public boolean isCorrection()
false
for newly created time and sale event.true
if this is a correction of a previous eventpublic void setCorrection()
isNew()
and isCancel()
false.public boolean isCancel()
false
for newly created time and sale event.true
if this is a cancellation of a previous eventpublic void setCancel()
isNew()
and isCorrection()
false.public int getFlags()
public void setFlags(int flags)
flags
- flags.Copyright © 2014 Devexperts. All Rights Reserved.