Skip to main content

beanprice source for official Swiss BAZG/EZV (Federal Customs) daily FX rates, quoted in CHF

Project description

beanprice-bazg

A beanprice price source for the official Swiss BAZG/EZV daily exchange rates (Bundesamt für Zoll und Grenzsicherheit, formerly Eidgenössische Zollverwaltung).

These are the rates the Swiss tax administration (ESTV) accepts for converting foreign-currency amounts on VAT returns, quoted directly in CHF — which is exactly what a CHF-reporting company needs, and what the ECB feed does not provide.

Install

This package is developed inside the quints monorepo and isn't published to PyPI separately (only quints is). Use it from a clone of the repo, or vendor src/beanprice_bazg/ into your own project.

Usage

Tickers are ISO currency codes; the quote currency is always CHF ("1 <ticker> = X CHF"):

2024-01-01 commodity USD
    price: "CHF:beanprice_bazg/USD"

2024-01-01 commodity EUR
    price: "CHF:beanprice_bazg/EUR"
bean-price -e CHF:beanprice_bazg/USD          # latest
bean-price --update --inactive main.bean      # backfill / refresh the series

Behaviour

  • Daily, fully historical. get_historical_price / get_prices_series hit …/api/xmldaily?d=YYYYMMDD, which serves any past date.
  • Weekends & holidays resolve to the last published rate; series results are de-duplicated by the actual rate date, giving a clean business-day series.
  • Per-100 quotes (e.g. 100 EGP) are normalised to a per-unit CHF price.
  • Monthly averages are intentionally not supported: the BAZG monthly-average endpoint only ever returns the current month, so it cannot be backfilled by an automated tool. Use the daily rate consistently instead.

Develop / test

uv sync
uv run pytest                 # offline unit tests (HTTP mocked)
BAZG_LIVE=1 uv run pytest     # also runs the live smoke test

License

GPL-2.0-only

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

beanprice_bazg-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

beanprice_bazg-0.1.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: beanprice_bazg-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for beanprice_bazg-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dce9acb76edd53483126f32396b3037cbace7592ba118e395a56e32435564e64
MD5 cb0cf58fc847b61a371ddc18d70b5c6a
BLAKE2b-256 6ef0e3de065df27ef285ef81200e65717310b49f9f7145ccedfa5e4f2f23abe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for beanprice_bazg-0.1.0.tar.gz:

Publisher: publish.yaml on sealambda/quints

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: beanprice_bazg-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for beanprice_bazg-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10151c547b69b5522cf34cbd390ef0f3da10d2ea0f5d56ca27cd2fae28261ff3
MD5 182b86a273b220e08a28bc5df10847a6
BLAKE2b-256 cd4a5dc2cd5b4940cf5f34023d0b7f236e59d9c340e1dd24d784605cb4bc036c

See more details on using hashes here.

Provenance

The following attestation bundles were made for beanprice_bazg-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on sealambda/quints

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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