Retrieving Bloomberg Bulk Reference Data Through the API
Summary
The document explains how to retrieve bulk reference data through Bloomberg’s API, in the context of finding historical benchmark information for Canadian yield curve tenors. It notes that a bulk reference field uses the same general request type as other reference data, while the returned response must be parsed in a different format. The described workflow is to open the reference data service, request securities and fields, add any needed overrides, submit the request, and inspect the response before converting it into a usable data structure.
The answer recommends using Bloomberg’s Excel interface to identify suitable fields, then consulting API and schema documentation for programmatic work. It also points to Python examples and third-party wrappers as possible aids. The sample demonstrates the request pattern but does not resolve the original benchmark-history query or identify the exact field required. Availability can vary by toolkit and interface, and some functions may work in Excel but not through the API.
Key ideas
- Bulk reference data uses a reference data request, with bulk results requiring different response parsing.
- Use Excel to identify relevant Bloomberg fields before building a programmatic query.
- A request specifies securities and fields and can include overrides.
- The example shows a basic request flow but does not identify the field for historical benchmark membership.
Tags
Full text
# Bloomberg: Get Historical Benchmarks
# Bloomberg: Get Historical Benchmarks
New on the terminal, was wondering if I could get some help.
I am looking to find a time series for what the active benchmark was for a given tenor on the Canadian yield curve.
I know that GTCAD5Y Govt does the trick for the present day, but I have not been able to find a way to tie this into a BDH or python query. In each case when I try, no data gets returned when I try fields such as ID_ISIN.
Any tips/recommendations are greatly appreciated.
Edit: there is an excel template on the terminal that has a relevant BDS command for this information.
## Answer by AKdemy (score 1)
https://quant.stackexchange.com/a/69299
As mentioned in the comment, the help desk is not helpful with Python (any programmatic API is a do it yourself offering unless you use a premium offering like Data license, BPIPE or SAPI - but WAPI has more than you need really). What the help desk can do is to show you excel - its easy to use programmatic API afterwards once you know what the appropriate fields etc are (notable exception, some things only work in excel - like the curves toolkits and FX forward toolkit).
You download the API core developer guide, and look at BDS data. In the API, there is no difference in the request type and options for reference data and bulk reference data (the field dictates if it is bulk). The difference between the two lies in parsing the response—bulk data responses are returned in a different format. The reference and schema guide has also code examples. The former mainly VBA, the latter C++ but on WAPI there are also examples for Python (just not in the guides). Once blpapi is installed, you can use this simple BDS equivalent as a start:
```
import blpapi
session = blpapi.Session()
session.start()
session.openService("//blp/refdata")
service = session.getService("//blp/refdata")
request = service.createRequest("ReferenceDataRequest")
request.append("securities", "CLA Comdty")
request.append("fields", "FUT_CHAIN_LAST_TRADE_DATES")
overrides = request.getElement("overrides")
override1 = overrides.appendElement()
override1.setElement("fieldId", "START_DT")
override1.setElement("value", "20200101")
override2 = overrides.appendElement()
override2.setElement("fieldId", "END_DT")
override2.setElement("value", "20201209")
session.sendRequest(request)
endReached = False
while endReached == False:
ev = session.nextEvent()
if ev.eventType() == blpapi.Event.RESPONSE or ev.eventType() == blpapi.Event.PARTIAL_RESPONSE:
for msg in ev:
print(msg)
if ev.eventType() == blpapi.Event.RESPONSE:
endReached = True
```
So you use refdata, create the request, append the required securities and fields and add the overrides. The print(msg) command will not be the final solution but it shows you the entire response, which you can get into a dataframe or whatever you like.
If you prefer easier solutions (without having to write some code yourself), you can use existing wrappers like pdblp.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.