how to get bloomberg index data using blpapi and xbbg on python

276 views Asked by At

I'd like to pull data from blpapi and xbbg.

It works well on Excel as belows.

=BDS("YCGT0025 Index","CURVE_TENOR_RATES", "CURVE_DATE=20230930","headers=t")

But not working on python as bleows.

blp.bds("YCGT0025 Index",
        "CURVE_TENOR_RATES",
        "CURVE_DATE=20230930")
Out[6]: 
Empty DataFrame
Columns: []
Index: []

1

There are 1 answers

2
Cuan Gigabyte On

However, it seems that your code is not working because you are missing some parameters in your bds function call. According to the documentation1, you need to specify the headers parameter as True if you want to include the column names in the output. You also need to use the CURVE_DATE_OVERRIDE parameter instead of CURVE_DATE, as the latter is not a valid override for this field. Here is an example of how you can modify your code to make it work:

blp.bds("YCGT0025 Index",
    "CURVE_TENOR_RATES",
    headers=True,
    CURVE_DATE_OVERRIDE="20230930")

This should return a dataframe with the tenor rates for the specified curve date. I hope this helps you with your data analysis.

Or, you can see this post for your reference you can see this post for your reference