Closed matthewgilbert closed 6 years ago
To deal with this coherently, ref
and bulkref
have been introduced for dealing with ReferenceDataRequest
s that return singleton or array data respectively. Examples of these are
import pdblp
con = pdblp.BCon()
con.start()
df = con.bulkref('BCOM Index', 'INDX_MWEIGHT')
df.head()
ticker field name value position
0 BCOM Index INDX_MWEIGHT Member Ticker and Exchange Code BON8 0
1 BCOM Index INDX_MWEIGHT Percentage Weight 2.41 0
2 BCOM Index INDX_MWEIGHT Member Ticker and Exchange Code C N8 1
3 BCOM Index INDX_MWEIGHT Percentage Weight 6.56 1
4 BCOM Index INDX_MWEIGHT Member Ticker and Exchange Code CLN8 2
df2 = con.ref("CL1 Comdty", ["FUT_GEN_MONTH"])
df2
ticker field value
0 CL1 Comdty FUT_GEN_MONTH FGHJKMNQUVXZ
Here position is introduced to keep track of the spot in the array this was parsed from.
Related to https://github.com/matthewgilbert/pdblp/issues/5, when an array of reference data is returned it is ambiguous which values are grouped together
Implicitly these are associated in the order they are returned but it would be better to be explicit.
One complication for implementing a coherent interface is that currently both array data and singleton data can be returned from the same call to
ref()
, e.g.