Skip to main content

Bank of Japan connector for the parsimony framework

Project description

parsimony-boj

Bank of Japan connector — Japanese interest rates, FX, money & deposits, flow of funds, TANKAN, prices (CGPI/SPPI), balance of payments and BIS-related statistics, as numeric time series via the BOJ Time-Series Data Search API.

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

Connectors

Name Kind Description
boj_databases_search connector Step 1. Search the 50 statistics databases; returns a db code (e.g. FM08) and the series_namespace for step 2.
boj_series_search connector Step 2. Search series within one database (db=…); returns code + db for boj_fetch.
boj_fetch connector Fetch observations by database + series code(s) (e.g. db=FM08, code=FXERD01,FXERD04). Max 250 codes; large requests are paginated transparently.
enumerate_boj enumerator Catalog feed: one row per series (~326k) and one per database (50), from a per-DB getMetadata fan-out.

Discovery chain: boj_databases_searchboj_series_search(db=...)boj_fetch.

Discovery model

BoJ has no native keyword search, so discovery is a built catalog. The API also exposes no way to list its databases (getMetadata requires a db), so the universe is enumerated two ways (archetype C + B):

  • A frozen 50-database registry (the C part). The list is transcribed from the official API manual and cross-validated against the machine-readable api_tool.xlsx DB_Name sheet — both agree exactly. scripts/harvest_databases.py regenerates it (--diff checks for drift).
  • A live per-database getMetadata fan-out (the B part). getMetadata is uncapped — one call returns every series in a database (the CO/TANKAN database alone is 166,513 series) — so each per-DB series catalog is complete.

The published catalog is multi-bundle: a boj_databases bundle (the 50 DBs) plus one boj_series_<db> bundle per database, built lazily and LRU-cached. This two-tier shape (like parsimony-bls) keeps each namespace tractable for the 326k-series universe. Every series is fetchable by (db, code) regardless of catalog coverage — the boundary is discovery, not access.

Install

pip install parsimony-boj

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 BOJ API is open and unauthenticated.

The search connectors read published catalog snapshots (default root hf://parsimony-dev/boj). Override with PARSIMONY_BOJ_CATALOG_URL or catalog_root= at call time; a missing snapshot is built on demand from the live metadata and cached in an LRU.

Request limits. boj_fetch accepts up to 250 series codes per call, all of the same frequency (a BoJ rule). The API also caps each response at 60,000 data points (series × periods); boj_fetch paginates over that limit automatically (via the API's NEXTPOSITION cursor), so a large multi-series request returns its full result rather than a silent truncation.

Quick start

from parsimony_boj import CONNECTORS

# step 1: find the database
dbs = CONNECTORS["boj_databases_search"](query="foreign exchange rates")
db = dbs.data.iloc[0]["db"]                  # e.g. "FM08"
# step 2: find a series within it
hits = CONNECTORS["boj_series_search"](query="US dollar spot", db=db)
code = hits.data.iloc[0]["code"]             # e.g. "FXERD01"
# fetch observations
result = CONNECTORS["boj_fetch"](db=db, code=code, start_date="202401")
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 multi-bundle catalog from the live metadata and saves/pushes snapshots:

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

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_boj-0.0.1.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

parsimony_boj-0.0.1-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parsimony_boj-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8c56f57c09d7580b8bc9e29f4a8c56bab0f8018086af8655d048117facc2d42c
MD5 3922951141d9057f1b7b0c00b295edac
BLAKE2b-256 6cb426af61c6ad8d3af9a963850d9ed1bbaa23f270ab8f253948256df436df1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for parsimony_boj-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_boj-0.0.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for parsimony_boj-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39e397fcb1ef9ea6c342165d2420cdcf507f321a2097a64773bda8368844c3aa
MD5 3a577fe85fa8463083a7e154337e1b66
BLAKE2b-256 d97d3d0b692fba020339ede2dd61bc925c5e3a3498a9b45e901047b7db21e61e

See more details on using hashes here.

Provenance

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