Search code examples
positiongdataportfoliogoogle-finance

Google Finance API in JavaScript or Python to get Currency exchange rate


I am looking to find a API that I can use in JavaScript or Python to be able to eXchange the currency rates. I need the example of using those APIs too. Do you Guys have any Idea how to find it ? JavaScript or Python portfolio and positions example ?


Solution

  • To retrieve the current exchange rate, you can use the Yahoo finance API (http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=USDINR=X).

    For retrieving the exchange rate of a currency relative to USD for a particular historical date, you can use the Yahoo currency-converter-cache API (http://finance.yahoo.com/connection/currency-converter-cache?date=<YYYYMMDD>).

    I made this simple currency converter module that uses Yahoo Finance API and supports historical date. https://github.com/iqbalhusen/currency_converter.