Capital Markets Adapters 10.3 | Apama Capital Markets Adapters Documentation 10.3 | Bloomberg B-PIPE Adapter | Custom service
 
Custom service
 
Sample
Custom service is an Extra Parameter (EP) based service where you can configure the adapter to connect to any request-response based service which is offered by Bloomberg.. To configure the adapter, you must know the requests and response schemas. For more information on requests and response schemas, see the Bloomberg documentation. In this EP based service, you must define the events to capture the response.
Note:
All the requests receive a response and must unsubscribe on receiving the response. There can be multiple response events in case of fragmented response. Final response can be identified from paylaod dictionary with key EventType and value RESPONSE.
Configuring the adapter
To configure the adapter
1. You must add a new custom service as a comma separated list to the IAF configuration file UniqueServiceName:bloombergservice. For example:
<property name="CustomServiceList"
value="RequestResponseService://blp/refdata,IntradaybarService://blp/intradaybar" />
To configure the new service, you must use the UniqueServiceName provided in the IAF configuration file. These custom services can service more than one type of requests. For example, //blp/refdata can service requests of type HistoricalDataRequest, IntradayTickRequest, PortfolioDataRequest and so on.
2. To connect to the new custom services that are configured and to send a request to the service, you must set the values to the fields declared in the schema for that request. To do so, use the control parameters. The control parameter REQ_TYPE sets the request in the service being targeted and the rest are string key value pairs with the key being the field from the request schema. All the fields are case sensitive. For example, the request IntradayBarRequest requires the following fields in the schema:
*Security(STRING)
*eventType(ENUMERATION)
*startDateTime(DATETIME)
*endDateTime(DATETIME)
*interval(INT32)
*gapFillInitialBar(BOOL)
*returnEids(BOOL)
*adjustmentNormal(BOOL)
*adjustmentAbnormal(BOOL)
*adjustmentSplit(BOOL)
*adjustmentFollowPDDF(BOOL)
*maxdataPoints(INT32)
*maxDataPointsOrigin(ENUMERATION)
You must set the control parameters for the above fields in the service request. For example:
com.apama.session.CtrlParams({"YELLOW_KEY":"corp",
"REQ_TYPE":"IntradayBarRequest","eventType":"BID",
"endDateTime":"2018-04-09T15:55:00",
"startDateTime":"2018-04-08T15:55:00",
"interval":"10"})
3. The requests receive a response from the Bloomberg. These can be translated into Apama events that can be used in the application. To start with, add event mappings for the response messages in a static groups definition file.
<property name="RequestResponseService:barTickData"
value="com.apama.bpipe.reqbasedservice.BarTickData{string time;
float open;float high;float low;float close;integer volume;}" />
<property name="RequestResponseService:IntradayBarResponse"
value="com.apama.bpipe.reqbasedservice.IntradayBarResponse
{string eidData;group barTickData;}" />
Each event must be named identical to the response name. For example, IntradayBarResponse from Bloomberg must be mapped to an Apama event of type IntradayBarResponse.
The fields of type sequence in the schema must be mapped to a separate event and must be used a group as shown above for barTickData.
All the schema fields will be mapped to the variables in the event matching the names. For example, ELEMENT time of IntradayBarResponse from Bloomberg will be mapped to the parameter time in the Apama event IntradayBarResponse.
All unmapped fields of Bloomberg responses will be added to __payload dictionary with key being the Bloomberg field.
4. Add the event definitions in an EPL file to support the above events.
event BarTickData{
string time;
float open;
float high ;
float low;
float close;
integer volume;
dictionary <integer, string> _extraParams;
}

event IntradayBarResponse
{
string eidData;
sequence<barTickData> NoBarTickData;
dictionary<string,string> __payload;
}