Edit Strategy Messages

This documentation is for FX Professional 2.18 and earlier. From version 2.19 (2 Jun 2019), FX Professional requires back end adapters to implement the FX Integration API 3. For documentation on FX Integration API 3 messages, see FX Integration API.

The following trade model and set of message describe the fields and values required to successfully edit an existing strategy using the FX Professional Motif 2. A strategy comprises of all the legs of the original order. For the purpose of this spec, the order in it’s entirety is referred to as the strategy, and each of its legs are referred to as an order in the strategy.

For each of the messages below, [c] denotes that the message is sent by the client, [s] denotes that the message is sent by the server.

Architecture

For the frontend client, the trade model library handles the processing of these messages. Streamlinkis used to send messages to the backend. For Edit Strategy there are three messages that the client can send:

  • the first is a message containing the order ID of the first order in the strategy to be modified, this allows the server to identify the entire strategy that the order belongs to and send back the details of the strategy.

  • the second message is the save message, which contains all the modifications made to the strategy that the client wants to save. Note that in response to the save message the server has two options:

    • if you want to support multiple save operations, the server can send the "SaveAccept" event to move the client back to the Editable state. This could be useful if your workflow involved editing each order in a strategy individually, for example.

    • if you only want the client to have one opportunity to save, the server can send the "SaveAndComplete" event to move the client to the Complete state, which is a terminal state.

  • the third is the complete message, which tells the server that the client is done making any more changes to the strategy. Note that this message is not required if the server responded to the initial Save event by sending the SaveAndComplete event, as described above.

For the backend adapters, the FXIntegrationAPI consumes the client messages. The request for Edit Strategy are handled by an adapter that instantiates the FXOrdersAdapter object and registers an EditStrategyListener (See the FX Integration API documentation for more information). The Edit Strategy is handled by the FX Integration API using the EditStrategyRequest object. The object contains the Responders and Events required to send messages from the server side, in order to transition the trade model to the final state.

Trade Model State Diagram

EditStrategy

Blue arrows denote client messages and timeout messages, green arrows denote messages sent by the server.

In addition to the states shown above, all thats that are not the initial and complete state, can transition to the error state (see common messages for the error message)

EditOpen Message [c]

This is the message the client sends in order to submit a request to cancel an order

Field Name Description Example

RequestID

A unique client generated ID for this edit operation

112314243333

MsgType

The transition that the client wants to make in the state model

EditOpen

L1_OrderID

The ID of the first leg in the strategy that is to be edited

1374143013248_1

EditOpenAck Message [s]

This is the message that the server sends to acknowledge that the EditOpen message has been received by the server

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

EditOpenAck

EditAccept Message [s]

This is the message that the server sends to tell the client that they may start editing the strategy. Typically the server may have to obtain locks or mark a strategy as being edited or something similar to this effect before a client can start editing a strategy. This message is also used by the server to tell the clients which fields on the strategy can be edited, for example it is normal to be able to edit the target rate and amount but perhaps not the currency pair or order IDs.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

EditAccept

This message also includes the strategy fields.

EditClose Message [c]

This is the message that client sends to tell the client that it no longer wants to edit the order, before the order has reached the Editable state. Typically a lock may take a while to obtain, by this time the client may no longer be interested in editing the order and may close the ticket.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the client wants to make in the state model

EditClose

Refresh Message [s]

This is the message that the server can send to the client if the strategy has changed whilst the client is editing an order. Note: if this scenario occurs you may want to simply terminate the edit operation by sending an Error transition instead of Refresh, because in many cases the edit operation is no longer valid. For example, if a user is attempting to change the target rate on a working order and it is filled, it is no longer possible to edit that order. A Refresh is therefore unhelpful to the client.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

Refresh

This message also includes the strategy fields.

Save Message [c]

This is the message that the client sends that contains all the edits made to the strategy that they would like to save.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the client wants to make in the state model

Save

This message also includes the strategy fields.

SaveAccept Message [s]

This is the message that the server sends which tells the client that the edits received on the Save message have been succesfully executed. It returns the trademodel to the Editable state to allow the client to make further edits.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

SaveAccept

This message also includes the strategy fields.

SaveAndComplete Message [s]

This is the message that the server sends which tells the client that the edits received on the Save message have been succesfully executed. It transitions the trade to the Completed state. The client will need to open a new edit order ticket to make further changes. This is an alternative to the SaveAccept message.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

SaveAndComplete

This message also includes the strategy fields.

Complete Message [c]

This is the message that the client sends which tells the server that they no longer wish to make any more edits to the strategy. Typically the server will release any locks it has on strategies when it recieves this message.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the client wants to make in the state model

Complete

CompleteAck Message [s]

This is the message that the server sends to tell the client that it has received the Complete message, and transitions the trade model to the final state Completed.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

CompleteAck

ValidationError Message [s]

This is the message that the server sends which tells the client that the save request could not be processed. This message moves the client back to the Editable state, so they can try sending a new Save message once they have corrected the problems.

Field Name Value Example

RequestID

The request ID from the original EditOpen message

112314243333

MsgType

The transition that the server wants to make in the state model

ValidationError

This message also includes the strategy fields.

Strategy fields [s]

This is not actually a message, you may have noticed that in some of the messages above you will be asked to add the strategy fields to the contents of the message. The table below contains all the fields that relate to the strategy and its constituent legs.

Fields that are not prefixed with L1_, belong to the strategy.

For each leg on the strategy you will need to provide an additional set of LX_ prefixed fields, where 'X' is number of the leg, L1_ is used in the example below.

Trade fields
Field Name Value Example

CurrencyPair

The currency pair for all orders in this strategy

GBPUSD

StrategyType

The type of strategy that the user is editing

SINGLE, OCO, IF-DONE, IF-DONE-OCO

OrderCount

The number of orders in the strategy

3

Account

The account the strategy was submitted on, in the form "<description>|<ID>"

My Account|Acc1

ActivationDate

What date the strategy should be activated

GFA or a date in the form 20130606 (GFA=Good From Activation)

ActivationTime

What time the strategy should be activated if the ActivationDate was in the format of yyyymmdd

12:12:12

ActivationLocation

When location should be used to evaluate the time to activate if the ActivationDate was in the format of yyyymmdd

Usually an entry in the tz database e.g "Europe/London" - see the "TZ" column on this page https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

ExpirationDate

What date the strategy should expire

GTC, GFD, 20130606

GTC=Good Till Cancelled

GFD=Good For Day (valid for the current trading day only).

ExpirationTime

What time the strategy should be activated if the ExpirationDate was in the format of yyyymmdd

12:12:12

ExpirationLocation

When location should be used to evaluate the time to expire if the ExpirationDate was in the format of yyyymmdd

Usually an entry in the tz database e.g "Europe/London" - see the "TZ" column on this page https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

AlertType

The types of alerts that should be sent for this strategy

SMS, EMAIL (comma separated list, zero or more values)

SubmittedBy

Who the strategy was submitted by

sales1@mybank.com

SubmittedFor

Who the strategy was submitted for.

user1@mybnakcom

Trade leg fields
Field Name Value Example

L1_OrderID

The id of the order

L1_ParentID

The id of the parent order, if there is one

empty unless this is one of the OCO legs of an If-Done OCO, or the Done leg of an If-Done

L1_RelatedID

The id of the related order on the same level as this order

e.g. the other half of an OCO. Empty for single orders and the parent order in an If-Done OCO

L1_RelationshipType

The relationship type of L1_RelatedID

OCO, or empty if this is a single order

L1_Amount

The amount to trade

100000

L1_Filled

The amount filled so far

75000

L1_Remaining

The amount remaining

25000

L1_BenchmarkType

The type of benchmark to fix to, if this is a benchmark order

ECB, WMR

L1_BuySell

The trade direction of the base currency, from the perspective of the user. Valid values: "BUY", "SELL".

BUY

L1_DealtCurrency

The currency that the amount is specified in

GBP

L1_ExecutionType

How this order should be executed

CALL-ORDER, TAKE-PROFIT, STOP-LOSS, MARKET, BENCHMARK

L1_FillRate

The rate at which this order should be filled

1.1232, or empty if this is a market order

L1_Status

The current status of the order

deactivated

L1_Remarks

Comment/remarks by the client

Call Mike when filled