简体   繁体   English

使用 Yahoo Finance API 的实时货币汇率

[英]Live currency rate using Yahoo Finance API

Live currency rate using Yahoo Finance API works perfectly in India, but not working in UAE.使用 Yahoo Finance API 的实时货币汇率在印度运行良好,但在阿联酋不起作用。 Is their any IP checking for getting this value using Yahoo Finance API?他们是否有任何 IP 检查以使用 Yahoo Finance API 获取此值?

We have done this using Yahoo Finance API using JavaScript and PHP.我们使用 JavaScript 和 PHP 使用 Yahoo Finance API 完成了这项工作。 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?任何人都可以建议任何其他免费 API 来获取实时货币汇率,而无需使用 JavaScript/jQuery 和 PHP 检查任何 IP 地址?

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/您可以在此处查看代码示例: 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.在过去的几年里,我一直在使用基于雅虎货币 API 的货币小部件,但它突然停止工作。 As the code above is different, I wonder if yahoo changed the code or is simply having problems.由于上面的代码不同,我想知道是yahoo更改了代码还是只是有问题。 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 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/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 ! calculatorexpress.com 目前在他们的免费计划中提供免费的 ssl 加密,这令人印象深刻!

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.您可以尝试SWOP 货币汇率 API ,这是一个由 Developers for Developers 制作的易于使用、快速、可靠和透明的外汇汇率 API。

  • The SWOP API offers rates for 190+ currencies. SWOP API 提供 190 多种货币的汇率。 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 SWOP API 有两个 GraphQL 和 REST/JSON 端点,以方便您使用
  • There's a free plan allowing 1,000 requests per month.有一个免费计划,每月允许 1,000 个请求。 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完全免责声明:我是 SWOP 的开发人员之一

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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