I'm using the BLP Package as a wrapper around Bloomberg's API.
In the excel bloomberg api, I'm pulling a ticker called FUND_TOTAL_ASSETS. That value can be in any of several currencies. But by adding the "FX=USD" parameter to my BDH() query, it normalizes all the values to USD. Eg. ticker '1671 JP Equity' for 'FUND_TOTAL_ASSETS' field becomes 188.3905USD instead of 25915. =@BDH(E$4,E$6,$B1,$B2,"Dir=V","CDR=5D","Days=A","FX=USD","Dts=H","cols=1;rows=22")
I want to pull up the same data with the same conversion-to-usd operation using blp
wrapper. I thought that I can do this via an override parameter.
From the bloomberg api guide I see
so I thought something like the following would work:
xf = bquery.bdh(securities=search, fields=['FUND_TOTAL_ASSETS',],
start_date=dt.date(2022,10,1).strftime("%Y%m%d"),
end_date=dt.datetime.now().date().strftime("%Y%m%d"),
overrides= [('currency','USD')])
It returns the data, but the value remains in the native currency.
I tried the same code as the excel api (FX,USD) but that fails with a bloomberg INVALID_OVERRIDE_FIELD
.
The underlying Bloomberg DAPI differentiates between Overrides
and Options
(but even then there is some confusing overlap).
Typically an Override
is applied to a Bloomberg Field. Eg the field FUND_CRNCY_ADJ_TOTAL_ASSETS
for 1671 JP Equity
has an override of FUND_TOTAL_ASSETS_CRNCY
, where you can set the currency. You can see this by typing 1671 JP Equity FLDS
in the Terminal and searching the available fields. The overrides are specific to the field.
In addition the HistoricalDataRequest schema also has various options
which can be specified. These are elements of the request, in the same way as startDate
and endDate
. These are the options in the reference to which the OP links. The options apply to all the fields and usually govern how the data is returned (eg date periodicity).
With the blp
package, options are supplied as a dictionary of key:value pairs.
This snippet demonstrates how this can be done to specify the currency of the returned data:
from blp import blp
import datetime as dt
bquery = blp.BlpQuery().start()
dtEnd = dt.datetime.now().date()
dtStart = dtEnd - dt.timedelta(days=7)
xf = bquery.bdh(securities='1671 JP Equity', fields=['FUND_TOTAL_ASSETS',],
start_date=dtStart.strftime("%Y%m%d"),
end_date=dtEnd.strftime("%Y%m%d"))
print(xf)
xfUSD = bquery.bdh(securities='1671 JP Equity', fields=['FUND_TOTAL_ASSETS',],
start_date=dtStart.strftime("%Y%m%d"),
end_date=dtEnd.strftime("%Y%m%d"),
options={'currency':'USD'})
print(xfUSD)
The output should reflect the different currency used.