com.apama.oms
Event OrderMonitorStateContainer


The OrderMonitorStateContainer is an event helper object that allows applications to monitor the state of orders in their application.

A single OrderMonitorStateContainer object must be created per-order that is being monitored.

In order to use the OrderMonitorStateContainer, the #monitorOrder() action must be called with the com.apama.oms.NewOrder object that is to be monitored.

In the following code extract, an action is created that will listen for any NewOrders being created. When an appropriate NewOrder event has been received a new OrderMonitorStateContainer object is created, and #monitorOrder() is called to start monitoring the state of that order. In this example, a callback action is also registered with the OrderMonitorStateContainer which will be called whenever the state of the order changes.

action handleNewOrders() {
com.apama.oms.NewOrder newOrder;
on all com.apama.oms.NewOrder(serviceId="FIX", marketId="CNX"):newOrder {
com.apama.oms.OrderMonitorStateContainer mon :=
new com.apama.oms.OrderMonitorStateContainer;
mon.monitorOrder(newOrder, false);
mon.addUpdateListener("myCallback", monitorHandler);
}
}

// This action will be called every time the order state changes
action monitorHandler(integer id, com.apama.oms.OrderState state) {
if( state.isFinal() ) then {
log "Order Complete!";
}
}
There are a number of actions provided by the OrderMonitorStateContainer event object that allow you to query the current state of the order being monitored. These are also available directly from the com.apama.oms.#OrderState object returned in the update handler callback. These are split into two categories, those prefixed with "is*()" and those prefixed with "just*()". The "is*()" set of actions indicate whether or not the order is currently in that state. Whereas the "just*()" set of actions determine the order state in the most recent update only. For example, justAcknowledged() will return true immediately after the order is acknowledged, but not on any subsequent updates, whereas isAcknowledged() will always return true after the order has been acknowledged.

Note: This event helper object cannot be routed.
Since:
CMF 1.1.0
Version:
10.0
See Also:
com.apama.oms.OrderPublisherStateContainer - This event helper is used to publish/submit new orders in an application
com.apama.oms.OrderReceiverStateContainer - This event helper is used to receive orders in an application and act like an execution venue
Routes:
com.apama.oms.OrderMonitorFinished - 
Listens:
com.apama.oms.AmendOrder - 
com.apama.oms.CancelOrder - 
com.apama.oms.OrderMonitorFinished - 
com.apama.oms.OrderUpdate - 

Action Summary
 string_toString()

Returns a formatted string of the current order state.
 voidaddUpdateListener(string name, action<integer, com.apama.oms.OrderState > callback)

Used to add an update handler callback with the OrderMonitorStateContainer. The callback action provided will be called each time the order being monitored is updated.
 floatgetAvgPrice()

Returns the average price of execution so far.
 stringgetBookId()

Returns the Book Id.
 stringgetBrokerId()

Returns the Broker Id.
 floatgetCash()

Returns the total money executed so far.
 stringgetDeskId()

Returns the desk Id.
 stringgetExchangeId()

Returns the exchange Id.
 dictionary<string, string >getExtraParams()

Returns the current order extraParams.
 stringgetFirewallServiceId()

Returns the service ID to use with the firewall.
 stringgetFirewallTargetServiceId()

Returns the target service associated with the firewall.
 floatgetIssueTime()

Returns time at which the order was issued.
 integergetLargestExposedQuantity()

Returns largest exposed quantity.
 floatgetLastCommissionPaid()

Returns the commission paid on last trade.
 stringgetLastCounterPartyId()

Returns the counterparty for last trade.
 floatgetLastPriceExecuted()

Returns price of the last trade.
 integergetLastQtyExecuted()

Returns the most recent trade quantity.
 floatgetLastTradeTime()

Returns the time of last trade.
 stringgetLastTradeType()

Returns the type of last trade.
 stringgetMarketId()

Returns the Market Id.
 stringgetMarketOrderId()

Returns the market order ID.
 integergetMonitorId()

Returns the unique identifier of this instance of the OrderMonitorStateContainer.
 stringgetOptionalExtraParams(string param)

This action gets the provided parameter from the set of optional extra parameters.
 stringgetOrderId()

Returns the order ID.
 stringgetOriginatorServiceInstance()

Returns the service instance of the originator.
 stringgetOriginatorServiceName()

Returns the service name of the originator.
 stringgetOriginatorServiceType()

Returns the service type of the originator.
 stringgetOwnerId()

Returns the Owner Id.
 dictionary<string, string >getPreviousExtraParams()

Returns extraParams before the most recent change.
 integergetPreviousLargestExposedQuantity()

Returns previous largest exposed quantity (before the most recent update).
 floatgetPreviousPrice()

Returns order price before the most recent change.
 integergetPreviousQtyExecuted()

Returns quantity executed before the most recent change.
 integergetPreviousQtyRemaining()

Returns quantity remaining before the most recent change.
 integergetPreviousQuantity()

Returns order total quantity before the most recent change.
 dictionary<string, string >getPreviousUserSetExtraParams()

Returns user's extraParams before the most recent change; blank if extraParams have been unchanged.
 floatgetPreviousUserSetPrice()

Returns user set price before the most recent amend was applied.
 integergetPreviousUserSetQuantity()

Returns user set quantity before the most recent amend was applied.
 floatgetPrice()

Returns the order price.
 integergetQtyExecuted()

Returns the quantity executed so far.
 integergetQtyRemaining()

Returns the remaining order quantity.
 integergetQuantity()

Returns the order quantity.
 dictionary<string, string >getRejectedExtraParams()

Returns the most recent rejected extraParams.
 floatgetRejectedPrice()

Returns the most recent rejected price.
 integergetRejectedQuantity()

Returns the most recent rejected quantity.
 stringgetReservationId()

Returns the Reservation Id.
 stringgetServiceId()

Returns the service ID for the order.
 stringgetSide()

Returns the order side (BUY/SELL).
 stringgetStatus()

Returns the most recent order status message.
 com.apama.oms.NewOrdergetSubmittedNewOrder()

Returns the submitted NewOrder.
 stringgetSymbol()

Returns the order symbol.
 stringgetType()

Returns the order type (e.g. LIMIT, MARKET, IOC, etc).
 dictionary<string, string >getUserSetExtraParams()

Returns any extra parameters that the User has set.
 floatgetUserSetPrice()

Returns the current user set price (should equal current price unless there is a pending amend).
 integergetUserSetQuantity()

Returns the current user set quantity (should equal current quantity unless there is a pending amend).
 booleanhasOptionalExtraParam(string param)

This action checks whether or not the provided parameter exists in the set of optional extra parameters.
 booleanisAcknowledged()

Returns whether or not the order has been acknowledged by the market.
 booleanisAmending()

Returns whether or not an amend request is currently pending.
 booleanisBuy()

Returns whether or not this is a buy-side order.
 booleanisCancelled()

Returns whether or not the order has been cancelled.
 booleanisCancelling()

Returns whether or not a cancel request is currently pending.
 booleanisExternallyModified()

Returns whether or not the order has been modified by the market.
 booleanisFinal()

Returns whether or not the order is in a final state.
 booleanisInMarket()

Returns whether or not the order is in market.
 booleanisLargestExposedQuantityModified()

Returns whether or not the largest exposed quantity has been changed.
 booleanisModifiable()

Returns whether or not the order can be modified.
 booleanisOrderChangeRejected()

Returns whether or not the requested change (amend/cancel) was rejected.
 booleanisSell()

Returns whether or not this is a sell-side order.
 booleanisSent()

Returns whether or not the order has been sent to the market.
 booleanisUnknownState()

Returns whether or not the order is in an unknown state.
 booleanisUsingReservation()

Returns whether or not Reservation is being used.
 booleanisViaFirewall()

Returns whether or not the firewall is being used.
 booleanisVisible()

Returns whether or not the order is currently visible.
 booleanjustAcknowledged()

Returns whether or not the order has just been acknowledged.
 booleanjustAmendApplied()

Returns whether or not the most recent operation was an amend being applied.
 booleanjustAmendCommitted()

Returns whether or not the most recent change was an amend being committed.
 booleanjustAmendRejected()

Returns whether or not an amend has just been rejected.
 booleanjustCancelApplied()

Returns whether or not a cancel has just been requested.
 booleanjustCancelCommitted()

Returns whether or not a cancel has just been committed.
 booleanjustCancelRejected()

Returns whether or not a request to cancel the order has just been rejected.
 booleanjustExecuted()

Returns whether or not the last update was a trade.
 booleanjustFinal()

Returns whether or not the order has just become final.
 booleanjustNew()

Returns whether or not the order has just been placed.
 booleanjustRejected()

Returns whether or not the order has just been rejected by the firewall.
 booleanjustSoftRejected()

Returns whether or not the order has just been soft-rejected.
 voidmonitorOrder(com.apama.oms.NewOrder order, boolean logInfoAsDebug)

This action is used to initialise an instance of the OrderMonitorStateContainer. It establishes handlers for any amends, cancels, or updates the order. When any changes occur, any registered update handler callbacks will be called.
 voidremoveUpdateListener(string name)

Used to remove a registered update handler callback from the OrderMonitorStateContainer.
 voidstopMonitoring()

This action stops monitoring the order.
 
Action Detail

_toString

string _toString()
Returns a formatted string of the current order state.
Returns:
Returns a formatted string of the current order state

addUpdateListener

void addUpdateListener(string name, action<integer, com.apama.oms.OrderState > callback)
Used to add an update handler callback with the OrderMonitorStateContainer. The callback action provided will be called each time the order being monitored is updated.
Parameters:
name - An identifier for the callback. This is required to allow the callback to removed at a later date.
callback - The callback action, which takes an integer (this monitors ID) and an OrderState object (the state of the order at time of calling).
See Also:
com.apama.oms.OrderMonitorStateContainer#removeUpdateListener() - The action used to remove a registered update handler callback.

getAvgPrice

float getAvgPrice()
Returns the average price of execution so far.
Returns:
Returns the average price of execution so far, false otherwise

getBookId

string getBookId()
Returns the Book Id.
Returns:
Returns the Book Id

getBrokerId

string getBrokerId()
Returns the Broker Id.
Returns:
Returns the Broker Id

getCash

float getCash()
Returns the total money executed so far.
Returns:
Returns the total money executed so far

getDeskId

string getDeskId()
Returns the desk Id.
Returns:
Returns the desk Id

getExchangeId

string getExchangeId()
Returns the exchange Id.
Returns:
Returns the exchange Id

getExtraParams

dictionary<string, string > getExtraParams()
Returns the current order extraParams.
Returns:
Returns the current order extraParams

getFirewallServiceId

string getFirewallServiceId()
Returns the service ID to use with the firewall.
Returns:
Returns the service ID to use with the firewall

getFirewallTargetServiceId

string getFirewallTargetServiceId()
Returns the target service associated with the firewall.
Returns:
Returns the target service associated with the firewall

getIssueTime

float getIssueTime()
Returns time at which the order was issued.
Returns:
Returns time at which the order was issued

getLargestExposedQuantity

integer getLargestExposedQuantity()
Returns largest exposed quantity.
Returns:
Returns largest exposed quantity

getLastCommissionPaid

float getLastCommissionPaid()
Returns the commission paid on last trade.
Returns:
Returns the commission paid on last trade

getLastCounterPartyId

string getLastCounterPartyId()
Returns the counterparty for last trade.
Returns:
Returns the counterparty for last trade

getLastPriceExecuted

float getLastPriceExecuted()
Returns price of the last trade.
Returns:
Returns price of the last trade

getLastQtyExecuted

integer getLastQtyExecuted()
Returns the most recent trade quantity.
Returns:
Returns the most recent trade quantity

getLastTradeTime

float getLastTradeTime()
Returns the time of last trade.
Returns:
Returns the time of last trade

getLastTradeType

string getLastTradeType()
Returns the type of last trade.
Returns:
Returns the type of last trade

getMarketId

string getMarketId()
Returns the Market Id.
Returns:
Returns the Market Id

getMarketOrderId

string getMarketOrderId()
Returns the market order ID.
Returns:
Returns the market order ID

getMonitorId

integer getMonitorId()
Returns the unique identifier of this instance of the OrderMonitorStateContainer.
Returns:
Returns the unique identifier of this instance of the OrderMonitorStateContainer

getOptionalExtraParams

string getOptionalExtraParams(string param)
This action gets the provided parameter from the set of optional extra parameters.
Parameters:
param - The extraParams key to look for
Returns:
Returns the value of the optional extraparam provided, or an empty string if the parameter was not found
See Also:
com.apama.oms.OrderMonitorStateContainer#hasOptionalExtraParam() - This action checks whether or not parameter provided exists in the set of optional extraparams

getOrderId

string getOrderId()
Returns the order ID.
Returns:
Returns the order ID

getOriginatorServiceInstance

string getOriginatorServiceInstance()
Returns the service instance of the originator.
Returns:
Returns the service instance of the originator

getOriginatorServiceName

string getOriginatorServiceName()
Returns the service name of the originator.
Returns:
Returns the service name of the originator

getOriginatorServiceType

string getOriginatorServiceType()
Returns the service type of the originator.
Returns:
Returns the service type of the originator

getOwnerId

string getOwnerId()
Returns the Owner Id.
Returns:
Returns the Owner Id

getPreviousExtraParams

dictionary<string, string > getPreviousExtraParams()
Returns extraParams before the most recent change.
Returns:
Returns extraParams before the most recent change

getPreviousLargestExposedQuantity

integer getPreviousLargestExposedQuantity()
Returns previous largest exposed quantity (before the most recent update).
Returns:
Returns previous largest exposed quantity (before the most recent update)

getPreviousPrice

float getPreviousPrice()
Returns order price before the most recent change.
Returns:
Returns order price before the most recent change

getPreviousQtyExecuted

integer getPreviousQtyExecuted()
Returns quantity executed before the most recent change.
Returns:
Returns quantity executed before the most recent change

getPreviousQtyRemaining

integer getPreviousQtyRemaining()
Returns quantity remaining before the most recent change.
Returns:
Returns quantity remaining before the most recent change

getPreviousQuantity

integer getPreviousQuantity()
Returns order total quantity before the most recent change.
Returns:
Returns order total quantity before the most recent change

getPreviousUserSetExtraParams

dictionary<string, string > getPreviousUserSetExtraParams()
Returns user's extraParams before the most recent change; blank if extraParams have been unchanged.
Returns:
Returns user's extraParams before the most recent change; blank if extraParams have been unchanged.

getPreviousUserSetPrice

float getPreviousUserSetPrice()
Returns user set price before the most recent amend was applied.
Returns:
Returns user set price before the most recent amend was applied

getPreviousUserSetQuantity

integer getPreviousUserSetQuantity()
Returns user set quantity before the most recent amend was applied.
Returns:
Returns user set quantity before the most recent amend was applied

getPrice

float getPrice()
Returns the order price.
Returns:
Returns the order price

getQtyExecuted

integer getQtyExecuted()
Returns the quantity executed so far.
Returns:
Returns the quantity executed so far

getQtyRemaining

integer getQtyRemaining()
Returns the remaining order quantity.
Returns:
Returns the remaining order quantity

getQuantity

integer getQuantity()
Returns the order quantity.
Returns:
Returns the order quantity

getRejectedExtraParams

dictionary<string, string > getRejectedExtraParams()
Returns the most recent rejected extraParams.
Returns:
Returns the most recent rejected extraParams

getRejectedPrice

float getRejectedPrice()
Returns the most recent rejected price.
Returns:
Returns the most recent rejected price

getRejectedQuantity

integer getRejectedQuantity()
Returns the most recent rejected quantity.
Returns:
Returns the most recent rejected quantity

getReservationId

string getReservationId()
Returns the Reservation Id.
Returns:
Returns the Reservation Id

getServiceId

string getServiceId()
Returns the service ID for the order.
Returns:
Returns the service ID for the order

getSide

string getSide()
Returns the order side (BUY/SELL).
Returns:
Returns the order side (BUY/SELL)

getStatus

string getStatus()
Returns the most recent order status message.
Returns:
Returns the most recent order status message

getSubmittedNewOrder

com.apama.oms.NewOrder getSubmittedNewOrder()
Returns the submitted NewOrder.
Returns:
Returns the submitted NewOrder

getSymbol

string getSymbol()
Returns the order symbol.
Returns:
Returns the order symbol

getType

string getType()
Returns the order type (e.g. LIMIT, MARKET, IOC, etc).
Returns:
Returns the order type (e.g. LIMIT, MARKET, IOC, etc)

getUserSetExtraParams

dictionary<string, string > getUserSetExtraParams()
Returns any extra parameters that the User has set.
Returns:
Returns any extra parameters that the User has set

getUserSetPrice

float getUserSetPrice()
Returns the current user set price (should equal current price unless there is a pending amend).
Returns:
Returns the current user set price

getUserSetQuantity

integer getUserSetQuantity()
Returns the current user set quantity (should equal current quantity unless there is a pending amend).
Returns:
Returns the current user set quantity

hasOptionalExtraParam

boolean hasOptionalExtraParam(string param)
This action checks whether or not the provided parameter exists in the set of optional extra parameters.
Parameters:
param - The extraParams key to look for
Returns:
Returns true if the parameter exists, false otherwise
See Also:
com.apama.oms.OrderMonitorStateContainer#getOptionalExtraParams() - This action returns the value of the optional extra parameter provided

isAcknowledged

boolean isAcknowledged()
Returns whether or not the order has been acknowledged by the market.
Returns:
Returns true if the order has been acknowledged by the market, false otherwise

isAmending

boolean isAmending()
Returns whether or not an amend request is currently pending.
Returns:
Returns true if an amend request is currently pending, false otherwise

isBuy

boolean isBuy()
Returns whether or not this is a buy-side order.
Returns:
Returns true if this is a buy-side order, false otherwise

isCancelled

boolean isCancelled()
Returns whether or not the order has been cancelled.
Returns:
Returns true if the order has been cancelled, false otherwise

isCancelling

boolean isCancelling()
Returns whether or not a cancel request is currently pending.
Returns:
Returns true if a cancel request is currently pending, false otherwise

isExternallyModified

boolean isExternallyModified()
Returns whether or not the order has been modified by the market.
Returns:
Returns true if the order has been modified by the market, false otherwise

isFinal

boolean isFinal()
Returns whether or not the order is in a final state.
Returns:
Returns true if the order is in a final state, false otherwise

isInMarket

boolean isInMarket()
Returns whether or not the order is in market.
Returns:
Returns true if the order is in market, false otherwise

isLargestExposedQuantityModified

boolean isLargestExposedQuantityModified()
Returns whether or not the largest exposed quantity has been changed.
Returns:
Returns true if the largest exposed quantity has been changed, false otherwise

isModifiable

boolean isModifiable()
Returns whether or not the order can be modified.
Returns:
Returns true if the order can be modified, false otherwise

isOrderChangeRejected

boolean isOrderChangeRejected()
Returns whether or not the requested change (amend/cancel) was rejected.
Returns:
Returns true if the requested change (amend/cancel) was rejected, false otherwise

isSell

boolean isSell()
Returns whether or not this is a sell-side order.
Returns:
Returns true if this is a sell-side order, false otherwise

isSent

boolean isSent()
Returns whether or not the order has been sent to the market.
Returns:
Returns true if the order has been sent to the market, false otherwise

isUnknownState

boolean isUnknownState()
Returns whether or not the order is in an unknown state.
Returns:
Returns true if the order is in an unknown state, false otherwise

isUsingReservation

boolean isUsingReservation()
Returns whether or not Reservation is being used.
Returns:
Returns true if Reservation is being used

isViaFirewall

boolean isViaFirewall()
Returns whether or not the firewall is being used.
Returns:
Returns true if the firewall is being used, false otherwise

isVisible

boolean isVisible()
Returns whether or not the order is currently visible.
Returns:
Returns true if the order is currently visible, false otherwise

justAcknowledged

boolean justAcknowledged()
Returns whether or not the order has just been acknowledged.
Returns:
Returns true if the order has just been acknowledged, false otherwise

justAmendApplied

boolean justAmendApplied()
Returns whether or not the most recent operation was an amend being applied.
Returns:
Returns true if the most recent operation was an amend being applied, false otherwise

justAmendCommitted

boolean justAmendCommitted()
Returns whether or not the most recent change was an amend being committed.
Returns:
Returns true if the most recent change was an amend being committed, false otherwise

justAmendRejected

boolean justAmendRejected()
Returns whether or not an amend has just been rejected.
Returns:
Returns true if an amend has just been rejected, false otherwise

justCancelApplied

boolean justCancelApplied()
Returns whether or not a cancel has just been requested.
Returns:
Returns true if a cancel has just been requested, false otherwise

justCancelCommitted

boolean justCancelCommitted()
Returns whether or not a cancel has just been committed.
Returns:
Returns true if a cancel has just been committed, false otherwise

justCancelRejected

boolean justCancelRejected()
Returns whether or not a request to cancel the order has just been rejected.
Returns:
Returns true if a request to cancel the order has just been rejected, false otherwise

justExecuted

boolean justExecuted()
Returns whether or not the last update was a trade.
Returns:
Returns true if the last update was a trade, false otherwise

justFinal

boolean justFinal()
Returns whether or not the order has just become final.
Returns:
Returns true if the order has just become final, false otherwise

justNew

boolean justNew()
Returns whether or not the order has just been placed.
Returns:
Returns true if the order has just been placed, false otherwise

justRejected

boolean justRejected()
Returns whether or not the order has just been rejected by the firewall.
Returns:
Returns true if the order has just been rejected by the firewall, false otherwise

justSoftRejected

boolean justSoftRejected()
Returns whether or not the order has just been soft-rejected.
Returns:
Returns true if the order has just been soft-rejected, false otherwise

monitorOrder

void monitorOrder(com.apama.oms.NewOrder order, boolean logInfoAsDebug)
This action is used to initialise an instance of the OrderMonitorStateContainer. It establishes handlers for any amends, cancels, or updates the order. When any changes occur, any registered update handler callbacks will be called.
Parameters:
order - The com.apama.oms.NewOrder to be monitored
logInfoAsDebug - Allows INFO-level logging to be suppressed to DEBUG output
See Also:
com.apama.oms.OrderMonitorStateContainer#addUpdateListener() - The action used to register an update handler callback with the monitor
com.apama.oms.OrderMonitorStateContainer#stopMonitoring() - The action used to stop monitoring of the order

removeUpdateListener

void removeUpdateListener(string name)
Used to remove a registered update handler callback from the OrderMonitorStateContainer.
Parameters:
name - The name of the callback to remove, which was provided when the callback was added
See Also:
com.apama.oms.OrderMonitorStateContainer#addUpdateListener() - The action used to register an update handler callback with the monitor

stopMonitoring

void stopMonitoring()
This action stops monitoring the order.
Routes:
com.apama.oms.OrderMonitorFinished -