Skip to main content

A Python client for Fixer.io

Project description

Build Status Coverage Status Supports Wheel format Latest PyPI version Documentation Status Requirements Status

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

The rates are updated daily around 3PM CET.

Installation

Install fixerio with:

pip install fixerio

Or with:

easy_install fixerio

Or you can get the source from GitHub at https://github.com/amatellanes/fixerio.

Usage

Get the latest foreign exchange reference rates in JSON format.

>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.latest()
'''
 {u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'AUD': 1.5483,
  u'BGN': 1.9558,
  u'BRL': 4.031,
  u'CAD': 1.456,
  u'CHF': 1.1068,
  u'CNY': 7.3281,
  u'CZK': 27.028,
  u'DKK': 7.4367,
  u'GBP': 0.76245,
  u'HKD': 8.6735,
  u'HRK': 7.4905,
  u'HUF': 314.21,
  u'IDR': 15157.25,
  u'ILS': 4.2938,
  u'INR': 74.867,
  u'JPY': 122.46,
  u'KRW': 1316.98,
  u'MXN': 20.6611,
  u'MYR': 4.5554,
  u'NOK': 9.282,
  u'NZD': 1.6586,
  u'PHP': 52.096,
  u'PLN': 4.3912,
  u'RON': 4.5034,
  u'RUB': 73.7516,
  u'SEK': 9.2673,
  u'SGD': 1.536,
  u'THB': 39.851,
  u'TRY': 3.2928,
  u'USD': 1.1168,
  u'ZAR': 17.4504}}
'''

Get historical rates for any day since 1999.

>>> import datetime
>>> from fixerio import Fixerio

>>> today = datetime.date.today()
>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.historical_rates(today)
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'AUD': 1.5483,
  u'BGN': 1.9558,
  u'BRL': 4.031,
  u'CAD': 1.456,
  u'CHF': 1.1068,
  u'CNY': 7.3281,
  u'CZK': 27.028,
  u'DKK': 7.4367,
  u'GBP': 0.76245,
  u'HKD': 8.6735,
  u'HRK': 7.4905,
  u'HUF': 314.21,
  u'IDR': 15157.25,
  u'ILS': 4.2938,
  u'INR': 74.867,
  u'JPY': 122.46,
  u'KRW': 1316.98,
  u'MXN': 20.6611,
  u'MYR': 4.5554,
  u'NOK': 9.282,
  u'NZD': 1.6586,
  u'PHP': 52.096,
  u'PLN': 4.3912,
  u'RON': 4.5034,
  u'RUB': 73.7516,
  u'SEK': 9.2673,
  u'SGD': 1.536,
  u'THB': 39.851,
  u'TRY': 3.2928,
  u'USD': 1.1168,
  u'ZAR': 17.4504}}
'''

Request specific exchange rates by setting the symbols parameter.

>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY', symbols=['USD', 'GBP'])
>>> fxrio.latest()
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'GBP': 0.76245, u'USD': 1.1168}}
'''
>>> from fixerio import Fixerio

>>> fxrio = Fixerio(access_key='YOUR ACCESS KEY')
>>> fxrio.latest(symbols=['USD', 'GBP'])
'''
{u'base': u'EUR',
 u'date': u'2016-05-27',
 u'rates': {u'GBP': 0.76245, u'USD': 1.1168}}
'''

All exceptions that fixerio explicitly raises are fixerio.exceptions.FixerioException.

Release History

1.0.0-alpha (2018-06-13)

  • Update to the new Fixer endpoint.

  • Add Fixer API Access Key support.

  • Drop Changing base currency support. This option is not supported by Free Plan.

  • Drop SSL Encryption support. This option is not supported by Free Plan.

0.1.1 (2016-06-16)

  • Initial version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fixerio-1.0.0a0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

fixerio-1.0.0a0-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fixerio-1.0.0a0.tar.gz.

File metadata

  • Download URL: fixerio-1.0.0a0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fixerio-1.0.0a0.tar.gz
Algorithm Hash digest
SHA256 eed43e33581de162c264ca0438120b23d5f73762bf04d98158e7ca1d43869292
MD5 e63ad71f2be5633e3433558e42307e33
BLAKE2b-256 1fd846fab77f1dd48149bc3f4689fd2647757487f4bbd893cefde59ca760bfbc

See more details on using hashes here.

Provenance

File details

Details for the file fixerio-1.0.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fixerio-1.0.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e6b348c0ce0102766616554860ed957b0af806e4097791f952eb74e7122ed342
MD5 a89736da8f4c56d1c61001aa749c679d
BLAKE2b-256 f4d44e643fe947d7098bb58baa6f7f6e8aa28342d4b81fc9293431d595eec852

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page