Bank of Japan
Discover Bank of Japan statistical series and retrieve observations with original periods, units and source metadata
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/boj/index.md to help me query Bank of Japan with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
interest_rate_databases
Example output · captured
- Connector release
- v0.2.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
| database | name |
|---|---|
| FM01 | Uncollateralized overnight call rate |
| FM08 | Foreign exchange rates |
| FM09 | Effective exchange rate |
| IR01 | Basic Discount Rates and Basic Loan Rates |
| IR02 | Deposit interest rates |
Quick start
Choose where to run Bank of Japan, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'boj' AS boj (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-boj-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'boj' AS boj (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-boj:0.2.0'
);
3. Run a query
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'boj' AS boj
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
Query Farm operates Bank of Japan for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use boj as the catalog alias for the query below.
4. Run a query
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
Technical details
- Verified connector release
- v0.2.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'boj' AS boj (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-boj-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'boj' AS boj (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-boj:0.2.0'
);
Overview
Bank of Japan statistics as SQL tables: interest rates, money stock, prices, balance of payments and other time series from the BOJ Time-Series Data Search, with series metadata and original units. No API key needed.
Discover Bank of Japan statistical series and retrieve observations with original periods, units and source metadata. The upstream public data service needs no API key. SQL NULL arguments are rejected; missing source values become NULL. Use function arguments for source filtering; SQL WHERE filters are local. HTTP worker access can require a bearer token.
Queries use bounded HTTP responses and retries. Credentials stay out of continuation state. See README.md for deployment and operational limits.
Sources and references
Catalog
Everything boj exposes once attached — read straight from the worker's
released build.
main 5 functions
Bank of Japan Time-Series Data Search as table functions: database layers, series metadata and observations.
Schema examples (7)
Discover BoJ database examples
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
| database | name |
|---|---|
| FM01 | Uncollateralized overnight call rate |
| FM08 | Foreign exchange rates |
| FM09 | Effective exchange rate |
| IR01 | Basic Discount Rates and Basic Loan Rates |
| IR02 | Deposit interest rates |
Discover BoJ series metadata
SELECT series_code, name, frequency
FROM boj.main.series('IR01')
ORDER BY series_code;
Group FM08 foreign exchange series under their hierarchy headings from layers, with the layer selection string to pass to layer_observations for each branch
SELECT top.name AS section, sub.name AS subsection, s.frequency,
CASE WHEN sub.name IS NULL THEN s.layer1::VARCHAR ELSE s.layer1 || ',' || s.layer2 END AS layer,
count(*) AS series_count
FROM boj.main.series('FM08') AS s
JOIN boj.main.layers('FM08') AS top ON top.layer1 = s.layer1 AND top.layer2 = 0
LEFT JOIN boj.main.layers('FM08') AS sub ON sub.layer1 = s.layer1 AND sub.layer2 = s.layer2 AND sub.layer2 <> 0 AND sub.layer3 = 0
GROUP BY ALL
ORDER BY layer;
Discover BoJ hierarchy headings
SELECT name, layer1, layer2
FROM boj.main.layers('IR01')
ORDER BY layer1, layer2, name;
3 more examples
Read BoJ observations by code
SELECT period, value, unit
FROM boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202401', end_period := '202401')
ORDER BY period;
Read BoJ observations by hierarchy
SELECT series_code, period, value
FROM boj.main.layer_observations('IR01', 'D', '1,1', start_period := '202401', end_period := '202401')
ORDER BY series_code, period;
Compare each business day's uncollateralized overnight call rate (average, highest and lowest from FM01 layer 1) with the Basic Loan Rate from IR01 in March 2024, when the call rate turned positive, with the day's highest call rate's headroom below the Basic Loan Rate in basis points
SELECT c.period,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCON') AS call_avg,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH') AS call_high,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONL') AS call_low,
any_value(b.value) AS basic_loan_rate,
round((any_value(b.value) - max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH')) * 100, 1) AS headroom_bp
FROM boj.main.layer_observations('FM01', 'D', '1', start_period := '202403', end_period := '202403') AS c
JOIN boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202403', end_period := '202403') AS b USING (period)
WHERE c.value IS NOT NULL
GROUP BY c.period
ORDER BY c.period;
datasets (max_rows := BIGINT, query := VARCHAR)
Search curated database starting points without a network call. The official API manual lists all databases. Any valid official database code can be passed to series and observation functions.
Discover BoJ database examples
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
| database | name |
|---|---|
| FM01 | Uncollateralized overnight call rate |
| FM08 | Foreign exchange rates |
| FM09 | Effective exchange rate |
| IR01 | Basic Discount Rates and Basic Loan Rates |
| IR02 | Deposit interest rates |
layer_observations (database VARCHAR, frequency VARCHAR, layer VARCHAR, end_period := VARCHAR, language := VARCHAR, max_rows := BIGINT, start_period := VARCHAR)
Retrieve series matching layer numbers and frequency, following source pagination. The API rejects more than 1250 layer matches before frequency filtering; narrow the hierarchy when necessary. W includes available weekly subtypes. database, frequency and layer are positional; bounds and controls are named.
Read BoJ observations by hierarchy
SELECT series_code, period, value
FROM boj.main.layer_observations('IR01', 'D', '1,1', start_period := '202401', end_period := '202401')
ORDER BY series_code, period;
Compare each business day's uncollateralized overnight call rate (average, highest and lowest from FM01 layer 1) with the Basic Loan Rate from IR01 in March 2024, when the call rate turned positive, with the day's highest call rate's headroom below the Basic Loan Rate in basis points
SELECT c.period,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCON') AS call_avg,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH') AS call_high,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONL') AS call_low,
any_value(b.value) AS basic_loan_rate,
round((any_value(b.value) - max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH')) * 100, 1) AS headroom_bp
FROM boj.main.layer_observations('FM01', 'D', '1', start_period := '202403', end_period := '202403') AS c
JOIN boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202403', end_period := '202403') AS b USING (period)
WHERE c.value IS NOT NULL
GROUP BY c.period
ORDER BY c.period;
layers (database VARCHAR, include_headings := BOOLEAN, language := VARCHAR, max_rows := BIGINT, query := VARCHAR)
Return metadata rows without series codes to discover hierarchy headings and layer numbers. include_headings has no effect because this function always returns headings only. database is positional; query and language are named.
Discover BoJ hierarchy headings
SELECT name, layer1, layer2
FROM boj.main.layers('IR01')
ORDER BY layer1, layer2, name;
observations (database VARCHAR, series_codes VARCHAR[], end_period := VARCHAR, language := VARCHAR, max_rows := BIGINT, start_period := VARCHAR)
Retrieve selected same-frequency series and automatically follow NEXTPOSITION until complete or max_rows is reached. Preserve missing values, exact numeric text and native periods. The source supplies current data, not historical vintages. database and series_codes are positional; bounds and controls are named.
Read BoJ observations by code
SELECT period, value, unit
FROM boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202401', end_period := '202401')
ORDER BY period;
series (database VARCHAR, include_headings := BOOLEAN, language := VARCHAR, max_rows := BIGINT, query := VARCHAR)
Retrieve one database's full metadata, then optionally filter names or codes locally. English/Japanese labels, units, native period ranges, notes and layers are preserved. database is positional; language and filters are named.
Discover BoJ series metadata
SELECT series_code, name, frequency
FROM boj.main.series('IR01')
ORDER BY series_code;
Group FM08 foreign exchange series under their hierarchy headings from layers, with the layer selection string to pass to layer_observations for each branch
SELECT top.name AS section, sub.name AS subsection, s.frequency,
CASE WHEN sub.name IS NULL THEN s.layer1::VARCHAR ELSE s.layer1 || ',' || s.layer2 END AS layer,
count(*) AS series_count
FROM boj.main.series('FM08') AS s
JOIN boj.main.layers('FM08') AS top ON top.layer1 = s.layer1 AND top.layer2 = 0
LEFT JOIN boj.main.layers('FM08') AS sub ON sub.layer1 = s.layer1 AND sub.layer2 = s.layer2 AND sub.layer2 <> 0 AND sub.layer3 = 0
GROUP BY ALL
ORDER BY layer;
Try these queries
Discover BoJ series metadata
SELECT series_code, name, frequency
FROM boj.main.series('IR01')
ORDER BY series_code
Uses series
Group FM08 foreign exchange series under their hierarchy headings from layers, with the layer selection string to pass to layer_observations for each branch
SELECT top.name AS section, sub.name AS subsection, s.frequency,
CASE WHEN sub.name IS NULL THEN s.layer1::VARCHAR ELSE s.layer1 || ',' || s.layer2 END AS layer,
count(*) AS series_count
FROM boj.main.series('FM08') AS s
JOIN boj.main.layers('FM08') AS top ON top.layer1 = s.layer1 AND top.layer2 = 0
LEFT JOIN boj.main.layers('FM08') AS sub ON sub.layer1 = s.layer1 AND sub.layer2 = s.layer2 AND sub.layer2 <> 0 AND sub.layer3 = 0
GROUP BY ALL
ORDER BY layer
Discover BoJ hierarchy headings
SELECT name, layer1, layer2
FROM boj.main.layers('IR01')
ORDER BY layer1, layer2, name
Uses layers
Read BoJ observations by code
SELECT period, value, unit
FROM boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202401', end_period := '202401')
ORDER BY period
Uses observations
Read BoJ observations by hierarchy
SELECT series_code, period, value
FROM boj.main.layer_observations('IR01', 'D', '1,1', start_period := '202401', end_period := '202401')
ORDER BY series_code, period
Uses layer_observations
Compare each business day's uncollateralized overnight call rate (average, highest and lowest from FM01 layer 1) with the Basic Loan Rate from IR01 in March 2024, when the call rate turned positive, with the day's highest call rate's headroom below the Basic Loan Rate in basis points
SELECT c.period,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCON') AS call_avg,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH') AS call_high,
max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONL') AS call_low,
any_value(b.value) AS basic_loan_rate,
round((any_value(b.value) - max(c.value) FILTER (WHERE c.series_code = 'STRDCLUCONH')) * 100, 1) AS headroom_bp
FROM boj.main.layer_observations('FM01', 'D', '1', start_period := '202403', end_period := '202403') AS c
JOIN boj.main.observations('IR01', ['MADR1Z@D'], start_period := '202403', end_period := '202403') AS b USING (period)
WHERE c.value IS NOT NULL
GROUP BY c.period
ORDER BY c.period
Bank of Japan is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
BEA
Economy & labour
Discover BEA datasets, parameters and parameter values, then retrieve national, regional, industry and international economic accounts
BLS
Economy & labour
Retrieve labor, employment, price and productivity series with period codes, footnotes, calculations and survey metadata
Bank of England
Economy & labour
Discover Bank of England statistical series and retrieve observations with original periods, units and source metadata