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?

Best Answer

  • @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);

Answers