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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fixerio_client-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23230371db152b8282e0e0a4614296c4c1597cbaf5953c24b28d61026e5b1ef1 |
|
MD5 | 485328221ec5df07ebd2aa54a9397b38 |
|
BLAKE2b-256 | eedd73e7471ed1098e39374c6228973dc313a3090a75d7f9ed652896c81a5a05 |