Exchange API Overview
Fast and lightweight currency exchange API
The Exchange Rates API can be used to get real time exchange rates, past/historical rates, and perform quick currency conversion betwwen multiple currencies.
It supports over 80+ currencies. In abstract-python
, the ExchangeRatesAPI
class is used to communicate with this API.
API Endpoints
Real-time exchange rates
Get real time exchange rates between multiple currencies
Convert currencies
Covert one currency to another using a base amount. e.g 5 USD to GBP
Historical exchange rates
Get a detailed JSON
object of past exchange rates within a specified peiod.
Supported currency codes
AbstractAPI supports ISO 4217 currency codes which can be found here
Get currency codes programmatically
With abstract-python
you can get the supported currency codes as a Python List. See usage below:
Here is the result below:
Use case
If your app receives currency codes from users, you may need to validate these inputs before querying the ExchangeRatesAPI
class.
See usage below:
The code above is a simple console-based program. This technique can also be extended to other programs such as a web app or desktop app.
Error messages
Refer to this page for all possible error messages you may encounter while using the ExchangeRatesAPI
class.