Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
36 1 2 3

Using Python API via MATLAB

I am using the Python API via MATLAB which works fine as long as I request only single fields:

py.eikon.set_app_key('*****');

instruments = ['LCO5000B1'];

fields= 'CF_CLOSE'; % OR fields= 'CF_CURR';

df= py.eikon.get_data(instruments,fields);

I am now struggling to get data for both fields (CF_CLOSE and CF_CURR) in a single call of get_data. What would be the correct syntax for that?

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apimatlab
icon clock
10 |1500

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

Upvote
Accepted
39.4k 77 11 27

@Peter.Winkler3

Use py.list method of Matlab to create a Python list of fields or instruments, which can then be passed to Eikon Data APIs library for Python:

instruments = py.list({'LCO5000B1','LCO5000B2','LCO5000B3'});
fields = py.list({'CF_CLOSE','CF_CURR'});
res = py.eikon.get_data(instruments, fields);
display(res);
icon clock
10 |1500

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

Thank you very much, @Alex Putkov.! It works perfectly this way!
Upvotes
18.2k 21 13 21

Hi @Peter.Winkler3

I cannot answer you on the MATLAB.

I can give you the Python example.


ahs.png (14.0 KiB)
icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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