public class EditStrategyRequest extends MotifTrade
An EditStrategyRequest is a domain object that represents a front end request to edit a previously submitted single order or multi-order strategy. These requests are generally made by bringing up a previously submitted order or strategy from the blotter, and submitting a request to edit it.
You do not need to construct instances of this class yourself. Instances of
this class are created by the FX Integration API in response to edit order requests
from the client, and passed to your implementation of EditStrategyListenerFactory.createEditStrategyListener(EditStrategyRequest)
.
trade
Modifier and Type | Method and Description |
---|---|
ClientCloseSentResponder |
getClientCloseSentResponder()
Returns the responder for sending events from the ClientCloseSent state
|
EditableResponder |
getEditableResponder()
Returns the responder for sending events from the Editable state
|
EditOpenSentResponder |
getEditOpenSentResponder()
Returns the responder for sending events from the EditOpenSent state
|
EditPendingResponder |
getEditPendingResponder()
Returns the responder for sending events from the EditPending state
|
String |
getOrderID()
Gets the order ID from the first order in the strategy the user wants to
edit.
|
SavingResponder |
getSavingResponder()
Returns the responder for sending events from the Saving state
|
String |
toString() |
createEvent, getCurrentState, getField, getRequestID, getTradeChannelSubject, getUsername, sendEvent
public String getOrderID()
Gets the order ID from the first order in the strategy the user wants to edit.
You are responsible for looking up the strategy the order belongs to and performing the required steps to lock that strategy for editing, if your trading system requires it.
public ClientCloseSentResponder getClientCloseSentResponder()
Returns the responder for sending events from the ClientCloseSent state
If the client attempts to close the edit order ticket, because they are no longer interested in submitting any more changes to the strategy and its orders. They will send a ClientClose message, transition the state of the trade model to ClientCloseSent.
At this point you will be called back on EditStrategyListener.onClientClose(ClientCloseEvent)
.
You should then use this responder to acknowledge the the ClientClose message by calling ClientCloseSentResponder.sendClientCloseAck(com.caplin.motif.fx.trading.orders.edit.event.ClientCloseAckEvent)
Typically the server should release any locks on related resources to the Strategy, before sending the ClientCloseAck
public EditableResponder getEditableResponder()
Returns the responder for sending events from the Editable state
Typically in the Editable state, the server waits for client events as the client makes changes to the Strategy. But there are cases such as internal errors, or the Strategy has changed in the backend trading system whilst the client was making their changes, where we must use this responder to notify the client.
If the strategy changed whilst the client was editing the order, the use EditableResponder.sendRefresh(com.caplin.motif.fx.trading.orders.edit.event.RefreshEvent)
to notify the client with the new details of the Strategy
If an error occured, or something else has ocurred that prevents the client from making any changes to the order, then use BaseErrorResponder.sendError(com.caplin.motif.fx.trading.ErrorEvent)
to notify the client
public EditPendingResponder getEditPendingResponder()
Returns the responder for sending events from the EditPending state
With some backend trading systems it may take some time before all the locks and necessary resources are obtained before a strategy can be edited. When the client is finally able to edit the order, then we want to move to the Editable state.
Use this responder and send the EditAccept event by calling EditPendingResponder.sendEditAccept(com.caplin.motif.fx.trading.orders.edit.event.EditAcceptEvent)
public EditOpenSentResponder getEditOpenSentResponder()
Returns the responder for sending events from the EditOpenSent state
This responder is the first one you should use after you receive the EditStrategyListener.onEditOpen(com.caplin.motif.fx.trading.orders.edit.event.EditOpenEvent)
callback. You should use it to send an acknowledgement to the client that you recieved the trade request by calling EditOpenSentResponder.sendEditOpenAck(com.caplin.motif.fx.trading.orders.edit.event.EditOpenAckEvent)
This is typically done immediately on receiving the event, before submitting anything to the trading system.
public SavingResponder getSavingResponder()
Returns the responder for sending events from the Saving state
Once the client wants to save the changes that they have made the strategy, you
will recieve a callback on EditStrategyListener.onSave(com.caplin.motif.fx.trading.orders.edit.event.SaveEvent)
Once these changes are persisted in the backend trading system you will need to notify client in one of two ways, either to notify the client that they can continue making further changes, or notify the client that the changes have been made, and that they can no longer make any more changes to the strategy (ie. they will be required to open a new edit strategy ticket)
If the changes cannot be persisted then as normal send the error message, but if there is a validation error with one of the changes requested, then specifically send the ValidationError event
To notify the client that the changes were successful and they can continue to make more changes use SavingResponder.sendSaveAccept(com.caplin.motif.fx.trading.orders.edit.event.SaveAcceptEvent)
To notify the client that the changes were successful but they can no longer make any more changes to the strategy, use SavingResponder.sendSaveAndComplete(com.caplin.motif.fx.trading.orders.edit.event.SaveAndCompleteEvent)
If there was a validation error contained in the changes the client wanted to make, then use SavingResponder.sendValidationError(com.caplin.motif.fx.trading.orders.edit.event.ValidationErrorEvent)
to notify the client
public String toString()
toString
in class MotifTrade
Copyright © 2015 Caplin Systems.