Closed pepicello closed 5 years ago
It looks like this was a regression introduced in 0b062233ba779b21918e388836fbbaa04bcd148e.
The issue shown below is with ValueError(data)
, which should be ValueError(d)
286 def _bdh_list(self, tickers, flds, start_date, end_date, elms,
287 ovrds):
288 logger = _get_logger(self.debug)
289 if type(tickers) is not list:
290 tickers = [tickers]
291 if type(flds) is not list:
292 flds = [flds]
293
294 setvals = elms
295 setvals.append(('startDate', start_date))
296 setvals.append(('endDate', end_date))
297
298 request = self._create_req('HistoricalDataRequest', tickers, flds,
299 ovrds, setvals)
300 logger.info('Sending Request:\n{}'.format(request))
301 # Send the request
302 self._session.sendRequest(request, identity=self._identity)
303 data = []
304 # Process received events
305 for msg in self._receive_events():
306 d = msg['element']['HistoricalDataResponse']
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:
--> 310 raise ValueError(data)
I have fixed this in master
, but it will be sometime before I do a new release.
Another possible work around, although not dynamic, is to output this to a log.
import logging
import pdblp
logger = logging.getLogger()
logger.setLevel('INFO')
formatter = logging.Formatter('%(name)s:%(levelname)s:%(message)s')
fh = logging.FileHandler('bbg.log')
fh.setFormatter(formatter)
logger.addHandler(fh)
con = pdblp.BCon(port=8195, debug=True, timeout=20000).start()
con.bdh(['Invalid ticker'], 'PX_LAST', '20190101', '20190202')
Thanks!
I encountered into this issue as well, thanks for the fix!
Any plan to release this shortly? @matthewgilbert
Code Sample, a copy-pastable example if possible
Output:
Problem description
With version 0.1.8 of pdblp, I no longer get a useful error message which was given by blpapi in the same way I was getting it, using version 0.1.7 (see expected output below). It would be useful to have the full error message, as I am parsing it to work out the problematic ticker/field as described in #31.
Note: I think this might be due to the different version of blpapi as well, as changes between v0.1.7 and v0.1.8 should not cause this issue. I have version 3.12.1 when testing v0.1.7 of pdblp, while version 3.13.1 with v0.1.8 of pdblp.
Expected Output
Version Information
0.1.8