Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking responseError #75

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions pdblp/pdblp.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ def _bdh_list(self, tickers, flds, start_date, end_date, elms,
# Process received events
for msg in self._receive_events():
d = msg['element']['HistoricalDataResponse']

if 'responseError' in d:
raise ValueError(d)

has_security_error = 'securityError' in d['securityData']
has_field_exception = len(d['securityData']['fieldExceptions']) > 0
if has_security_error or has_field_exception:
Expand Down Expand Up @@ -375,6 +379,10 @@ def _parse_ref(self, flds, keep_corrId=False, sent_events=1):
else:
corrId = []
d = msg['element']['ReferenceDataResponse']

if 'responseError' in d:
raise ValueError(d)

for security_data_dict in d:
secData = security_data_dict['securityData']
ticker = secData['security']
Expand Down Expand Up @@ -477,6 +485,10 @@ def _parse_bulkref(self, flds, keep_corrId=False, sent_events=1):
else:
corrId = []
d = msg['element']['ReferenceDataResponse']

if 'responseError' in d:
raise ValueError(d)

for security_data_dict in d:
secData = security_data_dict['securityData']
ticker = secData['security']
Expand Down