Bloomberg Java API - how to create a request without a service

I am using Bloomberg API to capture data. I currently have 3 processes that get data in the usual way according to the developer guide. Something like:

Service refDataService = session.getService("//blp/refdata");
Request request = refDataService.createRequest("ReferenceDataRequest");
request.append("securities", "IBM US Equity");
request.append("fields", "PX_LAST");
cid = session.sendRequest(request, null);

      

It works. Now I would like to expand the logic to be something more like an update queue. I would like each process to send its request to the update queue, which in turn was responsible for creating the session and service, and then submitting the requests. However, I don't see any way to create a request without Service. Also, since the request types (referenceData, historical data, intraday ticks) are so varied and have such different properties, it's not difficult to create a container object that my update queue can read.

Any ideas on how to do this? My ultimate goal is to have a process (I call the update queue) that takes a list of requests, removes any duplicates, and sends it to Bloomberg for data at 30 second intervals.

Thank!

+3


source to share


1 answer


I have updated the jBloomberg library to include tick data. You can send various types of requests to BloombergSession , which acts like a queue. Therefore, if you want to send different types of requests, you can write something like:

RequestBuilder<IntradayTickData> tickRequest =
    new IntradayTickRequestBuilder("SPX Index",
        DateTime.now().minusHours(2),
        DateTime.now());

RequestBuilder<IntradayBarData> barRequest =
    new IntradayBarRequestBuilder("SPX Index",
        DateTime.now().minusHours(2),
        DateTime.now())
        .period(5, TimeUnit.MINUTES);

RequestBuilder<ReferenceData> refRequest =
    new ReferenceRequestBuilder("SPX Index", "NAME");

Future<IntradayTickData> ticks = session.submit(tickRequest);
Future<IntradayBarData> bars = session.submit(barRequest);
Future<ReferenceData> name = session.submit(refRequest);

      

Additional examples available in the javadoc .



If you need to get the same information on a regular basis, you can reuse the builder and use it in combination with the ScheduledThreadPoolExecutor .

Note: the library is still in beta, so don't blindly use it in the black box that is automatically traded!

+1


source







All Articles