matthewgilbert / pdblp

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

BDH function raises an error for certain securities without returning data for other securities #94

Closed michaels0m closed 3 years ago

michaels0m commented 3 years ago

Code Sample, a copy-pastable example if possible

con = pdblp.BCon(timeout=5000)
con.start()
data = con.bdh(["US912810SS87 corp","US73358WJA36 corp"], "PX_LAST", "20210610", "20210610", longdata=True)
con.stop()

Problem description

Some tickers return a securityError or fieldException (in the example above the second ticker does this) however this leads to no data being returned even though other tickers are fine. The error is raised in _bdh_list() within pdblp.py: image

Expected Output

Ideally there would be some logic to catch the tickers which raise errors or exceptions, and still return the dataframe with all other tickers while raising a warning.

I would be happy to contribute and submit a push request if you believe that this functionality would be useful and should be implemented.

Version Information

I am using pdblp.version 0.1.8 .

matthewgilbert commented 3 years ago

You can take a look at this example for blp which does what you are looking for https://matthewgilbert.github.io/blp/quickstart.html#Troubleshooting. blp is the sucessor to this library.

michaels0m commented 3 years ago

@matthewgilbert - thank you, as the link you posted suggests, in blp there is a parser to do exactly what I described. I will go ahead and close this query.