Skip to content

VATcomply is a free API service for vat number validation, user ip geolocation and foreign exchange rates.

License

Notifications You must be signed in to change notification settings

davidjb99/vatcomply

 
 

Repository files navigation

VATcomply

VATcomply is a free API service for vat number validation, user ip geolocation and foreign exchange rates published by the European Central Bank.

Usage

Lates & specific date rates

Get the latest foreign exchange rates.

GET /rates

Get historical rates for any day since 1999.

GET /rates/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 /rates?base=USD

Request specific exchange rates by setting the symbols parameter.

GET /rates?symbols=USD,GBP

Rates history

Get historical rates for a date

GET /rates?date=2018-01-01

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

GET /rates?date=2018-01-01&symbols=ILS,JPY

Quote the historical rates against a different currency.

GET /rates?date=2018-01-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.vatcomply.com/latest")
  .then((resp) => resp.json())
  .then((data) => (fx.rates = data.rates))
  .then(demo);

Stack

VATcomply API is built upon Starlette the asyncronous Python framework to achieve high throughput. The current setup can asyncronously handle thousands of requests per second.

Libraries used

Deployment

Virtualenv

pyenv shell 3.x.x

Install packages

virtualenv env
. env/bin/activate
pip install -r requirements.in --upgrade

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

uvicorn app:app --reload

or

make run

Migrations

PYTHONPATH=.:\$PYTHONPATH alembic revision --autogenerate -m "create users table"

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 VATcomply API.

License

MIT

About

VATcomply is a free API service for vat number validation, user ip geolocation and foreign exchange rates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 63.2%
  • JavaScript 26.9%
  • SCSS 8.2%
  • Other 1.7%