public interface TradeEvent
A single event acting on a Trade.
The event may be client generated and received through the TradeListener
interface or it may be
generated by custom code to be sent to the client using the Trade.sendEvent(TradeEvent)
method.
A TradeEvent is created using the Trade
it relates to by calling the Trade.createEvent(String)
method of the appropriate Trade instance.
A TradeEvent typically represents a message received from the client or sent by the server. A
message contains a set of fields and values which can be accessed using the
getFields()
method.
A Typical message represented by a TradeEvent might be:
Field | Value |
MsgType | Execute |
MsgVersion | 5 |
RequestId | 123 |
TradeId | 456789 |
PriceVersion | 3 |
BuySell | BUY |
Price | 1.9950 |
Modifier and Type | Method and Description |
---|---|
void |
addField(java.lang.String name,
int value)
Adds a field to this TradeEvent.
|
void |
addField(java.lang.String name,
java.lang.String value)
Adds a field to this TradeEvent.
|
void |
addLegAction(LegAction action)
Adds a leg action to the trade.
|
EventSource |
getEventSource()
Returns the source of this event: CLIENT, SERVER, or RESTORE
|
java.lang.String |
getField(java.lang.String name)
Gets the value of a field in this TradeEvent.
|
java.util.Map<java.lang.String,java.lang.String> |
getFields()
Gets the fields of this TradeEvent as a Map
|
java.util.List<LegAction> |
getLegActions()
Gets the leg actions associated with this event.
|
java.lang.String |
getSource()
Gets the source of this TradeEvent.
|
Trade |
getTrade()
Gets the
Trade object that this TradeEvent belongs to. |
java.lang.String |
getType()
Gets the type of the TradeEvent.
|
boolean |
isType(java.lang.String type)
Confirms that the TradeEvent is of a certain type
|
void |
setInitialTimestamp(java.util.Date date)
Sets LTY_INIT_TS field to this TradeEvent.
|
void |
setRestorationId(java.lang.String restorationId)
Sets an id that will identify a trade restoration message.
|
java.lang.String getType()
boolean isType(java.lang.String type)
type
- The trade type to check.Trade getTrade()
Trade
object that this TradeEvent belongs to.
As long as your code executes on the thread in which TradeListener.receiveEvent(TradeEvent)
was called, the Trade
's fields will not be updated by subsequent events, though its state may change.Trade
object.java.lang.String getSource()
void setRestorationId(java.lang.String restorationId)
restorationId
- the system identifier for the trade.TradeChannel.setTradeChannelListener(TradeChannelListener)
,
Trade.createRestoreEvent(String)
void addField(java.lang.String name, java.lang.String value)
name
- The name of the field to add.value
- The value of the field to add.void addField(java.lang.String name, int value)
name
- The name of the field to add.value
- The value of the field to add.void setInitialTimestamp(java.util.Date date)
date
- The time the LTY_INIT_TS field will be set to.java.lang.String getField(java.lang.String name)
name
- The name of the field.void addLegAction(LegAction action)
action
- The leg action.java.util.List<LegAction> getLegActions()
TradeListener
interface and needs to
determine what leg actions the client has performed on the trade.java.util.Map<java.lang.String,java.lang.String> getFields()
EventSource getEventSource()
Please send bug reports and comments to Caplin support