fx swap maturity

Hi,

I'm trying to get historical data for fx swaps in jupyter notebook (date, close , days_maturity). ek.get_timeseries only seems to show OHLC and volume.

I'm not quite sure on how to use the ek.get_date.

sd = "2020-06-01"

ed = "2020-06-05"

df,err= ek.get_data(["JPY1M=","JPY2M="],

['CF_DATE','CF_Last',"DAYS_MAT"],

{"SDate":sd, "Edate":ed})


Best Answer

  • chavalit-jintamalit
    Answer ✓

    Hi @gchiam

    I am not Eikon Excel expert, but I can confirm that the "DAYS_MAT" and "MID_PRICE" fields that are exposed to Eikon Data API(Python) do not support timeseries.

    image


    However, I found these fields (I was hoping that Refinitiv Content Helpdesk would be able to give you these fields)

    ['TR.MIDPRICE.Date','TR.MIDPRICE','TR.DAYSTOMATURITY.Date','TR.DAYSTOMATURITY'],

    image

Answers

  • Hello @gchiam

    To use get_data() function, you can refer to "Data Item Browser" which lists all fields and their parameters that you can set in this function.

    Please refer to Using DIB as Reference section in this tutorial for more details of "Data Item Browser"

  • Hi @gchiam

    These fields (['CF_DATE','CF_Last',"DAYS_MAT"], ) are from a Realtime database, so they do not support SDate, EDate, and historical data retrieval.

    I tried to locate the close, date, and days_maturity using "Data Item Browser" but I could not locate them. (I am not a content expert)

    You can try using "Data Item Browser" following this tutorial.

    Or you can contact Refinitiv Content Helpdesk to clarify if there are any fields carrying the information you are looking for.


    I do have a quick question here.

    From the data you can retrieve:

    image

    Can you calculate the data you need following this code:

    image


    df1,e = ek.get_data('JPY1M=','MATUR_DATE')
    df1

    df2 = ek.get_timeseries('JPY1M=', fields='Close', start_date='2020-06-01', end_date='2020-06-05')
    df2

    import datetime

    date_time_obj = datetime.datetime.strptime(df1['MATUR_DATE'][0], '%Y-%m-%d')
    date_time_obj

    df2['days_maturity'] = date_time_obj- df2.index
    df2
  • Hi,

    Thanks for the reply. I looked through the examples shown on the tutorial, it doesn't touch on FX swaps, and hence am not too sure about the DIB or the correct formatting. The problem with subtracting from df1 index is that the maturity dates are incorrect.

    Df1 shows you today's 1m FX Swap maturity date. A 1June 1m FX swap will not have the same maturity date as the 8th june swap. Hence subtracting 8-jun fx swap from the historical data will not reflect the actual days to maturity. As shown in the df2 where days to maturity increase by 1 day each timestamp. When days to maturity should actually stay approx 30 days.

    Regards,

    Gerald




  • HI

    Did this in excel using the function builder. Not excatly sure what NDA_RAW means. But seems to be the excel solution.

    =RHistory("JPY1M=","NDA_RAW.Nda_date;NDA_RAW.Nda_days_maturity;NDA_RAW.Nda_mid","INTERVAL:1D",,"CH:Fd",D29)

    But I can't find this fields in python using get_data ()

    Regards,

    Gerald

  • Hi @gchiam

    Excel - RHistory can select data views (In this case you are selecting NDA_RAW view).

    Eikon Data API(Python) - cannot select view, it is only able to retrieve default views. (default view depends on individual item)


    Df1 shows you today's 1m FX Swap maturity date. A 1June 1m FX swap will not have the same maturity date as the 8th june swap. Hence subtracting 8-jun fx swap from the historical data will not reflect the actual days to maturity. As shown in the df2 where days to maturity increase by 1 day each timestamp. When days to maturity should actually stay approx 30 days.

    I am sorry, that means my assumption of the maturity date - date = days in maturity is incorrect. (I am not a content expert)

    In this case, you should contact Refinitiv Content Helpdesk to confirm if there is any fields carrying historical information which should be available on "Data Item Browser" (note that NDA_RAW view from RHistory is not retrievable with Eikon Data API Python)

    "Data Item Browser" is just a tool which you can use it to explore any available fields base on individual instrument.

  • Hi,

    On the data item browser, is there a way to filter for fields that are supported by the historical data retrieval (more specifically, prices and maturity dates), and for fields that are retrievable by python API?

    How should i contact the refinitiv content helpdesk? I reached out to the thomson reuters live agent and they directed me to post my questions on this site.

    Regards,
    Gerald

  • is there a way to filter for fields that are supported by the historical data retrieval

    - I think you can select it on the DIBimage


    and for fields that are retrievable by python API?

    - All the fields you see in DIB is retrievable on Eikon Data API(Python) with the same value you see on DIB


    How should i contact the refinitiv content helpdesk? I reached out to the thomson reuters live agent and they directed me to post my questions on this site.

    - You can raise a ticket to helpdesk at https://my.refinitiv.com/

    And ask them to provide a sample on Eikon Excel using =TR function Do not use RHistory function because if the default view on an instrument is not the same as the view you use on Eikon Excel, then it is not retrievable using API.

    This website is for technical question so usually when helpdesk see the "API" in the question, they usually redirect users to this website.

    However, your questions are about content, not the API technical question.

  • Hi ,


    I reached out the the helpdesk. This was the result they returned, they weren't able to get historical dates.

    =TR("JPY1M=","DAYS_MAT;MID_PRICE","Frq=D SDate=2020-05-01 EDate=2020-05-30 CH=Fd")

    Excel Result:

    image

    Python Result:

    image

    Why does python only produce one line item?

    Regards,
    Gerald