0
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ It's a synthetic ticker made of several actual instruments, it wouldn't have an isin. $\endgroup$
    – assylias
    Dec 17, 2021 at 19:46
  • 1
    $\begingroup$ That is really a question for the help desk - F1 F1 (Python API is identical to Excel - both are C++ under the hood). While the help desk may not be very helpful with Python, they should be able to explain you what you need $\endgroup$
    – AKdemy
    Dec 17, 2021 at 23:42
  • $\begingroup$ Unfortunately help desk offered little in terms of help. The moment you mention python they stop short of providing support, even though my view (same as yours) is that it is API related. It also seems that their API support is a recommendation to check WAPI ... $\endgroup$
    – pomelo_guy
    Dec 31, 2021 at 12:46

1 Answer 1

0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.