Skip to main content

stapel-currencies

CI coverage pypi downloads python license llms.txt

Currencies and exchange rates: a Currency catalog keyed by ISO 4217 code with Decimal rates relative to a configurable base currency, cross-rate conversion (convert()) exposed as a comm Function, a pluggable rate-provider seam (ECB by default), a public read-only HTTP API, and a Celery task / management commands to refresh rates.

Part of the Stapel framework — composable Django apps that deploy as a monolith or as microservices without changing module code.

Install

pip install stapel-currencies

At a glance

Fact Value
Version 0.1.9
Python >=3.11 (3.11, 3.12, 3.13, 3.14)
HTTP operations 2
Config axes 2
Usage surface 3
Extension points 2
Error codes 45
Fleet dependencies stapel-core

Documentation

OpenAPI · capabilities.json · llms.txt (for agents)

Quick start

# settings.py
INSTALLED_APPS = [
    # ...
    "stapel_currencies",
]

# urls.py
path("currencies/", include("stapel_currencies.urls"))

Seed the catalog and pull live rates:

python manage.py migrate
python manage.py load_default_currencies
python manage.py update_exchange_rates          # ECB by default; --dry-run supported

Or schedule the Celery task:

CELERY_BEAT_SCHEDULE = {
    "update-exchange-rates": {
        "task": "stapel_currencies.tasks.update_exchange_rates",
        "schedule": crontab(hour=16, minute=30),  # ECB publishes ~16:00 CET
    },
}

Converting

from decimal import Decimal
from stapel_core.comm import call

call("currencies.convert", {
    "amount": "100.00",          # decimal strings on the wire
    "from_currency": "USD",
    "to_currency": "GBP",        # non-base pairs go via the base cross rate
})
# -> {"amount": "78.70"}

# In-process, same math:
from stapel_currencies import convert
convert(Decimal("100"), "USD", "GBP")  # Decimal("78.70")

Settings

All configuration lives in the STAPEL_CURRENCIES namespace (dict setting, flat setting, or env var — resolved lazily):

Key Default Meaning
BASE_CURRENCY "USD" ISO code all stored rates are relative to (base = 1).
RATE_PROVIDER "stapel_currencies.providers.ECBRateProvider" Dotted path to a RateProvider subclass — the rate-source seam.
DEFAULT_CURRENCIES 16 major world currencies Seed list for load_default_currencies.
CONVERSION_DECIMAL_PLACES 2 Quantization of conversion results (ROUND_HALF_UP).

HTTP API

Read-only (writes happen via the Django admin and the rate-update task):

Route Meaning
GET currencies/api/ Active currencies (code, display_name, value, symbol, is_active).
GET currencies/api/<code>/ One currency by ISO code.

comm surface

Kind Name Contract
Function currencies.convert {"amount": "<decimal str>", "from_currency", "to_currency"} -> {"amount": "<decimal str>"} — schema

Extension points

See MODULE.md — the agent-facing map of every fork-free seam (settings, the RateProvider ABC with a custom-provider recipe, serializer seam, comm surface, system checks).

Development

pip install -e . && pip install pytest pytest-django pytest-cov ruff jsonschema
./setup-hooks.sh
pytest tests/

License

MIT — see LICENSE.


This page is assembled by stapel-readme from docs/readme.md plus the contract artifacts in docs/. Edit the prose in docs/readme.md; the badges, facts and links above and below it are generated — do not hand-edit README.md.

Metadata

Release files for stapel-currencies 0.1.9

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

Source distribution (sdist)

Source distribution for stapel-currencies 0.1.9
File Size Uploaded
stapel_currencies-0.1.9.tar.gz 40.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stapel-currencies 0.1.9
File Interpreter ABI Platform
stapel_currencies-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 77.2 kB

Release files / stapel_currencies-0.1.9.tar.gz

Download URL stapel_currencies-0.1.9.tar.gz
Size 40.0 kB
Tags Source
SHA-256 checksum
How to use checksums
92600e1ae799ee5a9cb86457fc45e388def7fd9d18632ec94afafcf429741133
BLAKE2b-256 checksum
How to use checksums
a353651926250a663f63b7f95866d0f6ac992cf1e5549c7f0660069db0db26ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release files / stapel_currencies-0.1.9-py3-none-any.whl

Download URL stapel_currencies-0.1.9-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dc5aca3ea0e34c7727b43636e322bad16557f2b67dcf89ccb62c8cb957a3b64
BLAKE2b-256 checksum
How to use checksums
33a09b638697e12afc2458edd7e83feadb0c3633c1f9679050d49f9721436862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

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