Capital Markets Adapters 10.3 | Apama Capital Markets Adapters Documentation 10.3 | EBS Spot Ai FIX Adapter | Order management support
 
Order management support
In order to submit and manage orders to the EBS exchange, it has been necessary to define a custom pre-processor module that works in conjunction with the standard FIX order manager. The pre-processor is used by routing a new order to the service id defined in session configuration using EBSFIX.SERVICEID parameter. The preprocessor will modify the order to make it suitable for the EBS market before forwarding it on to the usual order manager service and listening for responses (executions etc).
Order placing
Order management support is enabled on "EBS-FIX" or value of EBSFIX.SERVICEID as specified in the session configuration. Orders must be placed only after subscribing to the Instrument. Time in Force(59) values can be - Good Till Cancelled (59=1,Quote) , Immediate or Cancel (59=3,Hit) and (59=4) Fill or Kill (Full Amount trading for Direct pairs).

com.apama.oms.NewOrder("10","EUR/USD",1.2675,"BUY","LIMIT",2000000,"EBS-FIX",
"","","ConnectionName","","",{"461":"RCSXXX","63":"0","59":"1"})
According to the specification CancelOrder should have Order Type, so
1. For limit orders, add "40":"2" to the extraParams.

com.apama.oms.CancelOrder("10", "EBS-FIX",
{"461":"RCSXXX","63":"0","59":"1","40":"2"})
2. For Fixing orders, add "40":"Z" to the extraParams.

com.apama.oms.CancelOrder("10", "EBS-FIX",
{"461":"RCSXXX","63":"0","59":"1","40":"Z"})
Iceberg enabled order
Ice berg Enabled order should contain DisplayQty(1138) in extraParams. You can also specify Display method(1084) and IcebergHigh RandomTime(20112). If you don't specify it will take default values. To amend icebrg enabled order, you should send the display quantity in amend order. Sample events:

com.apama.oms.NewOrder("order4","EUR/USD",1.3762,"SELL","LIMIT",20000000,"EBS-FIX",
"","","Connection","","",{"461":"RCSXXX","59":"1","63":"0","1138":"2000000","1084":"1",
"20112":"100"})
com.apama.oms.AmendOrder("order4","EBS-FIX","EUR/USD",1.3785,"SELL","LIMIT",22000000,
{"461":"RCSXXX","59":"1","63":"0","1138":"1000000"})
FIXING Order
If a user is interested in placing 'FIXING' orders then you should request the same in user login request by adding parameter 'AllowFixingInfo' in UserData as:

com.apama.fix.ebs.UserLogonRequest("Connection", "123", "SAG",
"APAMA_123", [com.apama.fix.ebs.UserData("AllowFixingInfo","Y",{})],{})
Once logged in successfully, you will get a trading session status message which provides information on the status of the market. This message carries trading ID, its status, ValuationDateTime etc. To place a fixing order, EBS expects us to send mandatory tags - TimeInForce (Tag 59) MarketSegmentID (Tag 1300) TradingSessionID (Tag 336) ValuationDateTime (Tag 20107)
Client just needs to send an extra parameter 'TradingSessionID' with a value in the NewOrder event and adapter will map remaining tags from its cache.
For example:

com.apama.oms.NewOrder("1","USD/JPY",101.91,"SELL","FIXING",3000000,"EBS-PRICE",
"","","Connection","","",{"461":"RCSXXX","59":"1","63":"0","TradingSessionID":"6"})
For amending a fixing order, you don't need these mandatory tags except TimeInForce which will be taken care by adapter.
Party Info
PartyInfo which is received as part of TradeCaptureReport, will be published in OrderUpdate as follows
Sample Order Update:
com.apama.oms.OrderUpdate("order1","EUR/USD",1.41125,"BUY","LIMIT",5000000,
true,true,true,false,false,false,false,"xyz",1437,4998563,1437,147,147,
"PartiallyFilled:",{"35":"8","461":"RCSXXX","52":"20110711-10:54:07.501",
"59":"1","63":"0","Account":"","ExecID":"123","ExecType":"F",
"Market":"Connection","OrdStatus":"1","Party0":"Progress,BIC,ExecutingBroker",
"SERVICE_NAME":"EBS-PRICE"})
The PartyInfo in the above example is "Party0":"Progress,BIC,Executing Broker" Where, "Party_x":"PartyID, PartyIDSource, PartyRole"
How does our adapter/monitor handle TCR and ER?
In EBS support monitor, on receiving an execution report with a partial fill or fill, you will open a listener for corresponding TCR with same matching Id. This execution report will be sent to base FIX Ordermanager after receiving matching TCR. In some cases though you receive an ER with filled state but still you need to receive corresponding TCR. Meanwhile user tries to cancel order but gets rejected by exchange. To handle such scenarios, use __APAMA_ORDER_STATE extra parameter to handle order completion as stated below,
1. On receiving final execution report, EBS support monitor will add an extra parameter __APAMA_ORDER_STATE :'final'
This parameter says that the order has reached done state but still need to receive TCRs which carry settlement details.
2. On receiving all TCRs, support monitor will route an orderupdate with __APAMA_ORDER_STATE as 'settled' and kill its thread.
In EBS, an OrderUpdate with __APAMA_ORDER_STATE:'settled' will be the last after which order can be considered done.