Sell-Side Request/Response Service

The sell-side Request/Response service is specifically used for EMSX to EMSX (E2E) setting where the sell-side EMSX is used to capture order flow from other buy-side EMSX users.

The EMSX API allows developers to use the Request/Response services for order and route creation, modification, queries related to orders and routes (placements) as well as EMSX Team details. Depending on the type of action required, the application programmer must create a specific request, populate it with required parameters and send that request to the EMSX API service, which provides the response. Communication with the request/response service requires the following steps:

  1. Create a session (if session does not yet exist).
  2. Connect session to //blp/emapisvc_beta or //blp/emapisvc service and start it.
  3. Fetch a service object from the session representing emapisvc.
  4. Use the service object from above to create a Request object of the desired type
  5. Send request object via sendRequest method of session object, pass object of type EventQueue to the sendRequest.
  6. Loop through the EventQueue object until event of type Event::RESPONSE is read.

These are initialized in the constructor as below and are then available for the life of the application for submission of various requests.

Manual Fill Request

The ManualFill request can be used on the sell-side EMSX<GO> settings to create fills and notifies EMSX<GO>.

Full code sample:-

Manual Fill cpp Manual Fill cs Manual Fill vba
Manual Fill java Manual Fill py  

Hint

Please right click on the top code sample link to open in a new tab.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 def processServiceStatusEvent(self,event,session):
     print "Processing SERVICE_STATUS event"

     for msg in event:

         if msg.messageType() == SERVICE_OPENED:
             print "Service opened..."

             service = session.getService(d_service)

             request = service.createRequest("ManualFill");

             #request.set("EMSX_REQUEST_SEQ", 1)

             request.set("EMSX_TRADER_UUID", 12109783)

             routeToFill = request.getElement("ROUTE_TO_FILL")

             routeToFill.setElement("EMSX_SEQUENCE", 1234567)
             routeToFill.setElement("EMSX_ROUTE_ID", 1)

             fills = request.getElement("FILLS")

             fills.setElement("EMSX_FILL_AMOUNT", 1000)
             fills.setElement("EMSX_FILL_PRICE", 123.4)
             fills.setElement("EMSX_LAST_MARKET", "XLON")

             fills.setElement("EMSX_INDIA_EXCHANGE","BGL")

             fillDateTime = fills.getElement("EMSX_FILL_DATE_TIME")

             fillDateTime.setChoice("Legacy");

             fillDateTime.setElement("EMSX_FILL_DATE",20172203)
             fillDateTime.setElement("EMSX_FILL_TIME",17054)
             fillDateTime.setElement("EMSX_FILL_TIME_FORMAT","SecondsFromMidnight")

             print "Request: %s" % request.toString()

             self.requestID = blpapi.CorrelationId()

             session.sendRequest(request, correlationId=self.requestID )

         elif msg.messageType() == SERVICE_OPEN_FAILURE:
             print >> sys.stderr, "Error: Service failed to open"

Sell Side Ack Request

The SellSideAck request is used on the sell-side EMSX<GO> settings to create Ack message on incoming orders from buy-side EMSX<GO>.

Full code sample:-

Sell Side Ack cpp Sell Side Ack cs Sell Side Ack vba
Sell Side Ack java Sell Side Ack py  

Hint

Please right click on the top code sample link to open in a new tab.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 def processServiceStatusEvent(self,event,session):
     print "Processing SERVICE_STATUS event"

     for msg in event:

         if msg.messageType() == SERVICE_OPENED:
             print "Service opened..."

             service = session.getService(d_service)

             request = service.createRequest("SellSideAck");

             #request.set("EMSX_REQUEST_SEQ", 1)

             request.append("EMSX_SEQUENCE", 1234567)

             # The following Element is currently not being used in this request.
             #request.set("EMSX_TRADER_UUID", 7654321)

             print "Request: %s" % request.toString()

             self.requestID = blpapi.CorrelationId()

             session.sendRequest(request, correlationId=self.requestID )

         elif msg.messageType() == SERVICE_OPEN_FAILURE:
             print >> sys.stderr, "Error: Service failed to open"

Sell Side Reject Request

The SellSideReject request is used on the sell-side EMSX<GO> settings to create Reject message on incoming orders from buy-side EMSX<GO>.

Full code sample:-

Sell Side Reject cpp Sell Side Reject cs Sell Side Reject vba
Sell Side Reject java Sell Side Reject py  

Hint

Please right click on the top code sample link to open in a new tab.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 def processServiceStatusEvent(self,event,session):
     print "Processing SERVICE_STATUS event"

     for msg in event:

         if msg.messageType() == SERVICE_OPENED:
             print "Service opened..."

             service = session.getService(d_service)

             request = service.createRequest("SellSideReject");

             #request.set("EMSX_REQUEST_SEQ", 1)

             request.append("EMSX_SEQUENCE", 1234567)

             # The following Element is currently not being used in this request.
             #request.set("EMSX_TRADER_UUID", 7654321)

             print "Request: %s" % request.toString()

             self.requestID = blpapi.CorrelationId()

             session.sendRequest(request, correlationId=self.requestID )

         elif msg.messageType() == SERVICE_OPEN_FAILURE:
             print >> sys.stderr, "Error: Service failed to open"