GithubHelp home page GithubHelp logo

formicka / exchangerate.host Goto Github PK

View Code? Open in Web Editor NEW
357.0 10.0 33.0 8.52 MB

Exchange rates API is a simple and lightweight free service for current and historical foreign exchange rates & crypto exchange rates.

Home Page: https://exchangerate.host

JavaScript 1.18% HTML 0.28% Vue 16.19% CSS 82.36%
echangerate exchange-rates exchange-api currency-converter currency-exchange-rates currency-api vue api-exchange-rates exchange-rate-forecasting ecb-rates

exchangerate.host's Introduction

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.

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

Get the latest foreign exchange rates.

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

Get historical rates for any day since 1999.

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.

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

Request specific exchange rates by setting the symbols parameter.

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

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

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.

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.

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

let demo = () => {
  let rate = fx(1).from("GBP").to("USD")
  alert("ยฃ1 = $" + rate.toFixed(4))
}

fetch('https://api.exchangerate.host/latest')
  .then((resp) => resp.json())
  .then((data) => fx.rates = data.rates)
  .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

exchangerate.host's People

Contributors

81dr avatar artisticlogicmk avatar arzzen avatar dependabot[bot] avatar ozgurg avatar philshem avatar rehhouari avatar serkanince avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exchangerate.host's Issues

Response showing old date

When querying [https://api.exchangerate.host/latest?base=USD], sometimes I get a response with a date several days old. For example, it's May 27 today, and I'm getting 2021-05-18 in the "date" field. This happens some of the times, on some devices. Removing "?base=USD" fixes the issue.

Website down

I see the website is down as well as the API. Is this temporary?

Date parameter with Time for Crypto?

Is it possible to add DateTime parameter for Crypto rates?

Crypto is really volatile so its important to have the rates with the DateTime and not only Date :)

Currencies Returns "0"

Hey Hi ,
I started to use your fixer currency api , but sometimes I got all currencies returns "0" so it makes my whole calculation 0 after I multiple my values their native currencies. Can you explain what is the reason behind that . I m thinking Im requesting too much as a result of that I got no response.. Please let me know and how to fix it.

Incorrect rates for some currency pairs prior to 2 May 2020

There are some strange results being returned for some currency pairs that include the BTN currency.

For example, for the BTN to SGD rates (https://api.exchangerate.host/timeseries?start_date=2020-04-28&end_date=2020-05-03&base=BTN&symbols=SGD), we see:

{"success":true,"timeseries":true,"base":"BTN","start_date":"2020-04-28","end_date":"2020-05-03","rates":{"2020-04-28":{"SGD":1.537},"2020-04-29":{"SGD":1.5345},"2020-04-30":{"SGD":1.5338},"2020-05-01":{"SGD":0.018711},"2020-05-02":{"SGD":0.018855},"2020-05-03":{"SGD":0.018855}}}

There are some more examples in: stevecondylios/priceR#21

For reference, here are the BTN to SGD rates for the last 5 years according to google (note nothing above around 0.22, but the API shows ~1.5):

image

BTC rates are wrong

Hello,
Thank you for this great API, I Love it ๐Ÿ™๐Ÿป

It Seems like BTC rates are wrong using this endpoint:
https://api.exchangerate.host/latest?base=USD&symbols=BTC
return the following rates which seem to be wrong
{ "success":true, "base":"USD", "date":"2021-07-31", "rates":{ "BTC": 0.000273 } }

According to google BTC rate as of today (Jul-31) is 0.000024
Thanks you

Bid, Ask ?

Hello,
Do you have in your plans to add bid, ask to the values

Incorrect bases reported for timeseries and fluctuation.

The API correctly checks that there is no available data if passing a symbol that isn't in use.
This issue is kind of related to #34, since you don't actually need to pass in a valid currency either.
The same issue can be reproduced if you pass gibberish as a base.
For these examples I'll use ROL, which was replaced in 2006 with RON.

Calling /timeseries?start_date=2020-01-01&end_date=2020-01-03&base=ROL&symbols=USD,EUR,ROL returns:

{
    "motd": {
        "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
        "url": "https://exchangerate.host/#/donate"
    },
    "success": true,
    "timeseries": true,
    "base": "ROL",
    "start_date": "2020-01-01",
    "end_date": "2020-01-03",
    "rates": {
        "2020-01-01": {
            "USD": 1.1221,
            "EUR": 1
        },
        "2020-01-02": {
            "USD": 1.1221,
            "EUR": 1
        },
        "2020-01-03": {
            "USD": 1.1171,
            "EUR": 1
        }
    }
}

You can see that ROL is correctly missing from the rates object, because it isn't active in 2020.
However, the response does say the base is ROL as requested, when in reality it still defaults to EUR, as you can see from the rate being 1:1 with EUR.

In /fluctuation it is a similar story, but with the addition that the base field isn't returned at all.
Calling /fluctuation?start_date=2020-01-01&end_date=2020-01-03&base=ROL&symbols=EUR,USD,ROL returns:

{
    "motd": {
        "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
        "url": "https://exchangerate.host/#/donate"
    },
    "success": true,
    "fluctuation": true,
    "start_date": "2020-01-01",
    "end_date": "2020-01-03",
    "rates": {
        "USD": {
            "start_rate": 1.1221,
            "end_rate": 1.1171,
            "change": 0.005,
            "change_pct": 0.004456
        },
        "EUR": {
            "start_rate": 1,
            "end_rate": 1,
            "change": 0,
            "change_pct": 0
        }
    }
}

This makes it impossible to know whether I received the correct information, as I may unknowingly use another base.

Expected behavior:

  • Setting the base to any symbol outside of its active period (or because of insufficient data) should fail.
  • Fluctuation endpoint should explicitly return the base it was requested with, just to double-check.

All sources except ecb do not seem to work

Hi @arzzen ,

We're considering using this in our applications. To me, it's crazy that you offer this for free, so we're considering donating to you. One small question: for our application, it's important to know from which source the rate originates.

It seems that all sources that are listed under https://api.exchangerate.host/sources all do not work, except for ecb.

For example, if I choose source=imf, I get 0 rates back.

https://api.exchangerate.host/timeseries?start_date=2020-01-01&end_date=2020-01-10&source=imf

If I choose source=ecb, then it works as expected.

https://api.exchangerate.host/timeseries?start_date=2020-01-01&end_date=2020-01-10&source=ecb

If I exclude source=... from the query, then I get more symbols back than if I would've chosen ecb.

https://api.exchangerate.host/timeseries?start_date=2020-01-01&end_date=2020-01-10

The problem is that we need the rates for a symbol that is not included in ecb, but we would also like to know what its source is.

Thank you!

API down

Not related to the actual project, just wanted to let you know the API is completely down. I'm getting an nginx start up page. No other contact means on the website so thought I'd reach out here.

Extend the maximum timeseries length to 366 days

The end-user code required to download historical data over a number of years is slightly complex at the moment. It could be made far simpler if the maximum timeseries length were extended by just an extra day to 366 days to account for leap years.

The pseudocode logic I'd like to be able to use is

for year in range(2017,2021):
    download data from 1st Jan to 31st Dec

Unfortunately I can't use this code with the limit of 365 days as this fails on leap years and misses the 31st Dec.
So the code required to do this at the moment involves taking a start date, doing a bunch of date math adding 365 days, keeping track of start and end dates and and iterating over that. Not as clean.

A change to allow 366 days would just make code simpler!

would this work for a mobile app

hi, I have an app on the app store that is a position size calculator. would I be able to use this for my users?
also how quickly are the exchange rates updated?

Precise range of available historical rates

Historical rates are available for most currencies all the way back to the year of 1999.

I guess most currencies' first available day's data are: 1999-01-01, but there may be a need to find the first available date for those which aren't available from that date. Is there a call to grab the earliest available historical rate for a particular currency (or all currencies)?

Rate Limit

What are the rate limits for the historical rates data?

I am querying on a one-time basis for a lot of historical data and want to ensure I'm not abusing your service.

Throw error when using unsupported base on /latest endpoint

If you call /latests?base=fdsf32423 or with any unsupported symbol, the API is returning EUR data.
/timeseries also has the same behavior.

Would you consider to add some kind of validation and return an error instead?

To compare, fixer.io returns this response:

{
    "success": false,
    "error": {
        "code": 201,
        "type": "invalid_base_currency"
    }
}

API down

Seems like the API is down now. Curling to api.exchangerate.host/latest gives connection refused, and a nginx start up page is visible at api.exchangerate.host. Thought I'd reach out here.

Totally incorrect crypto rates

For example https://api.exchangerate.host/convert?from=ETH&to=USD&amount=1&source=crypto

{
    "motd": {
        "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
        "url": "https://exchangerate.host/#/donate"
    },
    "success": true,
    "query": {
        "from": "ETH",
        "to": "USD",
        "amount": 1
    },
    "info": {
        "rate": 0.002534
    },
    "historical": false,
    "date": "2020-12-16",
    "result": 0.002534
}

image

max rate of demands?

Hei.
Thanks for this great api. I am using it through a third party interface to convert some 3000 currencies. After about one hundred I get the HTTP error 429, even after putting in a 1s sleep between requests. Is there a maximum number of requests per Minute to be aware of? If so, is this in the documentation - I have not seen it. Is there a robot.txt?
Best, Dan

Wrong rates are returned for crypto

I would love to use this API, but it seems currently unusable for its main purpose.
When trying to get the exchange rate for BTC, for instance, the return value is just wrong:
https://api.exchangerate.host/latest?source=crypto&symbols=BTC&base=EUR
returns:

{
  "motd": {
    "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
    "url": "https://exchangerate.host/#/donate"
  },
  "success": true,
  "base": "EUR",
  "date": "2021-07-25",
  "rates": {
    "BTC": 0.000233
  }
}

Although the exchange rate is around 1BTC = 30000โ‚ฌ.
I am aware of #37, but 1/0.00023=4292 so it is not just an issue of inverted rate.

Inverted rates option

Is it possible to have the rates come from the symbol to the base? Or maybe passing multiple bases to a single symbol?

Right now I have to loop through all the symbols and compose the inverted URL for the base and symbol manually.

Old date with USD & EUR

Hi, depending on the base currency, the response features an old date.

Here, everything is fine:
https://api.exchangerate.host/latest -> 2021-06-17

However, with USD and EUR the date is old:
https://api.exchangerate.host/latest?base=USD -> 2021-06-13
https://api.exchangerate.host/latest?base=EUR -> 2021-06-14

But that's only the case with the default source. Take ecb, boc or rba and it's up-to-date, again:
https://api.exchangerate.host/latest?base=USD&source=ecb -> 2021-06-17
https://api.exchangerate.host/latest?base=USD&source=boc -> 2021-06-17
https://api.exchangerate.host/latest?base=USD&source=rba -> 2021-06-17
https://api.exchangerate.host/latest?base=EUR&source=ecb -> 2021-06-17

Can you look into this?

Exchange rates with source crypto is sometimes inverted

Firstly, thank you for your work. Much appreciated.

The issue is the rate of exchange does not respect the order: from -> to for some source=crypto cases.

Example:
https://api.exchangerate.host/convert?from=usd&to=eth&source=crypto

{
  "motd": {
    "msg": "If you or your company use this project or like what we doing, please consider backing us so we can continue maintaining and evolving this project.",
    "url": "https://exchangerate.host/#/donate"
  },
  "success": true,
  "query": {
    "from": "USD",
    "to": "ETH",
    "amount": 1
  },
  "info": {
    "rate": 1145.182585
  },
  "historical": false,
  "date": "2021-02-05",
  "result": 1145.182585
}

Incorrect Response from API for unsupported currencies

Issue:
Consider the currency TMM, which is not supported by this API (which is fine):
While fetching exchange rate TMM -> INR, we get 86.809808. This seems like it defaults to the value of **EUR** to INR
Similarly, TMM -> USD, we get 1.168879. Again value of **EUR** to USD

Rather for any currency that does not exist, lets say ABC:
ABC -> USD = 1.168879
USD -> ABC = 0

This is really not the best API design. It should maybe give back some exc/exception that says that this currency is not supported. The response is not predictable.

It does not obstruct any other currencies, except TMM (poor Turkmenistanis).

API is down

Thanks for this helpful service. Unfortunately I think your API is down.

Rate limit

Hello

I want to know how many request I can do per day / hour
I searched on the website, however I didn't find nothing about

Best

Accept more donation types

I want to donate cryptocurrencies to you guys, but I don't want to also "donate" money to the miners in the form of fees. I recommend NowPayments as they would allow for feeless donations with NANO together with a wealth of other cryptocurrencies:

Here is a quick guide on how to add a donation button to your website:
https://www.youtube.com/watch?v=6pfom6D-9QU

Rate limits

Hi all,

are there any docs describing what are the rate limits for the historical API endpoint?

Thanks,
Alessandro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.