Skip to content

Commit

Permalink
new case for datetime.time values in the reference data provider
Browse files Browse the repository at this point in the history
  • Loading branch information
zeynepgultugaydemir committed Nov 21, 2024
1 parent df4bb7a commit c7d9f40
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qf_lib/data_providers/bloomberg/reference_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, session):
self._session = session
self.logger = qf_logger.getChild(self.__class__.__name__)

def get(self, tickers: Sequence[BloombergTicker], fields, override_name: str = None, override_value: Any = None):
def get(self, tickers: Sequence[BloombergTicker], fields, override_name: str = None, override_value: Any = None):
ref_data_service = self._session.getService(REF_DATA_SERVICE_URI)
request = ref_data_service.createRequest("ReferenceDataRequest")

Expand Down Expand Up @@ -101,8 +101,10 @@ def _parse_value(field_data_array, field_name):
value = field_element.getValueAsInteger()
elif element_data_type is DataType.BOOL:
value = field_element.getValueAsBool()
elif element_data_type in (DataType.DATETIME, DataType.TIME, DataType.DATE):
elif element_data_type in (DataType.DATETIME, DataType.DATE):

Check warning on line 104 in qf_lib/data_providers/bloomberg/reference_data_provider.py

View check run for this annotation

Codecov / codecov/patch

qf_lib/data_providers/bloomberg/reference_data_provider.py#L104

Added line #L104 was not covered by tests
value = to_datetime(field_element.getValueAsDatetime())
elif element_data_type in DataType.TIME:
value = field_element.getValueAsDatetime()

Check warning on line 107 in qf_lib/data_providers/bloomberg/reference_data_provider.py

View check run for this annotation

Codecov / codecov/patch

qf_lib/data_providers/bloomberg/reference_data_provider.py#L106-L107

Added lines #L106 - L107 were not covered by tests
else:
value = field_element.getValueAsString()
except blpapi.exception.NotFoundException:
Expand Down

0 comments on commit c7d9f40

Please sign in to comment.