问题
I am trying to query the Bloomberg API (.Net) to get the future chain on an underlying security. Preferably, I would be able to get the list of futures for a given date in the past.
The equivalent operation in Excel using the worksheet formula API would be the following:-
=BDS("ERA COMDTY","FUT_CHAIN","CHAIN_DATE=20120103",
"INCLUDE_EXPIRED_CONTRACTS=Yes")
I looked at a large number of online resources, and I don't seem to be getting anywhere.
回答1:
For the v3 API, you need to use request overrides.
Request request = refDataService.createRequest("ReferenceDataRequest");
request.append("securities", "ERA Comdty");
request.append("fields","FUT_CHAIN");
Element overrides = request.getElement("overrides");
Element override1 = overrides.appendElement();
override1.setElement("fieldId", "CHAIN_DATE");
override1.setElement("value", "20120103");
Element override2 = overrides.appendElement();
override2.setElement("fieldId", "INCLUDE_EXPIRED_CONTRACTS);
verride2.setElement("value", 'Y');
session.sendRequest(request);
来源:https://stackoverflow.com/questions/12584483/bloomberg-api-using-net-api-to-get-the-fut-chain-on-an-underlying-security