Class EditStrategyRequest
- java.lang.Object
-
- com.caplin.motif.UserTrade
-
- com.caplin.motif.fx.trading.orders.edit.EditStrategyRequest
-
public class EditStrategyRequest extends UserTrade
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)
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientCloseSentResponder
getClientCloseSentResponder()
Returns the responder for sending events from the ClientCloseSent stateEditableResponder
getEditableResponder()
Returns the responder for sending events from the Editable stateEditOpenSentResponder
getEditOpenSentResponder()
Returns the responder for sending events from the EditOpenSent stateEditPendingResponder
getEditPendingResponder()
Returns the responder for sending events from the EditPending stateString
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 stateString
toString()
-
Methods inherited from class com.caplin.motif.UserTrade
getBackingTrade, getExecutorService, getRequestID, getUsername
-
-
-
-
Method Detail
-
getOrderID
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.
- Returns:
- The order ID from the first order in the strategy that the user wants to edit. This value is retrieved from the L1_OrderID field.
-
getClientCloseSentResponder
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 callingClientCloseSentResponder.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
- Returns:
- The ClientCloseSent responder.
-
getEditableResponder
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 StrategyIf an error occurred, or something else has occurred 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- Returns:
- The Editable responder.
-
getEditPendingResponder
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)
- Returns:
- The EditPending responder.
-
getEditOpenSentResponder
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 received the trade request by callingEditOpenSentResponder.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.
- Returns:
- The EditOpenSent responder.
-
getSavingResponder
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 receive 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- Returns:
- The Saving responder.
-
-