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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
23 4 2 9

TR_field results in bad request in get_data

Hello,

I've noticed that when I build my TR_fields with the help function I get different results than if I would send the fields as a list of strings to get_data.

params = {"instruments": ["BKOM.PR"], "fields": ["TR.NetIntMarginActual.date", "TR.NetIntMarginActual"], "parameters":{"SDate":0, "EDate":-5, "Period":"FQ0", "Frq":"FQ"}}

fields = [ek.TR_Field(f) for f in params['fields']]
params['fields'] = fields

df, err = ek.get_data(**params)

results in a '400 Bad Request' whilst

params = {"instruments": ["BKOM.PR"], "fields": ["TR.NetIntMarginActual.date", "TR.NetIntMarginActual"], "parameters":{"SDate":0, "EDate":-5, "Period":"FQ0", "Frq":"FQ"}}

df, err = ek.get_data(**params)

gets no error. However, changing the field order of the first query as such

params = {"instruments": ["BKOM.PR"], "fields": ["TR.NetIntMarginActual", "TR.NetIntMarginActual.date"], "parameters":{"SDate":0, "EDate":-5, "Period":"FQ0", "Frq":"FQ"}}

fields = [ek.TR_Field(f) for f in params['fields']]
params['fields'] = fields

df, err = ek.get_data(**params)

also doesn't result in an error. Could you give some insight in how the sorting is done at the TR server side? From what I've seen it sorts on the first field.

On a further note I want to report a bug that I found yesterday (and posted in the forum elsewhere but I'd figure I could repeat it here). In the file data_grid.py -> TR_Field it says that the highest priority is 0. However, when it does the check

if sort_priority:field[field_name]['sort_priority'] = sort_priority

a priority of 0 will result in the if evaluating to False, thus giving it no priority.

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythondata
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

Upvote
Accepted
4.3k 2 4 5

The issue related to sort_priority management was fixed by development team.

The last 0.1.10 eikon API version includes it.

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