Pregunta

I am using the Bloomberg API to grab data. Currently, I have 3 processes which get data in the typical way as per the developers 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);

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

Any ideas on how to accomplish this? My ultimate goal is to have a process (I'm calling update queue) which takes in a list of requests, removes any duplicates, and goes out to Bloomberg for the data in 30 second intervals.

Thank you!

¿Fue útil?

Solución

I have updated the jBloomberg library to include tick data. You can submit different types of query to a BloombergSession which acts as a queue. So if you want to submit different types of request 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);

More examples available in the javadoc.

If you need to fetch the same information regularly, you can reuse a builder and use it in combination with a ScheduledThreadPoolExecutor for example.

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top