Bloomberg Open API - how to get a specific number of bars rather than over a date range?

StackOverflow https://stackoverflow.com/questions/14260568

  •  14-01-2022
  •  | 
  •  

Pregunta

I am playing with the Bloomberg API and to get hourly bars for the two hours, I can simply call a method like this, with start set to the current time minus two hours, and end time set to now:

public static Request getBarData(String security, Service refDataService, Datetime start, Datetime end) {

    Request request = refDataService.createRequest("IntradayBarRequest");
    request.set("security", security);
    request.set("eventType", "TRADE");
    request.set("interval", 60);
    request.set("gapFillInitialBar", true);
    request.set("startDateTime", start);
    request.set("endDateTime", end);
    return request;
}

Is there a way that I can rephrase this request, to ask for the last 2 60 minute bars instead of bars for the given date range? Essentially, I'd like to replace a date range with a number of bars. I need to make subscriptions for bars of different intervals, but the same number of bars in each case, so avoiding all the date addition and subtraction and any timezone considerations would be excellent.

¿Fue útil?

Solución

I just confirmed with Bloomberg that this is not possible. You need a start time and end time (default end time is now)

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