In Bloomberg API how do you specify to get FX forwards as a spread rather than absolute values?

喜你入骨 提交于 2019-12-09 00:34:29

问题


How do you explicitly request fx forwards as outrights using the bloomberg API?

In the Bloomberg terminal you can choose whether to get FX Forwards as absolute rates (outrights) or as offsets from Spots (Points) by doing XDF, hitting 7, then the option is about half way down. 0 means outrights, and 1 means offfsets.

With most defaults you can explicitly set them in the API, so your code gives the same result whichever computer you run on. How do you set this one in a V3 API query?


回答1:


Having had a colleague told by the help desk this is impossible, it turns out they are wrong and it is possible. You override the FWD_CURVE_QUOTE_FORMAT to be RATES for absolute and POINTS as offsets.

Example code (Java):

public static void main(String [] args) throws Exception{
  Session session = BlpUtil.connectToReferenceData();
  Service refDataService = session.getService("//blp/refdata");
  Request request = refDataService.createRequest("HistoricalDataRequest");

  Element securities = request.getElement("securities");
  securities.appendValue("JPY10Y CMPL Curncy");

  Element fields = request.getElement("fields");
  fields.appendValue("PX_LAST");

  request.set("startDate", "20100527");
  request.set("endDate", "20100527");

  Element overrides = request.getElement("overrides");
  Element override1 = overrides.appendElement();
  override1.setElement("fieldId", "FWD_CURVE_QUOTE_FORMAT");
  override1.setElement("value", "POINTS");

  CorrelationID cid = session.sendRequest(request, null);
  while (true) {
    Event event = session.nextEvent();
    MessageIterator msgIter = event.messageIterator();
    while (msgIter.hasNext()) {
      Message msg = msgIter.next();
      if (msg.correlationID() == cid) {
        System.out.println("msg = " + msg);
      }
    }
  }
}


来源:https://stackoverflow.com/questions/2929178/in-bloomberg-api-how-do-you-specify-to-get-fx-forwards-as-a-spread-rather-than-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!