A Python client for Fixer.io
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()
>>> 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()
>>> 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}}
'''
Rates are quoted against the Euro by default. Quote against a different currency by setting the base parameter in your request.
>>> from fixerio import Fixerio
>>> fxrio = Fixerio(base='USD')
>>> fxrio.latest()
'''
{u'base': u'USD',
u'date': u'2016-05-27',
u'rates': {u'AUD': 1.3864,
u'BGN': 1.7513,
u'BRL': 3.6094,
u'CAD': 1.3037,
u'CHF': 0.99105,
u'CNY': 6.5617,
u'CZK': 24.201,
u'DKK': 6.6589,
u'EUR': 0.89542,
u'GBP': 0.68271,
u'HKD': 7.7664,
u'HRK': 6.7071,
u'HUF': 281.35,
u'IDR': 13572.0,
u'ILS': 3.8447,
u'INR': 67.037,
u'JPY': 109.65,
u'KRW': 1179.2,
u'MXN': 18.5,
u'MYR': 4.079,
u'NOK': 8.3112,
u'NZD': 1.4851,
u'PHP': 46.648,
u'PLN': 3.9319,
u'RON': 4.0324,
u'RUB': 66.038,
u'SEK': 8.2981,
u'SGD': 1.3754,
u'THB': 35.683,
u'TRY': 2.9484,
u'ZAR': 15.625}}
'''
>>> from fixerio import Fixerio
>>> fxrio = Fixerio()
>>> fxrio.latest(base='USD')
'''
{u'base': u'USD',
u'date': u'2016-05-27',
u'rates': {u'AUD': 1.3864,
u'BGN': 1.7513,
u'BRL': 3.6094,
u'CAD': 1.3037,
u'CHF': 0.99105,
u'CNY': 6.5617,
u'CZK': 24.201,
u'DKK': 6.6589,
u'EUR': 0.89542,
u'GBP': 0.68271,
u'HKD': 7.7664,
u'HRK': 6.7071,
u'HUF': 281.35,
u'IDR': 13572.0,
u'ILS': 3.8447,
u'INR': 67.037,
u'JPY': 109.65,
u'KRW': 1179.2,
u'MXN': 18.5,
u'MYR': 4.079,
u'NOK': 8.3112,
u'NZD': 1.4851,
u'PHP': 46.648,
u'PLN': 3.9319,
u'RON': 4.0324,
u'RUB': 66.038,
u'SEK': 8.2981,
u'SGD': 1.3754,
u'THB': 35.683,
u'TRY': 2.9484,
u'ZAR': 15.625}}
'''
Request specific exchange rates by setting the symbols parameter.
>>> from fixerio import Fixerio
>>> fxrio = Fixerio(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()
>>> 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}}
'''
An HTTPS endpoint is available.
>>> from fixerio import Fixerio
>>> fxrio = Fixerio(secure=True)
>>> fxrio.latest()
'''
{u'base': u'EUR',
u'date': u'2016-05-27',
u'rates': {u'AUD': 1.5483,
...
'''
>>> from fixerio import Fixerio
>>> fxrio = Fixerio()
>>> fxrio.latest(secure=True)
'''
{u'base': u'EUR',
u'date': u'2016-05-27',
u'rates': {u'AUD': 1.5483,
...
'''
All exceptions that fixerio explicitly raises are fixerio.exceptions.FixerioException.
Release History
0.1.1 (2016-06-16)
Initial version.
Metadata
Release files for fixerio 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fixerio-0.1.1.tar.gz | 16.1 kB | Without provenance | Details for fixerio-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fixerio-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for fixerio-0.1.1-py2.py3-none-any.whl |
Total release size: 23.2 kB
Release files / fixerio-0.1.1.tar.gz
| Download URL | fixerio-0.1.1.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b23ace77bf914474bc4b52c587568a391502831f7112b7335c8dc3b2fcfea67e
|
|
BLAKE2b-256 checksum How to use checksums |
5b321364f87f46545d5f7a7483c52bdb5c0af6e36d736f48255924a5c617341f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / fixerio-0.1.1-py2.py3-none-any.whl
| Download URL | fixerio-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c443790a984499df86c2173d660d2db540e53a30cc7bc0858771d9b1aae5fd5d
|
|
BLAKE2b-256 checksum How to use checksums |
1d3aabc7461f7e44d97259cd5663abc97e088bb59542c22c948d8ee80de9eb18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fixerio 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.