alpha-xone / xbbg

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

BUG: Unable to pull index members field #45

Closed rgkimball closed 3 years ago

rgkimball commented 3 years ago

Hello!

I am trying to pull a list of index members but some of the Dataframe standardization operations in the bdp function do not function correctly when there are duplicate entries in the index:

blp.bdp('RAY Index', 'INDX_MEMBERS')

Result (when trying to unstack): ValueError: Index contains duplicate entries, cannot reshape

res.head() at error:

      ticker         field Member Ticker and Exchange Code
0  RAY Index  INDX_MEMBERS                            A UN
1  RAY Index  INDX_MEMBERS                           AA UN
2  RAY Index  INDX_MEMBERS                          AAL UW
3  RAY Index  INDX_MEMBERS                          AAN UN
4  RAY Index  INDX_MEMBERS                         AAON UW
alpha-xone commented 3 years ago

need to use blp.bds for this

rgkimball commented 3 years ago

My mistake, thanks!

rgkimball commented 3 years ago

@alpha-xone This is a bit strange - is the request somehow capped at 2,500 securities? RAY should be returning 2,997.

members = blp.bds('RAY Index', 'INDX_MEMBERS')
members.shape  # (2500, 1)
alpha-xone commented 3 years ago

it's possible - can confirm with helpdesk

David-Woroniuk commented 3 years ago

@rgkimball - please note that all "INDX_MEMBERS" requests are capped at 2500 securities. For larger indices, you can use "INDX_MEMBERS2" and "INDX_MEMBERS3" to retrieve 2500-5000 and 5000-7500 respectively.

rgkimball commented 3 years ago

@David-Woroniuk Wasn't aware but that's a great tip, thank you!