Skip to main content

quickforex

PyPI version Test codecov

Quick and easy access to foreign exchange rates. By default, this API uses exchangerate.host as backend.

Getting started

Using quickforex from a Python script

Get the last available rate for a single currency pair

from quickforex import CurrencyPair
import quickforex


quickforex.get_latest_rate("EUR/USD")  # -> Decimal(1.16)
quickforex.get_latest_rate("EURUSD")
quickforex.get_latest_rate("EUR", "USD")
quickforex.get_latest_rate(("EUR", "USD"))
quickforex.get_latest_rate(CurrencyPair("EUR", "USD"))

Get the last available rate for multiple currency pairs

from quickforex import CurrencyPair
import quickforex

quickforex.get_latest_rate("EUR/USD", "EUR/GBP")  # -> {CurrencyPair("EUR", "USD"): Decimal(1.16), CurrencyPair("EUR", "GBP"): Decimal(0.84)}
quickforex.get_latest_rate(["EUR/USD", "EUR/GBP"])

Get the historical rate for one or more currency pairs

from datetime import date
from quickforex import CurrencyPair
import quickforex

quickforex.get_historical_rate("BTC/USD", as_of=date(year=2021, month=1, day=1))  # -> Decimal(29388.20)
quickforex.get_historical_rates("EUR/USD", "EUR/GBP", as_of=date(year=2021, month=1, day=1))  # -> {CurrencyPair("EUR", "USD"): Decimal(1.21), CurrencyPair("EUR", "GBP"): Decimal(0.89)}

Get the rates for one or more currency pairs between two historical dates

from datetime import date
from quickforex import CurrencyPair
import quickforex

quickforex.get_rates_time_series(
    "EURUSD", "EURGBP",
    start_date=date(year=2020, month=1, day=1),
    end_date=date(year=2021, month=1, day=1)
)

# -> {
#    CurrencyPair("EUR", "USD"): {
#        date(year=2020, month=1, day=1): Decimal(1.12), 
#        ..., 
#        date(year=2021, month=1, day=1): Decimal(1.21)
#    },
#    CurrencyPair("EUR", "GBP"): { ... }
# }

Using quickforex from the command line

Get the last available rate for one or more currency pairs

❯ quickforex latest EURUSD EURGBP

{
    "EUR": {
        "GBP": 0.846354,
        "USD": 1.164798
    }
}

Get the historical rate for one or more currency pairs

❯ quickforex history --date 2020-01-01 EURUSD EURGBP

{
    "EUR": {
        "GBP": 0.8462,
        "USD": 1.1221
    }
}

Get the rates for one or more currency pairs between two historical dates

❯ quickforex series --from 2020-01-01 --to 2020-12-31 EURGBP EURUSD GBPJPY

{
    "EUR": {
        "GBP": {
            "2020-01-01": 0.8462,
            "2020-01-02": 0.8466,
            "2020-01-03": 0.8495,
            ...
            "2020-12-30": 0.903111,
            "2020-12-31": 0.892135
        },
        "USD": { ... }
    },
    "GBP": {"JPY": { ... }}
}

Metadata

Release files for quickforex 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quickforex 0.1.2
File Size Uploaded
quickforex-0.1.2.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quickforex 0.1.2
File Interpreter ABI Platform
quickforex-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / quickforex-0.1.2.tar.gz

Download URL quickforex-0.1.2.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b756a5b268b8314e0866a07124bad381e8defb555cf68f49f058673c388f84ae
BLAKE2b-256 checksum
How to use checksums
c0d4b92040d4b5b669e267df780f0d83473321b765ac3f10d36544030891d20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / quickforex-0.1.2-py3-none-any.whl

Download URL quickforex-0.1.2-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da841542f271c742d538b43b1752bcb30ba6ad5fc6f5e0810521ff6f89d21d47
BLAKE2b-256 checksum
How to use checksums
9b61ae026cdd5cf522376d70b86a6660c9db496c5ea4c3ff17acefacc0e67845
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

0.1.3

2 release files

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.0.4

2 release files

0.0.3

3 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page