alpha-xone / xbbg

An intuitive Bloomberg API
https://xbbg.readthedocs.io/
Apache License 2.0
244 stars 51 forks source link

"CUR_MARKET_CAP" currency override not implemented for none US stocks. #51

Closed David-Woroniuk closed 2 years ago

David-Woroniuk commented 2 years ago

Good Morning,

Whilst working with the "CUR_MARKET_CAP" field in bds. When running the code:

for index, row in dataset.iterrows():
  row['Mkt Cap'] = blp.bds((row[key_column] + " Equity"), flds=["CUR_MKT_CAP", "CRNCY=USD"])

the market cap is returned in it's local currency, as opposed to standardised in USD. For context, the functionality which I am trying to emulate from the Excel Add-In is:

=@BDP($B7&" Equity", "INTERNAL_END_VALUE", "MARKET_DATA_OVERRIDE", "CUR_MKT_CAP", "CRNCY", "USD", "END_DATE_OVERRIDE", $I$1)

where B7 contains the ticker of interest and $I$1 contains date at which updates should stop.

alpha-xone commented 2 years ago

No need to loop thru each row to get data - you can pass the list of tickers to blp.bds:

blp.bds([tickers], 'CUR_MKT_CAP', CRNCY='USD', END_DATE_OVERRIDE='yyyymmdd')

David-Woroniuk commented 2 years ago

Thanks - looping aside, I am noticing that a few of the overrides aren't being applied for other calls, such as:

blp.bds((data[ticker_col] + " Equity"), flds=['TURNOVER'],
                                       START_DATE_OVERRIDE='20210609', END_DATE_OVERRIDE="20210827",
                                       CRNCY='USD', 'INTERVAL_AVG')

If the "INTERVAL_AVG", "INTERVAL_END_VALUE" and "INTERVAL_SUM" keywords are available, is it possible to add some examples of these keywords to the docs?

I'm noticing that the above call returns the "TURNOVER" in local currency, as opposed to the CRNCY='USD' specified in the call.

alpha-xone commented 2 years ago

Need to match with your function call with Excel formula:

blp.bds([tickers], 'interval_avg', market_data_ovrride='Turnover', crncy='USD', start_date_override=...)