项目作者: Formicka

项目描述 :
Exchange rates API is a simple and lightweight free service for current and historical foreign exchange rates & crypto exchange rates.
高级语言: CSS
项目地址: git://github.com/Formicka/exchangerate.host.git
创建时间: 2020-04-23T16:04:18Z
项目社区:https://github.com/Formicka/exchangerate.host

开源协议:

下载


Exchangerate.host


ExchangeRate is a free API for current and historical foreign exchange rates published by the European Central Bank.

A public instance of the API lives at locations:

Rates are updated around midnight UTC every working day.

Community libraries

Usage

Get the all available currencies.

  1. GET https://api.exchangerate.host/symbols

Get the latest foreign exchange rates.

  1. GET https://api.exchangerate.host/latest

Get historical rates for any day since 1999.

  1. GET https://api.exchangerate.host/2000-01-03

Rates are quoted against the Euro by default. Quote against a different currency by setting the base parameter in your request.

  1. GET https://api.exchangerate.host/latest?base=USD

Request specific exchange rates by setting the symbols parameter.

  1. GET https://api.exchangerate.host/latest?symbols=USD,GBP

Currency conversion endpoint, can be used to convert any amount from one currency to another.

  1. GET https://api.exchangerate.host/convert?from=EUR&to=USD

Timeseries endpoint are for daily historical rates between two dates of your choice, with a maximum time frame of 365 days.

  1. GET https://api.exchangerate.host/timeseries?start_date=2020-01-01&end_date=2020-04-04&symbols=EUR,USD,GBP

Using the fluctuation endpoint you will be able to retrieve information about how currencies fluctuate on a day-to-day basis.

  1. GET https://api.exchangerate.host/fluctuation?start_date=2020-01-01&end_date=2020-04-04&symbols=EUR,USD,GBP

The primary use case is client side. For instance, with money.js in the browser

  1. let demo = () => {
  2. let rate = fx(1).from("GBP").to("USD")
  3. alert("£1 = $" + rate.toFixed(4))
  4. }
  5. fetch('https://api.exchangerate.host/latest')
  6. .then((resp) => resp.json())
  7. .then((data) => fx.rates = data.rates)
  8. .then(demo)

Backers

Thank you to all our backers! 🙏 [Become a backer]

backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

sponsor81
sponsor0
sponsor1
sponsor2
sponsor3
sponsor4
sponsor5
sponsor6
sponsor7
sponsor8
sponsor9