Closed kite8 closed 5 years ago
e.g.
start = '20181101' end = '20190122' df = con.bdh("MSFT US Equity",fields, start, end)
the close price of the df at '20190122' is equal to the real price, but MSFT had ex-dividend at the 2018-11-14 and 2019-02-20, so the the close price of the df at '20181101' is not equal to the real price.
If I update the data everyday, this will be a problem.
So I need to get the not adjust price & the dividend information. how to get the data from pdblp?
Thanks!
This should be done using the elms
parameter in bdh
, e.g.
df = con.bdh("MSFT US Equity", "PX_LAST", "20180101", "20180110",
elms=[('CshAdjAbnormal', False), ('CapChg', False), ('CshAdjNormal', False)])
But I do agree that better error handling could be provided for this particular case. For example the response from a bad override is of the form
pdblp.pdblp:INFO:Event Type: 'RESPONSE'
pdblp.pdblp:INFO:Message Received:
HistoricalDataResponse = {
responseError = {
source = "bbdbh2"
code = 27
category = "BAD_ARGS"
message = "Invalid override field id specified [nid:193] "
subcategory = "INVALID_OVERRIDE_FIELD"
}
}
but this throws a KeyError since it expects the response to have a securityData
field.
--> 307 has_security_error = 'securityError' in d['securityData']
308 has_field_exception = len(d['securityData']['fieldExceptions']) > 0
309 if has_security_error or has_field_exception:
KeyError: 'securityData'
Thanks! I will try it tomorrow.
Thank you very much!! It's worked!!
=============== I have a humble request. Can you add the 'bdp' & 'bds' request?
I found the dividend info should use bds, like this in excel:
=BDS("AAPL US Equity","DVD_HIST_ALL","headers=y","cols=7;rows=67")
Because I don't have Bloomberg terminal, I wrote the code, and post mail to my friend, and he run the code and tell me the result, so debugging is very inconvenient.
Thanks!!
I'm confused what your follow up question is? Similar functionality to bdp
and bds
is available via ref
and bulkref
. I believe =BDS("AAPL US Equity","DVD_HIST_ALL","headers=y","cols=7;rows=67")
should be possible using pdblp.BCon.bulkref
. Please review the documentation and tutorial available here
Thank you.! I will to research it.
I reached this page by searching for PDBLP key error securitydata
Turns out I specified the start date > end date.
I'm leaving this message for other dumbdumbs like me who stumble across this thread.
Hi , I have a question : how to retrieve the not adjust price data, I found the parameters that are 'CshAdjAbnormal', 'CapChg', 'CshAdjNormal'.
So I try like this:
But it's error:
what should I do? Thank you !