通过 MATLAB 中的 Web 服务进行货币汇率
How can I obtain the current exchange rate for two given currencies in matlab?
I tried this one, however it seems that the web service is no longer available.
Is there another easy way of obtaining the up-to-date currency exchange rates through a web service in matlab?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 CREATECLASSFROMWSDL 从货币转换 Web 服务构建本地类。然后,您可以使用 Web 服务的操作来使用类方法进行转换。 http://www.webservicex.net/ 提供了一种货币换算 Web 服务(有多种)货币转换器.asmx?WSDL。下面是它的使用示例:
请注意,ConversionRate 返回一个 char 数组,即如果您想使用汇率进行计算,您仍然需要使用 str2double 转换结果。
货币缩写列表位于 http://www.webservicex.net/ ws/wsdetails.aspx?wsid=10。
Build a local class from a currency conversion web service using CREATECLASSFROMWSDL. You can then use the web service's operations to do the conversion using the class methods. One currency conversion web service (there are many) is available at http://www.webservicex.net/CurrencyConvertor.asmx?WSDL. Here's an example of its use:
Note that ConversionRate returns a char array, i.e. you still have to convert the result with str2double if you want to do calculations with the exchange rate.
A list of the currency abbreviations is available at http://www.webservicex.net/ws/wsdetails.aspx?wsid=10.
这是一个老问题,但我想我会更新答案。我在 MATLAB (exchangerate.m) 中制作了这个货币转换器函数,该函数利用openexchangerates.org API,它得到了更好的支持,并且还包含历史数据。以下是其工作原理的描述(非常简单):
该函数返回从 openexchangerates.org 获得的汇率
使用他们的 API。为了正确工作,必须连接到
互联网。默认的app_id是从免费帐户到
openexchangerates.org,每月有 1000 个 API 请求的限制。为了
更灵活,注册您自己的免费或付费帐户并替换
app_id 值与您自己的 id 号。
输入:
输出:
示例:
1) 获取比特币和美元之间的最新汇率(注:m 文件中列出了所有国家缩写)
2) 获取所有可用货币的最新汇率
3) 获取兑换使用美国的比特币、印度卢比和欧元汇率
2013年6月5日美元为基础货币
This is an old question, but thought I would update the answer. I made this currency converter function in MATLAB (exchangerate.m) that utilizes the openexchangerates.org API, which is better supported and also includes historical data. Here's a description how it works (it's very simple):
This function returns exchange rates obtained from openexchangerates.org
using their API. To work correctly, one must be connected to the
Internet. The default app_id is from a free account to
openexchangerates.org, which has a limit of 1000 API requests/month. For
more flexibility, sign up for your own free or paid account and replace
the app_id value with your own id number.
Inputs:
Outputs:
Examples:
1) Get the latest exchange rate between Bitcoin and the US Dollar (Note: All country abbreviations are listed in the m-file)
2) Get latest exchange rates for all available currencies
3) Obtain exchange rates for Bitcoin, Indian rupee, and Euro using the US
Dollar as base currency on June 5, 2013