Giter Club home page Giter Club logo

exchangeratesapi's Introduction

Exchange Rates API

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

Deploy

Usage

Lates & specific date rates

Get the latest foreign exchange rates.

GET /latest

Get historical rates for any day since 1999.

GET /2018-03-26

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

GET /latest?base=USD

Request specific exchange rates by setting the symbols parameter.

GET /latest?symbols=USD,GBP

Rates history

Get historical rates for a time period.

GET /history?start_at=2018-01-01&end_at=2018-09-01

Limit results to specific exchange rates to save bandwidth with the symbols parameter.

GET /history?start_at=2018-01-01&end_at=2018-09-01&symbols=ILS,JPY

Quote the historical rates against a different currency.

GET /history?start_at=2018-01-01&end_at=2018-09-01&base=USD

Client side usage

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.exchangeratesapi.io/latest')
  .then((resp) => resp.json())
  .then((data) => fx.rates = data.rates)
  .then(demo)

API wrappers

Stack

Exchange rates API is built upon Sanic to achieve high throughput. The current setup can asyncronously handle thousands of requests per second.

Libraries used

Deployment

Virtualenv

pipenv shell

Install packages

pipenv install

Load in initial data & Scheduler

The scheduler will keep your database up to date hourly with information from European Central bank. It will download the last 90 days worth of data every hour.

The reference rates are usually updated around 16:00 CET on every working day, except on TARGET closing days. They are based on a regular daily concertation procedure between central banks across Europe, which normally takes place at 14:15 CET.

On initialization it will check the database. If it's empty all the historic rates will be downloaded and records created in the database.

Development

gunicorn exchangerates.app:app --worker-class sanic.worker.GunicornWorker --reload

Contributing

Thanks for your interest in the project! All pull requests are welcome from developers of all skill levels. To get started, simply fork the master branch on GitHub to your personal account and then clone the fork into your development environment.

Madis Väin (madisvain on Github, Twitter) is the original creator of the Exchange Rates API framework.

License

MIT

exchangeratesapi's People

Contributors

ash-jc-allen avatar jmrossy avatar julian-zehetmayr avatar madisvain avatar mandarvaze avatar pyup-bot 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  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

exchangeratesapi's Issues

Cross-Origin Request Blocked

Hi,
I keep getting this error when trying to access your APIs

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.exchangeratesapi.io/latest?base=EUR. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)

My script:

async asyncData({ $axios, error, params }) {
    try {
       const { data } = await $axios.get(
        'https://api.exchangeratesapi.io/latest',
        {
          params: {
            base: 'EUR'
          }
        }
      )
      const rates = data.rates
      })
      return {
        rates
      }
    } catch (e) {
      error({
        statusCode: 503,
        message: 'API connection error'
      })
    }
  }

Latest Rates are dated 1 day behind

As of Tuesday 10/29 the date has been one day behind.
For example:
Rates on Tuesday 10/29 are dated 10/28.
Rates on Wednesday 10/30 are dated 10/29.

This is different than in the past and just started happening.

not working after upload to google play

Hi everyone,

I used that awesome api for a part of my app. It is working well with usb wired device over android studio,

When it comes to publish the app on google play, api is not working.

I don't want to use 1000 request/month apis and i'm stucked, any suggestions welcome..!

Symbols are invalid for date

Using the following request GET https://api.exchangeratesapi.io/latest?base=EUR&symbols=USD,HKD,IDR,INR,MYR,SGD,JPY,CZK,AUD,EUR,SEK,GBP,NOK,PLN,DKK,BRL,CAD,ZAR,MXN,NZD,CNY,CHF produces the following error:

{
error: "Symbols 'USD,HKD,IDR,INR,MYR,SGD,JPY,CZK,AUD,EUR,SEK,GBP,NOK,PLN,DKK,BRL,CAD,ZAR,MXN,NZD,CNY,CHF' are invalid for date 2019-10-28."
}

I'm not quite sure what the error means? When leaving out the symbols, everything is working fine.

Update: When removing the symbol which is base, the request works. Is this the intended behavior?

Returned values are not gradually dated.

"2018-05-04": {
"CAD": 1.541,
"HKD": 9.3952,
"ISK": 122.2,
"PHP": 61.847,
"DKK": 7.4492,
"HUF": 313.87,
"CZK": 25.503,
"AUD": 1.5915,
"RON": 4.662,
"SEK": 10.5715,
"IDR": 16729.91,
"INR": 80.027,
"BRL": 4.2446,
"RUB": 75.4816,
"HRK": 7.404,
"JPY": 130.37,
"THB": 38.008,
"CHF": 1.195,
"SGD": 1.5962,
"PLN": 4.2543,
"BGN": 1.9558,
"TRY": 5.0963,
"CNY": 7.6113,
"NOK": 9.644,
"NZD": 1.7067,
"ZAR": 15.1135,
"USD": 1.1969,
"MXN": 22.9276,
"ILS": 4.3342,
"GBP": 0.88235,
"KRW": 1288.32,
"MYR": 4.7134
},
"2018-08-27": {
"CAD": 1.5182,
"HKD": 9.1318,
"ISK": 124.6,
"PHP": 61.997,
"DKK": 7.4582,
"HUF": 323.87,
"CZK": 25.744,
"AUD": 1.5886,
"RON": 4.6423,
"SEK": 10.6095,
"IDR": 17015.88,
"INR": 81.623,
"BRL": 4.7606,
"RUB": 78.2795,
"HRK": 7.4375,
"JPY": 129.16,
"THB": 37.929,
"CHF": 1.1428,
"SGD": 1.5884,
"PLN": 4.271,
"BGN": 1.9558,
"TRY": 7.2082,
"CNY": 7.9396,
"NOK": 9.6988,
"NZD": 1.7415,
"ZAR": 16.6464,
"USD": 1.1633,
"MXN": 21.8104,
"ILS": 4.2281,
"GBP": 0.90365,
"KRW": 1294.41,
"MYR": 4.7777
},
"2018-06-08": {
"CAD": 1.5274,
"HKD": 9.2222,
"ISK": 124.7,
"PHP": 62.068,
"DKK": 7.4476,
"HUF": 319.7,
"CZK": 25.795,
"AUD": 1.5496,
"RON": 4.6593,
"SEK": 10.287,
"IDR": 16373.32,
"INR": 79.342,
"BRL": 4.5149,
"RUB": 73.4773,
"HRK": 7.383,
"JPY": 128.64,
"THB": 37.683,
"CHF": 1.1572,
"SGD": 1.5702,
"PLN": 4.2793,
"BGN": 1.9558,
"TRY": 5.2798,
"CNY": 7.5333,
"NOK": 9.5085,
"NZD": 1.6734,
"ZAR": 15.3821,
"USD": 1.1754,
"MXN": 24.0774,
"ILS": 4.2009,
"GBP": 0.87733,
"KRW": 1263.46,
"MYR": 4.6867
},

Round-off error on large numbers

Rounds off large numbers with errors.

For example:
Base: IDR
"USD": 7.1e-5

There should be more decimal places for these currencies.

incompatibile base rate

Hello,
1st things 1st: thanks!

There are a few currencies that are not reliable because of their distance from the EUR value. For instance the Indonesian Rupiah

https://exchangeratesapi.io/api/latest?base=IDR

so, while it makes sense to convert EUR to IDR (*17059.77), the inverse is not true (should be ~ 0,000059, but the api is limited to 4 decimals)

kind regards

PKR is missing!

Love the service. But PKR currency is missing. Any chance you can add that?

What about exchange rates on weekends?

I am trying to display a graph of exchange rates of the past 30 days. I know there is no data on weekends but when I try to request something like:

https://api.exchangeratesapi.io/2018-11-18?base=USD&symbols=JPY

I get the rates for 2018-11-16.

So can I get this behaviour for requesting over a time period? For example:

https://api.exchangeratesapi.io/history?start_at=2018-10-20&end_at=2018-11-18&symbols=JPY&base=USD

Currently I only get 20 rates, instead of 30. Can the rates on weekends be provided as well? Just use the same value as the Friday before.

Thank you!

This isn't an issue, more of a note to say thank you so much for creating this fork and hosting this free service!

Returns Wrong FX Rate GBP - EUR

I am testing this with an Excel VBA Macro.

For GBP - EUR 31-Dec-2017 the API returns "1.00" instead of the correct FX Rate. Could you please verify this?

Latest rates stuck on 2018-09-06

If I request the latest rates using https://api.exchangeratesapi.io/latest the API is only returning rates from the 2018-09-06 onward.

The same thing happens if I request historical data, I can get all the rates up until 2018-09-06 only. Any historical date requests post this date incorrectly return the rates for 2018-09-06.

Requesting Currency List Endpoint

I'd really like it if I could request a list of currencies from the API itself. I need this in my app because I want to populate two dropdown menus with the list of currencies: one for the base currency and the other for the currency to convert to.

EUR as base currency issue

I've been having a play with your Exchange Rate API - a great tool, thanks so much!

One thing I noticed is that there's an issue with EUR as the base currency where it doesn't have an exchange rate for itself.

I've been dealing with a small set of currencies, and for each I'm getting the latest exchange rates for all the currencies, I'm dealing with.

For example, my currencies are: GBP, USD, EUR, IDR, THB
For each I want a conversion to every other currency (including itself).

For all the currencies I've tried this works fine using the endpoint /latest?base=xxx&symbols=xxx,xxx,xxx,...

However, for EUR if I include it as one of the symbols it fails:

/latest?base=EUR&symbols=GBP,USD,EUR,IDR,THB

I get a BadRequest response and a message saying that rates for the requested currencies on this date are not available. If I remove EUR from the list of symbols:

/latest?base=EUR&symbols=GBP,USD,IDR,THB

Then it works perfectly.

For all the other currencies I've tried requested itself as one of the symbols works fine and just returns a rate of 1.

Not sure why this is, but thought I would let you know.

SSL issue

user$ nscurl --ats-diagnostics https://api.exchangeratesapi.io/latest --verbose
Starting ATS Diagnostics

Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://api.exchangeratesapi.io/latest.
A test will "PASS" if URLSession:task:didCompleteWithError: returns a nil error.
================================================================================

Default ATS Secure Connection
---
ATS Default Connection
ATS Dictionary:
{
}
2019-01-23 12:27:06.097 nscurl[48827:2623375] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9816)
Result : FAIL
Error : Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSErrorFailingURLStringKey=https://api.exchangeratesapi.io/latest, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <146B513A-2854-422F-92E7-B51AE02B8BEB>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <146B513A-2854-422F-92E7-B51AE02B8BEB>.<1>"
), NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://api.exchangeratesapi.io/latest, NSUnderlyingError=0x7f85b5c0c7a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, _kCFNetworkCFStreamSSLErrorOriginalValue=-9816, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9816}}, _kCFStreamErrorCodeKey=-9816}
---

================================================================================

AED missing :(

Well not a bug, but can you also include AED please. The API is perfect for me other than the missing AED rates.
or is there any work around for it ?

No weekend exchange rates?

Hi,

I'm not entirely sure if this is an issue or just me not understanding something. I can't seem to get any exchange rates for dates on weekends. For example, using the following URL for 2019-11-10, I am returned the results for 2019-11-08:
https://api.exchangeratesapi.io/2019-11-10?&base=EUR

{
  "rates": {
    "CAD": 1.4561,
    "HKD": 8.6372,
    "ISK": 137.7,
    "PHP": 55.809,
    "DKK": 7.4727,
    "HUF": 333.37,
    "CZK": 25.486,
    "AUD": 1.6065,
    "RON": 4.7638,
    "SEK": 10.7025,
    "IDR": 15463.05,
    "INR": 78.652,
    "BRL": 4.5583,
    "RUB": 70.4653,
    "HRK": 7.4345,
    "JPY": 120.72,
    "THB": 33.527,
    "CHF": 1.0991,
    "SGD": 1.5002,
    "PLN": 4.261,
    "BGN": 1.9558,
    "TRY": 6.3513,
    "CNY": 7.7115,
    "NOK": 10.0893,
    "NZD": 1.7426,
    "ZAR": 16.3121,
    "USD": 1.1034,
    "MXN": 21.1383,
    "ILS": 3.8533,
    "GBP": 0.86158,
    "KRW": 1276.66,
    "MYR": 4.5609
  },
  "base": "EUR",
  "date": "2019-11-08"
}

Thanks in advance :)

Too many redirects when EUR is the base symbol

Hello.

First of all thank you for this awesome service!

I noticed that starting from today if we do a GET request to 'https://api.exchangeratesapi.io/latest?base=EUR&symbols=USD' it does not work, and you end up getting redirected forever.

On the other hand 'https://api.exchangeratesapi.io/latest?base=USD&symbols=EUR' works fine.

currency conversion

is it possible to perform currency conversion like the old Google Finance API:
https://www.google.com/finance/converter?a=1&from=EUR&to=USD
?

Inspired by this, I made the Exchange Rates GraphQL

Hey there, how are you doing?

Inspired by the Exchange Rates API, I created the Exchange Rates GraphQL, using Go.

It follows the same principles:

  • Getting data from the European Central bank
  • Exposing access to the latest, specific date and history
  • Free and Open Source!

I'd love if you could reference this app in your website as an alternative API, or even maybe we could share the same Heroku App/DB :)

Thanks so much for the app and inspiration ❤️

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.