Skip to main content

Bank of Canada connector for the parsimony framework

Project description

parsimony-boc

Bank of Canada connector — Canadian exchange rates, interest/bond yields, money & credit aggregates, CPI, commodity price indices, and the data behind BoC publications, as numeric time series via the Valet API.

Part of the parsimony-connectors monorepo. Distributed standalone on PyPI as parsimony-boc.

Connectors

Name Kind Description
boc_fetch connector Fetch one or more series by name (e.g. FXUSDCAD,FXEURCAD) or a whole panel by group (e.g. group:FX_RATES_DAILY). Reaches the entire universe by name.
enumerate_boc enumerator Catalog feed: one row per series (~15.6k) and one per live group (~2.4k), from Valet's list endpoints plus a per-group membership fan-out.
boc_search connector Search the published BoC catalog (lexical title or code:/structured). Pass returned codes to boc_fetch(series_name=...).

Discovery model

The Valet API has no native keyword search, so discovery is a built catalog (archetype A — one live full-index call lists the whole universe):

  • GET /lists/series/json is the authoritative enumeration path (15,638 series, live 2026-06-09). It self-tracks BoC additions, so the catalog stays current on each rebuild.
  • Groups are first-class catalog entities. Each named panel (e.g. FX_RATES_DAILY) gets its own row keyed group:NAME — the exact string boc_fetch accepts — because group descriptions carry retrieval signal no individual series has ("Month-end, Millions of dollars"). A fetch on a group: code returns the whole panel in one request.
  • The per-group membership fan-out doubles as a liveness probe: ~29 retired one-off panels that 404 on every fetch path are pruned, so the catalog never offers a panel you cannot fetch.

Every series stays fetchable by name regardless of catalog coverage — the boundary is discovery, not access.

Install

pip install parsimony-boc

Pulls in a compatible parsimony-core automatically. Verify discovery:

python -c "from parsimony import discover; print([p.name for p in discover.iter_providers()])"

Configuration

No configuration required — the Valet API is open and unauthenticated.

boc_search reads published catalog snapshots (default root hf://parsimony-dev/boc). Override with PARSIMONY_BOC_CATALOG_URL or catalog_url= at call time; a missing snapshot is built on demand from the live list endpoints and cached in an LRU.

Observations request limit. Valet caps the /observations request URL near 4096 bytes (roughly 100–160 comma-joined series, depending on name length). boc_fetch guards this pre-call and asks you to split the request or fetch a whole panel with group:NAME. The limit is on URL length, not series count.

Quick start

from parsimony_boc import CONNECTORS

# find a series (or a whole panel) in the catalog
hits = CONNECTORS["boc_search"](query="US dollar Canadian dollar exchange rate")
code = hits.data.iloc[0]["code"]            # e.g. "FXUSDCAD" or "group:FX_RATES_DAILY"
# fetch observations
result = CONNECTORS["boc_fetch"](series_name=code, start_date="2024-01-01")
print(result.data.head())

For multi-plugin composition (autoloads everything installed):

from parsimony import discover
connectors = discover.load_all()

Catalog building

scripts/build_catalog.py builds the single boc catalog from the live list endpoints and saves/pushes a snapshot:

uv run python packages/boc/scripts/build_catalog.py \
  --save file:///tmp/parsimony-catalogs/boc --push hf://parsimony-dev/boc

Provider

License

See LICENSE.

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

parsimony_boc-0.0.1.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

parsimony_boc-0.0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file parsimony_boc-0.0.1.tar.gz.

File metadata

  • Download URL: parsimony_boc-0.0.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for parsimony_boc-0.0.1.tar.gz
Algorithm Hash digest
SHA256 03ed928b319059cdff0bc7a9ba14328ca38c0c579fa18aface49ff218686504c
MD5 9b2e4d82263c71e992cb09b9f5ff1090
BLAKE2b-256 535a591b86fd87aac32ec6ded43d37b333a4a6764b2f2b9227a3f3b806b0a36f

See more details on using hashes here.

Provenance

The following attestation bundles were made for parsimony_boc-0.0.1.tar.gz:

Publisher: release.yml on ockham-sh/parsimony-connectors

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

File details

Details for the file parsimony_boc-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: parsimony_boc-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for parsimony_boc-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3b2c0ea2c82ffb0b6b460d26d09ef5eabf4d7eb92ed8da9a7f8e947b07f7562
MD5 3d732c5d66ddd78ce7534427d561ab0d
BLAKE2b-256 10b4c35116f8d160e2cfb73578043b6effc7967b6d6d83e17589ff1c6e8a173c

See more details on using hashes here.

Provenance

The following attestation bundles were made for parsimony_boc-0.0.1-py3-none-any.whl:

Publisher: release.yml on ockham-sh/parsimony-connectors

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