matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
242 stars 67 forks source link

_create_request function doesn't support list of ovrds for multiple fields? #22

Closed DiametricCapital closed 6 years ago

DiametricCapital commented 6 years ago

Hi Matthew, Thanks for creating this project, and I found it is very helpful. One question that I have is how to do pass in list of ovrds to support multi-fields or same field with multiple version of overrides. For example, to get 2 year weekly beta of GOOG, I used following function:

df = con.ref('GOOG US Equity', 'beta_adj_overridable',
             [('beta_override_rel_index', 'SPX Index'),
              ('beta_override_start_dt', '20160124'),
              ('beta_override_end_dt', '20180124')])

If I want different betas corresponds to different time-frame(like it shows below, one for 2 year beta, the other one for 3 year beta) in the same data frame, does API support such thing? This is what I tried:

df = con.ref('GOOG US Equity', ['beta_adj_overridable','beta_adj_overridable'],
             [('beta_override_rel_index', 'SPX Index'),
              ('beta_override_start_dt', '20160124'),
              ('beta_override_end_dt', '20180124')],
             [('beta_override_rel_index', 'SPX Index'),
              ('beta_override_start_dt', '20150124'),
              ('beta_override_end_dt', '20180124')]   ). 

Thanks in advance

matthewgilbert commented 6 years ago

I do not believe this is possible, but I am unsure how the ReferenceDataRequest service (which ref interacts with) responds to multiple overrides of the same field since I have not tested this. I believe the service only supports one override per field, but I do not currently have access to a terminal so I cannot test this. If you set con.debug = True and post the output from the following here it would be helpful for me to resolve this.

df = con.ref('GOOG US Equity', 'beta_adj_overridable',
             [('beta_override_rel_index', 'SPX Index'),
              ('beta_override_start_dt', '20160124'),
              ('beta_override_start_dt', '20150124'),
              ('beta_override_end_dt', '20180124'),

Alternatively you could just make two calls to ref()?

matthewgilbert commented 6 years ago

I am going to close this since this is not currently supported by the underlying ReferenceDataRequest and I do not believe extending the behaviour on top of this service to provide the functionality is in scope.