Skip to main content

AbstractExchangeRates - Wrapper to quickly start using the powerful AbstractAPI's exchange rates service in your projects.

Project description

AbstractAPI python-exchange-rates library

Integrate the powerful Exchange Rates API from Abstract in your Python project in a few lines of code.

The Exchange Rate API is an REST API that allows you to:

  • look up the latest exchange rates for 80+ currencies via the live endpoint
  • get historical exchange rates using the historical endpoint
  • convert an arbitrary amount from one currency to another using the convert endpoint

It's very simple to use: you only need to submit your API key and a currency symbol (such as "USD"), and the API will respond with current exchange rate, historical data, or convertion rates.

Documentation

Supported Python Versions

This library supports the Python version 3.6 and higher.

Installation

You can install python-exchange-rates via PyPi or by downloading the source.

Via PyPi:

python-exchange-rates is available on PyPi as the abstract-python-exchange-rates package:

pip install abstract-python-exchange-rates

API key

Get your API key for free and without hassle from the Abstact website.

Quickstart

Get exchange rates

import pprint
from python_exchange_rates import AbstractExchangeRates

EXCHANGE_RATES_API_KEY =  "YYYYYY"; # Get your API Key from https://app.abstractapi.com/api/exchange-rates/documentation

AbstractExchangeRates.configure(EXCHANGE_RATES_API_KEY)

# Get live exchange rates using Abstract's Exchange Rates API and Python
response = AbstractExchangeRates.live("EUR")
pprint(response)

# Get historical exchange rates using Abstract's Exchange Rates API and Python
response = AbstractExchangeRates.historical('EUR', '2021-05-01');
pprint(response)

# Convert currency using Abstract's Exchange Rates API and Python
response = AbstractExchangeRates.convert('EUR', 'USD');
pprint(response)

API response

The API response contains the following fields:

live response parameters

Parameter Type Details
base String The base currency used to get the exchange rates.
last_updated String The Unix timestamp of when the returned data was last updated.
exchange_rates Object A JSON Object containing each of the target currency as the key and its exchange rate versus the base currency as that key's value.

historical response parameters

Parameter Type Details
base String The base currency used to get the exchange rates.
date String The date the currencies were pulled from, per the successful request.
exchange_rates Object A JSON Object containing each of the target currency as the key and its exchange rate versus the base currency as that key's value.

convert response parameters

Parameter Type Details
base String The base currency used to get the exchange rates.
target String The target currency that the base_amount was converted into.
date String The date the currencies were pulled from, per the successful request.
base_amount Float The amount of the base currency from the request.
converted_amount Float The amount of the target currency that the base_amount has been converted into
exchange_rate Float The exchange rate used to convert the base_amount from the base currency to the target currency

Detailed documentation

You will find additional information and request examples in the Abstract help page.

Getting help

If you need help installing or using the library, please contact Abstract's Support.

For bug report and feature suggestion, please use this repository issues page.

Contribution

Contributions are always welcome, as they improve the quality of the libraries we provide to the community.

Please provide your changes covered by the appropriate unit tests, and post them in the pull requests page.

Setup

To install the requirements, run:

python3 setup.py install --user

Once you implementer all your changes and the unit tests, run the following command to run the tests:

EXCHANGE_RATES_API_KEY=YYYYYY python3 tests/test_python_exchange_rates.py

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

abstract_python_exchange_rates-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distributions

File details

Details for the file abstract_python_exchange_rates-1.0.1.tar.gz.

File metadata

  • Download URL: abstract_python_exchange_rates-1.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for abstract_python_exchange_rates-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6f1c3f64804e57744ba83571c1762ea246fb02997413b6c5b63f64f2605441d2
MD5 4dd1af95bc28a9d7cd9b232956e7e966
BLAKE2b-256 7eca0888ecb1c625a6acdbed57aa608de80c5e4be66bad3d4369a422ff4cd1e1

See more details on using hashes here.

File details

Details for the file abstract_python_exchange_rates-1.0.1-py3.9.egg.

File metadata

  • Download URL: abstract_python_exchange_rates-1.0.1-py3.9.egg
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for abstract_python_exchange_rates-1.0.1-py3.9.egg
Algorithm Hash digest
SHA256 1dbed8fb29ab78e7da6031d7792763f387fe8b627de2225823e031a55d6afac3
MD5 11783f4bbf38bdded80632cccb2bd75d
BLAKE2b-256 b308c00fead0bd3c5b7b208a5dba23f47dae2a314a0c5a6e0c2c88411159f3b9

See more details on using hashes here.

File details

Details for the file abstract_python_exchange_rates-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: abstract_python_exchange_rates-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

File hashes

Hashes for abstract_python_exchange_rates-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b63d64334ec56d44939105cf4266de980144ee25e7b9776462caf87f357c2e8
MD5 50fffd05317237a30960f9091fa5027a
BLAKE2b-256 ad8e420fa87c002024eb352e194660556ce8b386e6bb2fa84d576dc5d51cb84f

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