如何通过 Google Finance 等 API 获取货币汇率?
现在,我确实找到了 Google Finance API 并开始浏览它,但我发现了很多有关投资组合、交易、头寸和信息的信息其他我一无所知的事情。
我看错文档了吗?我需要做什么才能从 GF 获取汇率信息?这可能吗?
编辑
让事情变得更清楚一些。我对技术内容不感兴趣,也不想要任何代码。
Now, I did find the Google Finance API and started looking through that but I found a lot of info about portfolios, transactions, positions & other stuff I know nothing about.
Am I looking at the wrong docs? What do I need to do to get a feed of exchange rates from GF? Is this even possible?
EDIT
To make things a little clearer. I'm not interested in technical stuff nor do I want any code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
感谢您的所有回答。
免费的currencyconverterapi:
的 API 密钥。示例转换 URL 为:http://free.currencyconverterapi。 com/api/v5/convert?q=EUR_USD&compact=y
对于后代,它们与其他可能的答案一起:
Yahoo Finance API已停产 2017-11-06# ##自 2017-11-06 起停止并显示消息
请求:http://finance .yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=USDINR=X
此 CSV 被名为 咖喱。由于稳定性问题,Curry 自 (2017-08-29) 起改用 fixer.io。
如果您需要的不仅仅是 CSV,这可能会很有用。
http://query.yahooapis.com/v1/public/yql? q=select * from yahoo.finance.xchange 其中配对 ("USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK", "USDGBP", "USDHUF", "USDLTL", "USDLVL", “USDPLN”、“USDRON”、“USDSEK”、“USDCHF”、“USDNOK”、“USDHRK”、“USDRUB”、“USDTRY”、“USDAUD”、“USDBRL”、“USDCAD”、“USDCNY”、“USDHKD” "、"USDIDR"、"USDILS"、"USDINR"、"USDKRW"、"USDMXN"、"USDMYR"、"USDNZD"、"USDPHP"、"USDSGD"、"USDTHB"、"USDZAR"、"USDISK") &env=store://datatables.org/alltableswithkeys
这是
YQL 查询生成器,您可以在其中测试查询并复制 url:(不再可用)http://developer.yahoo.com/yql/console/?q =show%20tables&env=store://datatables.org/alltableswithkeys#h=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDMXN%22%2C%20% 22USDCHF%22%29开源汇率 API
免费供个人使用(每月 1000 次点击)
免费帐户中不允许更改“基础”(从“美元”)
需要注册。
请求:http://openexchangerates.org/latest.json
响应:
currencylayer API
免费计划每月 100 次点击
免费帐户中不允许更改“来源”(从“美元”)
需要注册。
文档:currencylayer.com/documentation
JSON 响应:
CurrencyFreaks API
免费计划(每月 1000 次点击)
免费帐户中不允许更改“基础”(从“美元”)
需要注册
数据每 60 秒更新一次。
全球 179 种货币,包括货币、金属和加密货币
支持(即使是免费计划)Shell、Node.js、Java、Python、PHP、Ruby、JS、C#、C、Go、Swift。
文档:https://currencyfreaks.com/documentation.html
端点:
JSON 响应:
Fixer.io API(欧洲央行数据)
每月 100 次点击的免费计划
免费帐户中不允许更改“来源”(从“美元”)
需要注册。
此 API 端点已弃用,并将于 2018 年 6 月 1 日停止工作。有关更多信息,请访问:https://github.com/fixerAPI/fixer#readme)
Website : http://fixer.io/
Example request :
[http://api.fixer.io/latest?base=USD][7]
Only collects one value per each day
欧洲央行动态
文件:
http://www.ecb.int/stats/交换/eurofxref/html/index.en.html#dev
请求:http://www.ecb.int/stats/eurofxref/eurofxref- daily.xml
XML 响应:
exchangeratesapi.io
根据该网站:
This service is compatible with fixer.io and is really easy to use:
no API key needed- UPDATE: API key is now needed, free tier is 250 requests/mo.For example (this uses CURL, but you can use your favorite requesting tool):
CurrencyApi.net
免费计划每月 1250 次点击
150 种加密货币和实物货币 - 实时更新
免费帐户上的基础货币设置为美元
需要注册。
文档:currencyapi.net/documentation
JSON 响应:
来自 LabStack 的货币
更新:这些链接当前不起作用(2024 年 6 月)。也许停产了。
网站:https://labstack.com/currency
文档:https://labstack.com/docs/api/currency/convert< br>
定价:https://labstack.com/pricing
请求:https://currency.labstack.com/api/v1/兑换/1/美元/印度卢比
响应:
1: http://query.yahooapis.com/v1/public/yql?q=select * 来自 yahoo.finance.xchange,其中配对 ("USDEUR"、"USDJPY"、"USDBGN"、"USDCZK"、"USDDKK"、"USDGBP"、"USDHUF"、"USDLTL"、"USDLVL"、"USDPLN" , "USDRON", "USDSEK", "USDCHF", "USDNOK", "USDHRK", "USDRUB", "USDTRY", "USDAUD", "USDBRL", "USDCAD", "USDCNY", "USDHKD", " USDIDR”、“USDILS”、“USDINR”、“USDKRW”、“USDMXN”、“USDMYR”、“USDNZD”、“USDPHP”、“USDSGD”、“USDTHB”、“USDZAR”、“USDISK”)&env =store://datatables.org/alltableswithkeys
currency-api
文档:链接
请求: https://cdn.jsdelivr .net/npm/@fawazahmed0/currency-api@latest/v1/currencies/eur.json
请求(后备): https://latest.currency-api.pages .dev/v1/currencies/eur.json
响应:
QWeb 的货币 API
文档:链接
示例请求:
示例响应:
Thanks for all your answers.
Free currencyconverterapi:
A sample conversion URL is: http://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=y
For posterity here they are along with other possible answers:
Yahoo finance APIDiscontinued 2017-11-06###Discontinued as of 2017-11-06 with message
Request: http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=USDINR=X
This CSV was being used by a jQuery plugin called Curry. Curry has since (2017-08-29) moved to use fixer.io instead due to stability issues.
Might be useful if you need more than just a CSV.
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK", "USDGBP", "USDHUF", "USDLTL", "USDLVL", "USDPLN", "USDRON", "USDSEK", "USDCHF", "USDNOK", "USDHRK", "USDRUB", "USDTRY", "USDAUD", "USDBRL", "USDCAD", "USDCNY", "USDHKD", "USDIDR", "USDILS", "USDINR", "USDKRW", "USDMXN", "USDMYR", "USDNZD", "USDPHP", "USDSGD", "USDTHB", "USDZAR", "USDISK")&env=store://datatables.org/alltableswithkeys
Here is the
YQL query builder, where you can test a query and copy the url: (NO LONGER AVAILABLE)http://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys#h=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDMXN%22%2C%20%22USDCHF%22%29Open Source Exchange Rates API
Free for personal use (1000 hits per month)
Changing "base" (from "USD") is not allowed in Free account
Requires registration.
Request: http://openexchangerates.org/latest.json
Response:
currencylayer API
Free Plan for 100 monthly hits
Changing "source" (from "USD") is not allowed in Free account
Requires registration.
Documentation: currencylayer.com/documentation
JSON Response:
CurrencyFreaks API
Free Plan (1000 hits per month)
Changing 'Base' (From 'USD') is not allowed in free account
Requires registration
Data updated every 60 sec.
179 currencies worldwide including currencies, metals, and cryptocurrencies
Support (Even on the free plan) Shell,Node.js, Java, Python, PHP, Ruby, JS, C#, C, Go, Swift.
Documentation: https://currencyfreaks.com/documentation.html
Endpoint:
JSON Response:
Fixer.io API (European Central Bank data)
Free Plan for 100 monthly hits
Changing "source" (from "USD") is not allowed in Free account
Requires registration.
This API endpoint is deprecated and will stop working on June 1st, 2018. For more information please visit: https://github.com/fixerAPI/fixer#readme)
Website : http://fixer.io/
Example request :
[http://api.fixer.io/latest?base=USD][7]
Only collects one value per each day
European Central Bank Feed
Docs:
http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html#dev
Request: http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
XML Response:
exchangeratesapi.io
According to the website:
This service is compatible with fixer.io and is really easy to use:
no API key needed- UPDATE: API key is now needed, free tier is 250 requests/mo.For example (this uses CURL, but you can use your favorite requesting tool):
CurrencyApi.net
Free Plan for 1250 monthly hits
150 Crypto and physical currencies - live updates
Base currency is set as USD on free account
Requires registration.
Documentation: currencyapi.net/documentation
JSON Response:
Currency from LabStack
UPDATE: These links aren't currently working (June 2024). Maybe discontinued.
Website: https://labstack.com/currency
Documentation: https://labstack.com/docs/api/currency/convert
Pricing: https://labstack.com/pricing
Request: https://currency.labstack.com/api/v1/convert/1/USD/INR
Response:
1: http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK", "USDGBP", "USDHUF", "USDLTL", "USDLVL", "USDPLN", "USDRON", "USDSEK", "USDCHF", "USDNOK", "USDHRK", "USDRUB", "USDTRY", "USDAUD", "USDBRL", "USDCAD", "USDCNY", "USDHKD", "USDIDR", "USDILS", "USDINR", "USDKRW", "USDMXN", "USDMYR", "USDNZD", "USDPHP", "USDSGD", "USDTHB", "USDZAR", "USDISK")&env=store://datatables.org/alltableswithkeys
currency-api
Documentation: Link
Request: https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/eur.json
Request(Fallback): https://latest.currency-api.pages.dev/v1/currencies/eur.json
Response:
QWeb's Currency API
Documentation: Link
Example request:
Example response:
欧洲中央银行 (ECB) 也拥有据我所知最可靠的免费资料。它包含大约 28 种货币,并且至少每天更新。
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
有关更多格式和工具,请参阅欧洲央行参考页面:
http://www.ecb.int/stats/exchange/eurofxref /html/index.en.html
The European Central Bank (ECB) also has the most reliable free feed that I know of. It contains approx 28 currencies and is updated at least daily.
http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml
For more formats and tools see the ECB reference page:
http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
如果您需要一个免费且简单的 API 将一种货币转换为另一种货币,请尝试 free.currencyconverterapi.com。
免责声明,我是该网站的作者,我将其用于我的其他网站之一。
即使是商业应用,该服务也可以免费使用,但不提供任何保证。出于性能原因,这些值仅每小时更新一次。
示例转换 URL 为:http ://free.currencyconverterapi.com/api/v6/convert?q=EUR_PHP&compact=ultra&apiKey=sample-api-key 将返回 json 格式的值,例如 {"EUR_PHP":60.849184 }
If you need a free and simple API for converting one currency to another, try free.currencyconverterapi.com.
Disclaimer, I'm the author of the website and I use it for one of my other websites.
The service is free to use even for commercial applications but offers no warranty. For performance reasons, the values are only updated every hour.
A sample conversion URL is: http://free.currencyconverterapi.com/api/v6/convert?q=EUR_PHP&compact=ultra&apiKey=sample-api-key which will return a json-formatted value, e.g. {"EUR_PHP":60.849184}
此 API 已停用
雅虎有一个 YQL 功能,可以一次性以 XML 或 JSON 形式获取一大堆货币。我注意到,欧洲央行拥有一天前的数据时,数据会按分钟更新,并在周末停止。
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange 其中 ("USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK "、"USDGBP"、"USDHUF"、"USDLTL"、"USDLVL"、"USDPLN"、"USDRON"、"USDSEK"、"USDCHF"、"USDNOK"、"USDHRK"、"USDRUB"、"USDTRY"、 “USDAUD”、“USDBRL”、“USDCAD”、“USDCNY”、“USDHKD”、“USDIDR”、“USDILS”、“USDINR”、“USDKRW”、“USDMXN”、“USDMYR”、“USDNZD”、“USDPHP ", "USDSGD", "USDTHB", "USDZAR", "USDISK")&env=store://datatables.org/alltableswithkeys
这是他们的查询生成器,您可以在其中测试查询并复制网址:
http://developer.yahoo.com/yql/console/? q=show%20tables&env=store://datatables.org/alltableswithkeys#h=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDMXN%22%2C%20 %22美元瑞郎%22%29
This api is decommissioned
Yahoo has a YQL feature to get a whole bunch of currencies at once in XML or JSON. I've noticed the data is up to date by the minute where the ECB has day old data, and stops in the weekend.
http://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.xchange where pair in ("USDEUR", "USDJPY", "USDBGN", "USDCZK", "USDDKK", "USDGBP", "USDHUF", "USDLTL", "USDLVL", "USDPLN", "USDRON", "USDSEK", "USDCHF", "USDNOK", "USDHRK", "USDRUB", "USDTRY", "USDAUD", "USDBRL", "USDCAD", "USDCNY", "USDHKD", "USDIDR", "USDILS", "USDINR", "USDKRW", "USDMXN", "USDMYR", "USDNZD", "USDPHP", "USDSGD", "USDTHB", "USDZAR", "USDISK")&env=store://datatables.org/alltableswithkeys
Here is their query builder, where you can test a query and copy the url:
http://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys#h=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDMXN%22%2C%20%22USDCHF%22%29
以下是一些使用 PHP 进行交换 API 的示例。
[ 开放汇率 API ]
每月免费提供 1,000 个请求。您必须注册并获取 App ID。免费账户的基础货币为美元。检查支持的货币和文档。
[ 货币层 API ]
每月免费提供 1,000 个请求。您必须注册并获取访问密钥。免费帐户不支持自定义基础货币。查看文档。
Here are some exchange APIs with PHP example.
[ Open Exchange Rates API ]
Provides 1,000 requests per month free. You must register and grab the App ID. The base currency USD for free account. Check the supported currencies and documentation.
[ Currency Layer API ]
Provides 1,000 requests per month free. You must register and grab the Access KEY. Custom base currency is not supported in free account. Check the documentation.
除了通过IP进行地理定位之外,您还可以尝试geoplugin
(但IP是提供商IP,所以不太准确) ,它们还返回货币并具有货币转换器:请参阅示例。
他们更新了 111 种货币。
You can try geoplugin
Beside the geolocation done by IP (but the IP is the provider IP, so not so accurate), they return currencies also and have a currency converter: see examples.
They have 111 currencies updated.
如果您正在寻找基于 ruby 的解决方案来解决此问题,我建议使用 Google 计算器方法,该解决方案类似于以下内容:http ://j.mp/QIC564
If you're looking for a ruby based solution for this problem, I recommend using the Google Calculator method a solution similar to the following: http://j.mp/QIC564
这是一个简单的 PHP 脚本,它获取英镑和美元之间的汇率
谷歌货币汇率不准确谷歌自己说 ==> Google 无法保证计算器使用的汇率的准确性。在进行可能受汇率变化影响的任何交易之前,您应该确认当前汇率。花旗银行 NA 提供的外币汇率根据许可显示。价格仅供参考,如有更改,恕不另行通知。实际交易的汇率可能会有所不同,花旗银行不提供以任何显示的汇率进行任何交易。
Here is one simple PHP Script which gets exchange rate between GBP and USD
Google currency rates are not accurate google itself says ==> Google cannot guarantee the accuracy of the exchange rates used by the calculator. You should confirm current rates before making any transactions that could be affected by changes in the exchange rates. Foreign currency rates provided by Citibank N.A. are displayed under licence. Rates are for information purposes only and are subject to change without notice. Rates for actual transactions may vary and Citibank is not offering to enter into any transaction at any rate displayed.
对于所有寻找有关货币兑换提示的新手,请查看此链接。 Datavoila
它对我自己的 C# 项目帮助很大。以防万一该网站消失,我将添加下面的代码。只需将以下步骤添加到您自己的项目中即可。抱歉格式问题。
For all newbie guys searching for some hint about currency conversion, take a look at this link. Datavoila
It helped med a lot regarding my own project in C#. Just in case the site disappears, I'll add the code below. Just add the below steps to your own project. Sorry about the formatting.