A tip to improve the performance of your Bloomberg API application

If you make a request for data which results in a lot of events generated by Bloomberg API (such as long historical intraday data request, or possibly real time subscriptions), do not use the pattern specified in the API documentation, as it may end up making your application very slow to retrieve all events. Basically, do not call NextEvent() on a Session object, use a dedicated EventQueue instead.

Instead of doing this:

var cID = new CorrelationID(1);
session.SendRequest(request, cID);
do {
   Event eventObj = session.NextEvent();
   ...
}

Do this:

var cID = new CorrelationID(1);
var eventQueue = new EventQueue();
session.SendRequest(request, eventQueue, cID);
do {
   Event eventObj = eventQueue.NextEvent();
   ...
}

This simple change may yield performance improvements by an order of magnitude (or not, as the API is known to not be particularly deterministic…).

Aucun commentaire pour cet article. Soyez le premier à réagir !

Laisser un commentaire