For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
244 5 9 15

Type checking in Python

At several points in pyeikon 1.0.0 it appears the API is not using Python best practices for type checking. For example, in time_series.to_datetime:

if type(date_value) is timedelta:
   ...
if type(date_value) in (datetime, date):

These should really be:

if isinstance(date_value, timedelta):
   ...
if isinstance(date_value, (datetime, date)):

As is, for example, use of a pandas Timestamp as the start_date or end_date parameter fails, even though pandas.Timestamp is a subclass of datetime. This is especially frustrating as it means that the start_date parameter can't be set to, say, df.index[0] from a df that was itself returned by the get_timeseries API.

Similarly, get_data and get_timeseries currently require the rics parameter to be a list of strings. These should really take any iterable. If you need a list (for example to guarantee order), you should cast it internally. As-is you cannot, for example, pass a generator, a pandas Index, or numpy array to get_data or get_timeseries which is similarly frustrating (you cannot, for example, directly take the values of a query for index members and pass them into get_data without casting).

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
4.6k 26 7 22

@davidk that is a fair observation, thank you very much for the feedback. We will look into this.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea