Skip to main content

A Python client for Fixer.io

Project description

A Python client for Fixer API_

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

Fixer API_ (formerly known as 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 3 pm CET.

Installation

Install fixerio with:

::

pip install fixerio-client

Or with:

::

easy_install fixerio-client

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

Usage

Get the latest foreign exchange reference rates in JSON format.

.. code:: python

>>> from fixerio import Fixerio

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

Get historical rates for any day since 1999.

.. code:: python

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

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

Request specific exchange rates by setting the symbols parameter.

.. code:: python

>>> from fixerio import Fixerio

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

.. code:: python

>>> from fixerio import Fixerio

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

.. :changelog:

Release History

1.0.0 (2024-04-12)

- Update to the `new Fixer API endpoint on API Layer <https://api.apilayer.com/fixer/>`_.
- Re-add support for changing base currency. This option is once again supported by Free Plan.
- Always use TLS encrypted endpoint, since this is once again supported by Free Plan.
- Add new API function, available_currencies(), for listing supported currency symbols.
- Replace unit tests based on nosetest with unit tests based on pytest (nose is not supported
  by modern Python 3 versions).
- Remove support for Python 2.
- Add type hints for all methods.
- Update to the `new Fixer endpoint <https://data.fixer.io/api/>`_.
- 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_client-1.0.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

fixerio_client-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file fixerio_client-1.0.0.tar.gz.

File metadata

  • Download URL: fixerio_client-1.0.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for fixerio_client-1.0.0.tar.gz
Algorithm Hash digest
SHA256 971f7986af4f86f4305e7403dad7868d2b605114572cef07c2a8086645937c3a
MD5 718b4cf5104f35a8017b0fb7ac676b81
BLAKE2b-256 2e20471846a75e8c5269178fcd82a340878661b62a8e6108ea75038ec74ca4b5

See more details on using hashes here.

File details

Details for the file fixerio_client-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fixerio_client-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23230371db152b8282e0e0a4614296c4c1597cbaf5953c24b28d61026e5b1ef1
MD5 485328221ec5df07ebd2aa54a9397b38
BLAKE2b-256 eedd73e7471ed1098e39374c6228973dc313a3090a75d7f9ed652896c81a5a05

See more details on using hashes here.

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