matthewgilbert / pdblp

pandas wrapper for Bloomberg Open API
MIT License
240 stars 69 forks source link

HIGH_52WEEK does not return historical data with ref_hist function #91

Open JonathanBechtel opened 3 years ago

JonathanBechtel commented 3 years ago
# Your code here, this should be a minimal reproducible example, see https://stackoverflow.com/help/mcve
con = pdblp.BCon(timeout=7500)
con.start()
date_range = pd.date_range(start='20190701', end='20201225', freq='W-Mon')
date_range = [date.strftime('%Y%m%d') for date in date_range]
con.ref_hist('CAKE UW EQUITY', 'HIGH_52WEEK', dates=date_range, date_field='REFERENCE_DATE')

Problem description

[this should explain why the current behaviour is a problem and why the expected output is a better solution.] The ref_hist function call does not seem to return historical data for the HIGH_52WEEK field, only the most current data point.

I assume there might be a problem the date field that I am using. I've tried using REFERENCE_DATE, MLI_DATE and CURVE_DATE, but none of them seem to return historical values.

Do you know if there's a particular way to access this data historically?

[paste the output of pdblp.__version__ here below this line]

matthewgilbert commented 3 years ago

ref_hist is just a convenience function that makes multiple ReferenceDataRequest calls, overriding the date_field given. In your example REFERENCE_DATE is not an applicable override to the HIGH_52WEEK field

Selection_357

An example where this would work is shown below

Selection_358

To get this field historically I would contact Bloomberg HELP, but given it relies on intraday data it is possible it won't be available.