|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IOrderTracker
Order tracker (normally implemented by IBroker). Allows to get the current state of the order, and attach to the events related to this order.
The order gets physically sent to the broker only after tracker's
submit method is called.
The purpose of splitting order submission from the order preparation
IBroker is to allow user to attach its event handlers and avoid race
conditions what events may start flowing before user is prepared to receive them.
What distinguishes tracker that corresponds to a closed order from the one that
corresponds to an open order, is the orderCompletion property.
For closed orders its not null and gives a convenient summary of the order
final state. Note that for closed orders some brokers may not provide
detailed execution information, but instead provide only final "gross" view.
orderCompletion
being null tells that order has not been completed at the moment when method was called.
By the time it returns, it may already be completed! There are two ways to deal
with this "volatility" that fit different programming styles: event-oriented
processing, and synchronous processing.
To get notified of the order events, application may attach to the tracker's
event source. It is better done before submit() was called, so
that it is guaranteed that no events has been missed.
Then, event-processing code may analyze the message type and content to
monitor the order state changes. Note that history in the tracker
is updated before event is sent by the tracker. This guarantees that
application code sees already updated event history in the event handling code.
Application may choose to wait till the order completes, and then analyze the
completion by looking at orderCompletion and/or history
properties. There are waitForCompletion methods for doing this.
History:
- [06.12.2007] Created (Mike Kroutikov)
| Method Summary | |
|---|---|
void |
cancel()
Cancels this order. |
Order |
getOrder()
Original order that initiated this tracker. |
IEventSource<OrderEvent> |
getOrderEventSource()
Returns event source for the detailed order-related events. |
String |
getVenueAssignedId()
Venue assigned id for this order processing. |
void |
submit()
Submits the order. |
void |
update(Order newOrder)
Updates pending order. |
| Method Detail |
|---|
Order getOrder()
String getVenueAssignedId()
void submit()
IBroker#getOrders()). Events can start flowing
only after submit is called. Therefore, attach all your
event listeners before submitting the order.
Exceptionvoid update(Order newOrder)
newOrder - the order to replace the original one.void cancel()
IEventSource<OrderEvent> getOrderEventSource()
OrderCompletionEvent is fired when
the order is completed (successfully or not). This event is always the last event
fired by broker with respect to this order.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||