Retrieve historic PAR_YLD and SWAP_SPRD through Eikon Python Data API

We want to retrieve the same data as the below Excel functions do, but through the Eikon Python API.

RHistory("AEURNFI5Y=";"PAR_YLD.Timestamp;PAR_YLD.Close";"START:"&START_DATE_ANALYSIS&" END:"&Value_Date&" INTERVAL:1D";;"NULL:NA TSREPEAT:NO CH:Fd";B12)

RHistory("AEURNFI5Y=";"SWAP_SPRD.Timestamp;SWAP_SPRD.Value";"START:"&START_DATE_ANALYSIS&" END:"&Value_Date&" INTERVAL:1D";;"NULL:NA TSREPEAT:NO CH:Fd";E12)

Using get_timeseries does not seem to work, as it does not accept PAR_YLD or SWAP_SPRD.

Best Answer

  • Hi @tr105

    The Swap Spread is available under TR.SWAPSPREAD field:

    ek.get_data('AEURNFI5Y=',['TR.SWAPSPREAD.date','TR.SWAPSPREAD'],parameters={'SDate':'-30D','EDate':'0D'})

    However PAR_YIELD is not mapped to any TR.xxx field but you can use get_timeseries method where that data resides under CLOSE field.

    ek.get_timeseries('AEURNFI5Y=','CLOSE',start_date='2019-09-01', end_date='2019-09-16')

Answers

  • Thanks for your answer! I suspected this, but thanks a lot for confirming.

    Is this documented somewhere? I.e. how the field names from the Excel API map to the Python API / Data Item Browser.


  • Hi @tr105
    All TR.xxx fields should be accessible both through Excel and API therefore no mapping is required. The tricky part could be with the fields that you retrieve using RHiistory() function as this is taken from another source and you cannot implement the exact field names. I think that this is a matter of time when all data items will be available using the first method. For a now you need to do a trial and error to make sure which field gives you the expected result.
  • Hi @marcin.bunkowski,

    I carefully reviewed your response, but I'm still a bit confused. Let me clarify the situation. Due to the overriding nature of the Workspace Excel plugin, I'm unable to access the Eikon Excel plugin, and unfortunately, there doesn't seem to be a solution for this issue. My objective is to retrieve data for the PAR_YLD field for various indexes such as AEURCYP3M= and AEURCYP6M=. However, I couldn't find the PAR_YLD field on Workspace, and when I tried using the TR function, it returned an error stating "invalid field(s)."

    Here's the formula I used:

    =@RHistory(K7;"PAR_YLD.Timestamp;PAR_YLD.Close";"START:"&$B$4&" END:"&$B$3&" INTERVAL:1D";;"TSREPEAT:NO CH:Fd";J13)

    My question to you is: Do you happen to know which field in Workspace would provide the same data as the PAR_YLD field?

    Thank you for your assistance.

  • Hi @Ruben

    Please try this formula:

    =@RDP.HistoricalPricing("AEURCYP3M=","PAR_YLD1;SWAP_SPRD","START:01-May-2023 END:25-May-2023 INTERVAL:P1D SOURCE:RFV",,"CH:Fd RH:Timestamp",)