Skip to content
Advertisement

Getting data with diferent currencies from Bloomberg API,using python?

I am trying to extract data from Bloomberg. I need data for multiple fields with diferent currencies. I can’t get what I need from this answer https://github.com/alpha-xone/xbbg

Can anyone help, please?. for a “specifc time” and on a “period of time”?

I tried the following code but it didn’t work.

JavaScript

Advertisement

Answer

It is best to group similar securities together when pulling in historic data. In the OP’s question, ‘TPXDDVD Index’ is a calculated total return index. Hence it will not have the same fields available as the other two, which as their tickers suggest are quoted funds.

Taking just the two quoted funds, SCTOGAA LN Equity and VAPEJSI ID Equity, we can determine the default currency in which each field is denominated. This being Bloomberg, naming conventions are organic and may not be obvious! The two value fields are FUND_NET_ASSET_VAL and FUND_TOTAL_ASSETS, and the default currency might be different for each.

We can use the bdp() function to pull back these currencies as follows (NB tickers are in a python list:

JavaScript

With the result:

JavaScript

So for VAPEJSI the NAV and Total Assets are denominated in different currencies. And NB. GBp is not a typo by the data entry clerk, it means GBP pence.

You can override the currency with a single currency value applied to all fields in the function call.

JavaScript

which returns:

JavaScript

The asset value in GBP pence, has been converted to USD dollars. As an aside if you had put Currency='USd' instead you would have the price in US cents. You have to love case-sensitivity …

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement