如何通过Google Finance等API获取货币汇率?

2024-04-25 01:47:20 发布

您现在位置:Python中文网/ 问答频道 /正文

现在,我确实找到了Google Finance API并开始查找,但我发现了很多关于投资组合、交易、头寸和其他我一无所知的东西的信息。

我看错医生了吗?我需要做什么才能从广发银行获得汇率信息?这可能吗?

编辑

让事情更清楚一点。我对技术性的东西不感兴趣,也不想要任何代码。


Tags: tocommunity信息isitthispostedit
3条回答

谢谢你的回答。

免费货币兑换API:

  • 每30分钟更新一次速率
  • 现在免费服务器需要API密钥。

示例转换URL是:http://free.currencyconverterapi.com/api/v5/convert?q=EUR_USD&compact=y


对于后人来说,它们和其他可能的答案是:

  1. 雅虎金融API于2017年11月6日停产

    自2017年11月6日起停产,并发出消息

    It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com.

    请求:http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=USDINR=X
    这个CSV被一个名为Curry的jQuery插件使用。自2017年8月29日起,咖喱因稳定性问题改用fixer.io。 如果您需要的不仅仅是CSV,那么它可能很有用。

  2. thanks to KeyoYahoo查询语言让您可以用XML或JSON同时获得大量货币。数据在第二天更新(而欧洲央行有一天的数据),并在周末停止。不需要任何形式的注册。

    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

    这里是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

enter image description here

  1. 开源汇率API

    Free for personal use(每月点击1000次)
    不允许在自由账户中更改“基数”(从“美元”) 需要注册。
    请求:http://openexchangerates.org/latest.json
    回应:

    {
      "disclaimer": "This data is collected from various providers ...",
      "license": "all code open-source under GPL v3 ...",
      "timestamp": 1323115901,
      "base": "USD",
      "rates": {
          "AED": 3.66999725,
          "ALL": 102.09382091,
          "ANG": 1.78992886,
          // 115 more currency rates here ...
      }
    }
    
  2. 电流层API

    Free Plan每月点击250次
    不允许在自由账户中更改“来源”(从“美元”) 需要注册。
    文档:currencylayer.com/documentation

    JSON响应:

    {
      [...]
      "timestamp": 1436284516,
      "source": "USD",
      "quotes": {
          "USDAUD": 1.345352401,
          "USDCAD": 1.27373397,
          "USDCHF": 0.947845302,
          "USDEUR": 0.91313905,
          "USDGBP": 0.647603397,
          // 168 world currencies
          }
      }
    
  3. Fixer.io API(欧洲央行数据)

    每月1000次点击的免费计划
    不允许在自由账户中更改“来源”(从“美元”) 需要注册。

    此API终结点已弃用,将于2018年6月1日停止工作。有关更多信息,请访问:https://github.com/fixerAPI/fixer#readme)


    网站:http://fixer.io/
    示例请求: http://api.fixer.io/latest?base=USD
    每天只收集一个值

  4. 欧洲央行Feed

    文件: http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html#dev
    请求:http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml

    XML响应:

    <Cube>
      <Cube time="2015-07-07">
      <Cube currency="USD" rate="1.0931"/>
      <Cube currency="JPY" rate="133.88"/>
      <Cube currency="BGN" rate="1.9558"/>
      <Cube currency="CZK" rate="27.100"/>
    </Cube>
    
  5. 交换速率pi.io

    根据网站:

    Exchange rates API is a free service for current and historical foreign exchange rates published by the European Central Bank
    此服务与fixer.io兼容,非常易于使用:不需要API密钥。例如(这使用CURL,但您可以使用自己喜欢的请求工具):
    > curl https://api.exchangeratesapi.io/latest?base=GBP&symbols=USD
    {"base":"GBP","rates":{"USD":1.264494191},"date":"2019-05-29"}
    
  6. CurrencyApi.net

    Free Plan每月点击1250次
    自由账户的基础货币设置为美元
    需要注册。
    文档:currencyapi.net/documentation

    JSON响应:

    {
      "valid": true,
      "timestamp": 1567957373,
      "base": "USD",
      "rates": {
              "AED": 3.673042,
              "AFN": 77.529504,
              "ALL": 109.410403,
              // 165 currencies + some cryptos
          }
      }
    
  7. LabStack的货币

    网站:https://labstack.com/currency
    文档:https://labstack.com/docs/api/currency/convert
    定价:https://labstack.com/pricing
    请求:https://currency.labstack.com/api/v1/convert/1/USD/INR
    回复:

     {
       "time": "2019-10-09T21:15:00Z",
       "amount": 71.1488
     }
    

据我所知,欧洲央行(ECB)也有最可靠的免费贷款。它包含大约28种货币,并且至少每天更新一次。

http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml

有关更多格式和工具,请参见ECB参考页: http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html

相关问题 更多 >