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.2.1.tar.gz (12.7 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.2.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for beanprice_bazg-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1f23872c9eba9ba1a3ba9349fe629574ca90503cbe0e0b229247f2be61a45134
MD5 878e5fef64cbb34bd7558bd6830bfd17
BLAKE2b-256 ec6de21e9404ad3100c871169f5431f61b68c40c2cb3dbf1fd6d1d24abf659e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for beanprice_bazg-0.2.1.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.2.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for beanprice_bazg-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39340963a8ac7279a727ba1308402a63d63b0aa401e0c2a4dceaed3347a02eaa
MD5 3d022844c5985516a0f6cda94715b141
BLAKE2b-256 a73841cd0583d41bc7571e70040f336af423ff04d9c79365ea3c31c9c519cdc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for beanprice_bazg-0.2.1-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