简体   繁体   中英

Live currency rate using Yahoo Finance API

Live currency rate using Yahoo Finance API works perfectly in India, but not working in UAE. Is their any IP checking for getting this value using Yahoo Finance API?

We have done this using Yahoo Finance API using JavaScript and PHP. The code is given below.

function currencyConverter(currency_from,currency_to,currency_input){
    var yql_base_url = "https://query.yahooapis.com/v1/public/yql";
    var yql_query = 'select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("'+currency_from+currency_to+'")';
    var yql_query_url = yql_base_url + "?q=" + yql_query + "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
    var http_response = httpGet(yql_query_url);
    var http_response_json = JSON.parse(http_response);

    return http_response_json.query.results.rate.Rate;
}

Can any one suggest any other free API for getting live currency rates without having any IP address checking using JavaScript/jQuery and PHP?

Google has a currency conversion tool, which can be used easily . You can see the code sample here : http://www.stepblogging.com/how-to-convert-currency-using-google-api-and-php/

For the past couple of years I've been using a currency widget based on yahoo currency API, and it has suddenly stopped working. As the code above is different, I wonder if yahoo changed the code or is simply having problems. I used to be able to access it directly by putting the following url in the address bar but it no longer works either.

http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ( "EURAED","EURARS","EURAUD","EURAWG","EURBAM","EURBBD","EURBDT","EURBGN","EURBHD","EURBMD","EURBOB", "EURBRL","EURBSD","EURCAD","EURCHF","EURCLP","EURCNY","EURCOP","EURCYP","EURCZK","EURDKK","EURDOP", "EUREGP","EUREUR","EURFJD","EURGBP","EURGHS","EURGMD","EURGTQ","EURHKD","EURHRK","EURHUF","EURIDR", "EURILS","EURINR","EURIRR","EURISK","EURJMD","EURJOD","EURJPY","EURKES","EURKHR","EURKRW","EURKWD", "EURLAK","EURLBP","EURLKR","EURLTL","EURLVL","EURMAD","EURMDL","EURMGA","EURMKD","EURMUR","EURMVR", "EURMXN","EURMYR","EURNAD","EURNGN","EURNOK","EURNPR","EURNZD","EUROMR","EURPAB","EURPEN","EURPHP", "EURPKR","EURPLN","EURPYG","EURQAR","EURRON","EURRSD","EURRUB","EURSAR","EURSCR","EURSEK","EURSGD", "EURSYP","EURTHB","EURTND","EURTRY","EURTWD","EURUAH","EURUGX","EURUSD","EURUYU","EURVEF","EURVND", "EURXAF","EURXCD","EURXOF","EURXPF","EURZAR")&env=store://datatables.org/alltableswithkeys

Here is simple currency conversion at

https://calculatorexpress.com/currency-free-api/

 https://calculatorexpress.com/FOREX/EXCHANGE/?API=YOUR_API_KEY&from=BASE_CURRENCY&to=COMPACT_CURRENCY //Replace YOUR_API_KEY with free API from the site // Replace 'from' with your base currency (usd,aud etc.) // Replace 'to' with your 2nd currency // ------------- Example --------------- https://calculatorexpress.com/FOREX/EXCHANGE/?API=YOUR_API_KEY&from=usd&to=aud //you can call the coversion rate with ajax request!

calculatorexpress.com is currently providing free ssl encryption in their free plan which is quit impressive !

You can try SWOP currency exchange rate API , an easy to use, fast, reliable and transparent foreign exchange rate API made from Developers for Developers.

  • The SWOP API offers rates for 190+ currencies. They are gathered directly from trusted sources like European Central Bank, International Money Fund and various National Banks.
  • The SWOP API has two GraphQL and REST/JSON endpoints for your ease of use
  • There's a free plan allowing 1,000 requests per month. This can be enough with some server-side caching, otherwise there are plans with much more requests.

Full disclaimer: I'm one of the developers of SWOP

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM