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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
5 1 1 3

Trying to get forex forward curve historic, problems with NDA_RAW fields and Spot Date

Hi, I'm trying to get the EUR (for example) forward curve from yesterday and the day before.

So, in Excel, I got:

=@RHistory("EUR1M=";"NDA_RAW.Nda_date;NDA_RAW.Nda_ask;NDA_RAW.Nda_bid;NDA_RAW.Nda_days_maturity";"START:2020-10-07 END:2020-10-14 CODE:MULTI INTERVAL:1D";;"CH:IN;Fd";)

This gives me the Date, Bid, Ask and Days for Maturity for the 1M vertice. But NO Spot Date is given.

Even so, I tried:

get_data(instruments = "EUR1M=",
         fields = list("NDA_RAW.Nda_date", "NDA_RAW.Nda_ask", "NDA_RAW.Nda_bid", "NDA_RAW.Nda_days_maturity"),
         parameters = list("Frq" = "D",
                           "SDate" = format(Sys.Date() - 7, "%Y-%m-%d"),
                           "EDate" = format(Sys.Date() - 1, "%Y-%m-%d")))

and

get_timeseries(rics = "EUR1M=",
               fields = list("NDA_RAW.Nda_date", "NDA_RAW.Nda_ask", "NDA_RAW.Nda_bid", "NDA_RAW.Nda_days_maturity"),
               interval = "daily",
               start_date = paste0(Sys.Date() - 7, "T00:00:00"),
               end_date = paste0(Sys.Date() - 1, "T00:00:00"))

But none work.

If I want the Spot Date, in Excel:

=@TR("EUR1M=";"GV1_DATE;MATUR_DATE;DAYS_MAT";"Frq=D SDate=0 EDate=-8 CH=Fd RH=IN CODE=MULTI";G6)

Unfortunately this gives me just the Spot Date for the current cotation, NOT the yesterday or some historical date.

There are other problems like.. I want the outright and the RIC to gives me that is EUR1MV=, but this RIC don't work as well. This solution will have to be extended later to all tenors: SN, SW, 2W, 3W, 1M, 2M, ... 11M, 1Y, ... 2Y and other currencies.

What is the best way (preference in R or Python) to get those information, so I can have a table like that:

RIC    | Date       | Spot       | Expiring   | Mat_Days | Bid      | Ask
EUR1M= | 2020-10-14 | 2020-10-16 | 2020-11-16 | 31       | 1.169484 | 1.169718
EUR1M= | 2020-10-13 | 2020-10-15 | 2020-11-16 | 32       | 1.169524 | 1.170026
eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonpricingr
icon clock
10 |1500

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

Upvotes
Accepted
18k 21 12 20

Hi @ty

Please refer to the answer from this question.


And this is more information for your API call.

1. Eikon Data API (get_timeseries) cannot access to view other than RIC's default view.


2. GV1_DATE, MATUR_DATE and DAYS_MAT fields are from realtime database so it does not support timeseries retrieval.

You can use "Data Item Browser" to check the fields supported parameters.


ahs1.png (111.4 KiB)
ahs2.png (68.4 KiB)
icon clock
10 |1500

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

Upvote
3.8k 4 4 6

Hi @ty

I think that you can still make it using the example privided in this answer and doing it for series of valuation dates. The same can be done with tenors.

for single_date in daterange(start_date, end_date):
    tenor="1M"
    crosscode="EURUSD"   
    fwd_contract = cross.Definition(fx_cross_code=crosscode,
                                    instrument_tag=crosscode[:3]+tenor,
                                    fx_cross_type='FxForward',
                                    legs = [cross.LegDefinition(tenor=tenor)])
    response = fc.get_cross_analytics(fwd_contract, 
                                      fields = ['InstrumentTag', 'ValuationDate','StartDate','EndDate','FxSwapsCcy1Ccy2'],
                                      calculation_params = cross.CalculationParams(valuation_date=single_date.strftime("%Y-%m-%d")))
    result.append(response.data.df)
df = pd.concat(result)
df['StartDate'] = pd.to_datetime(df['StartDate'])
df['EndDate'] = pd.to_datetime(df['EndDate'])
df['ValuationDate'] = pd.to_datetime(df['ValuationDate'])
df["Mat_days"]= df['EndDate']-df['StartDate'] 
df["StartDate"] = df["StartDate"].dt.strftime("%Y-%m-%d")
df["EndDate"] = df["EndDate"].dt.strftime("%Y-%m-%d")
df["ValuationDate"] = df["ValuationDate"].dt.strftime("%Y-%m-%d")
df


ahs.jpg (32.5 KiB)
icon clock
10 |1500

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

Thank you @marcin.bunkowski! I'm trying to get the most from Refinitiv APIs, but it's hard sometimes to get what I want. Do you recomend any manual to learn more? I just use get.data and get.timeseries with DIB, but you gave me this new library solution and someone show me the raw_output option for another problem; both great solutions.

Click below to post an Idea Post Idea