CDS Index Time Series via Matlab & Phyton API

I am using Matlab and the Python API in order to retrieve time series of spreads for CDS indices. The corresponding line of code is:


[pylog,datarefinitiv]= evalc('py.eikon.get_timeseries(ric{iric},field,datestr(startdate,''yyyy-mm-dd''),datestr(enddate,''yyyy-mm-dd''))');

with:

ric = cell array with the relecant RICs; iric = counting integer

field = 'VALUE'

startdate and enddate (type datenum) to specify the period of interest


This works absolutely fine for several CDS indices (e.g. ITEEU5Y=MP, ITEXO5Y=MP, and CDXIG5Y=MP) and gives the daily Mid Spread Close values (as verified using the Excel API). However, for one of the indices, CDXHY5Y=MP, this retrieves the Mid Price Close values instead of spread data.


Could you please help how to specify the parameter field in order to obtain the Mid Spread Close values for the latter RIC?

Best Answer

  • Hi @Jirapongse,

    thanks for your support!

    For the sake of completeness of clarifying the issue, the following adaption to the mentioned code line solved the problem:

    [pylog, datarefinitiv] = evalc("py.eikon.get_data('CDXHY5Y=MP', 'TR.MIDSPREAD.Date,TR.MIDSPREAD', struct('SDate', '2023-06-01', 'EDate', '2023-07-24', 'Frq', 'D'))");


Answers

  • @Peter.Winkler3

    Thank you for reaching out to us.

    The ek.get_timeseries method can only retrieve the default timeseries view of each RIC. The default view of ITEEU5Y=MP is MID_SPREAD while the default view of CDXHY5Y=MP is MID_PRICE.

    You can use the get_data method instead.

    df, err = ek.get_data(["CDXHY5Y=MP"],
                          ["TR.MIDPRICE","TR.MIDPRICE.Date"],
                          {"SDate":"2023-06-01","EDate":"2023-07-24","Frq":"D"})
    df

    1690171065762.png

    Otherwise, you can use the Refinitiv Data Library for Python instead.

    The examples are on GitHub.

    1690170079240.png


  • Many thanks for your support and the clarification!

    I haven't been aware of that property of the get_timeseries function.


    I am now using the get_data function and succeeded in retrieving data from the desired field:

    [pylog,datarefinitiv]= evalc('py.eikon.get_data(''CDXHY5Y=MP'',''TR.MIDSPREAD.Date,TR.MIDSPREAD'')');

    1690184124630.png


    Unfortunately, I cannot completely replicate your example (i.e. the specification of start and end time as well as daily frequency) when calling the Phython API from the Matlab environment.

    1. df, err = ek.get_data(["CDXHY5Y=MP"],
    2. ["TR.MIDPRICE","TR.MIDPRICE.Date"],
    3. {"SDate":"2023-06-01","EDate":"2023-07-24","Frq":"D"})
    4. df


    Could you maybe also help how to adapt my code line in order to add these additional parameters?


  • @Peter.Winkler3

    We need to check how py.eikon.get_data works.

    It should be a wrapper of Eikon Data API. You need to contact your developers regarding how to set the parameters in py.eikon.get_data.