Skip to main content

A Python client for Fixer API - a currency conversion API

Project description

Fixer Currency

A Python module for the Fixer API for currency conversion.

PyPI - Version PyPI - Python Version Github Build Status


Table of Contents

Module Description

Fixer API (formerly known as Fixer.io) is a JSON API for current and historical foreign exchange rates published by the European Central Bank.

The rates are updated daily around 13:00 CET.

This module is based on the module fixerio originally created by by Adrián Matellanes.

Installation

pip install fixer-currency

License

fixer-currency is distributed under the terms of the MIT license.

Account and API Key

All calls to the Fixer API requires an API key. To acquire an API key you need to first register for an account on API Layer. When logged in, go to the Fixer API page and subscribe to one of the plans. The free plan allows for quite a number of requests per month and has no other restrictions as to what can be requested through the API.

Usage

All requests to the Fixer API should be made using an instance of the FixerClient class.

from fixer_currency import FixerClient

fxr = FixerClient("<YOUR API KEY>")

The FixerClient object always has a base currency defined for conversions and the default currency is EUR. Another base currency can be specified with an argument:

fxr = FixerClient("<YOUR API KEY>", "USD")

List all available currencys that can be used as base or target in a conversion:

>>> fxr.available_currencies()
{'success': True, 'symbols': {'AED': 'United Arab Emirates Dirham', 'AFN': 'Afghan Afghani', 'ALL': 'Albanian Lek', ... }}

Get latest rate(s) for one or more currencies:

>>> fxr.latest(symbols=["SEK", "NOK"])
{'success': True, 'timestamp': 1692526623, 'base': 'EUR', 'date': '2023-08-20', 'rates': {'SEK': 11.938802, 'NOK': 11.611995}}

Get historical rates for any day since 1999:

>>> import datetime
>>> fxr.historical_rates(datetime.date(2022, 1,1), symbols="SEK")
{'success': True, 'timestamp': 1641081599, 'historical': True, 'base': 'EUR', 'date': '2022-01-01', 'rates': {'SEK': 10.291223}}

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

fixer_currency-0.1.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fixer_currency-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file fixer_currency-0.1.0.tar.gz.

File metadata

  • Download URL: fixer_currency-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for fixer_currency-0.1.0.tar.gz
Algorithm Hash digest
SHA256 021fd73e463ed36cf64a06b9f7e666e21590bfea58ddccff02731b9ad6d5f3b7
MD5 71d47d6b2c84a23fab83b88b497a5596
BLAKE2b-256 69b6bcccaa6bd02cd4b9f9d47c218ecb4ecbf9af50537fb38564a5aa28baad4e

See more details on using hashes here.

File details

Details for the file fixer_currency-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fixer_currency-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for fixer_currency-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8b20c36dbc9fbbd627f2a26cfba2832c5d3cdd38eb6d850eda71783f7cd2d88
MD5 a7d902c80af4237c3e5670f8b3656236
BLAKE2b-256 46413f99373a3c6857bba65fa22da1c1caab2554b4a7f4439e8b5e1c9851e64f

See more details on using hashes here.

Supported by

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