daily closing prices for fx rates via Python

Description:

Hi, I'm trying to get daily closing prices of bunch of fx rates via Python. However, it doesn't take the starting date and the end date correctly.



da='2015-10-01' a= '2017-12-31'

ccy=['EUR=','EURTRY=','EURAUD=','EURCAD=','EURCHF=','EURGBP=','EURHKD=','EURJPY=','EURKRW=R','EURRUB=','EURSGD=','EURCNY='] fx=ek.get_timeseries(ccy,fields=['CLOSE'], start_date =da, end_date = a, interval='daily')





I tried also to use another funciton but I don't know the correct field, can you please help me out?

fx2=ek.get_data(ccy ,["TR.BID.date","TR.BID"], {"Sdate":da,'EDate': a,})[0]

Thank you in advance

Best Answer

  • Here's an alternative that doesn't require multiple requests.

    da = '2015-10-01' 
    a = '2017-12-31'
    ccy = ['EUR=','EURTRY=','EURAUD=','EURCAD=','EURCHF=',
    'EURGBP=','EURHKD=','EURJPY=','EURKRW=R',
    'EURRUB=','EURSGD=','EURCNY=']
    fx = ek.get_data(ccy,['TR.BIDPRICE.date', 'TR.BIDPRICE'],
    {'SDate':da, 'EDate':a})
    To learn what fields you can use with this request use Formula Builder wizard in Excel or Data Item Browser app in Eikon as described in this tutorial.

Answers