Skip to content

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
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;
Result · first 5 rows
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.

setup.sql
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;

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'
);

3. Run a query

query.sql
SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
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'
);

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.

Catalog

Everything boj exposes once attached — read straight from the worker's released build.

boj 1 schema
main 5 functions

Bank of Japan Time-Series Data Search as table functions: database layers, series metadata and observations.

Schema examples (7)
Examples (7)

Discover BoJ database examples

SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
Result · first 5 rows
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;
Table functions
datasets (max_rows := BIGINT, query := VARCHAR) 1 example

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.

Named arguments
max_rows := BIGINT
Explicit output cap; zero retrieves all pages within the source selection. Filtering happens at the source only through function arguments. · default 0
query := VARCHAR
Case-insensitive local substring of database code or name; empty lists all curated entries. · default ""
Returns columns
database VARCHAR
Official database code accepted by the API.
name VARCHAR
Curated database name; this catalog is not exhaustive.
source_url VARCHAR
Official API manual with the complete database list.
Example

Discover BoJ database examples

SELECT database, name
FROM boj.main.datasets(query := 'rate')
ORDER BY database;
Result · first 5 rows
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
Link
layer_observations (database VARCHAR, frequency VARCHAR, layer VARCHAR, end_period := VARCHAR, language := VARCHAR, max_rows := BIGINT, start_period := VARCHAR) 2 examples

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.

Positional arguments
database VARCHAR
Official database code, for example IR01 or FM08.
frequency VARCHAR
Frequency abbreviation CY, FY, CH, FH, Q, M, W or D; W includes available weekly subtypes.
layer VARCHAR
One to five comma-separated layer numbers or '*' wildcards. Narrow selections to at most 1250 matching series before frequency filtering.
Named arguments
end_period := VARCHAR
Inclusive native upper bound in the same frequency format; empty ends at latest source data. · default ""
language := VARCHAR
Response language: en for English or jp for Japanese labels. · default "en"
max_rows := BIGINT
Explicit output cap; zero retrieves all pages within the source selection. Filtering happens at the source only through function arguments. · default 0
start_period := VARCHAR
Inclusive native bound: YYYY, YYYYHH or YYYYQQ; monthly, daily and weekly requests use YYYYMM. Empty starts at source history. · default ""
Returns columns
database VARCHAR
Requested source database.
series_code VARCHAR
Source series code; NULL for hierarchy headings.
name VARCHAR
English series name when supplied.
name_ja VARCHAR
Japanese series name when supplied.
unit VARCHAR
English unit label in original source scale.
unit_ja VARCHAR
Japanese unit label when supplied.
frequency VARCHAR
Native frequency label; weekly subtypes remain distinct.
category VARCHAR
English source category.
category_ja VARCHAR
Japanese source category when supplied.
last_update DATE
Source update date, not an observation vintage.
start_period VARCHAR
First recorded native period from metadata.
end_period VARCHAR
Last recorded native period from metadata.
notes VARCHAR
Source notes when supplied.
layer1 BIGINT
Source hierarchy level 1; zero indicates an unused level.
layer2 BIGINT
Source hierarchy level 2; zero indicates an unused level.
layer3 BIGINT
Source hierarchy level 3; zero indicates an unused level.
layer4 BIGINT
Source hierarchy level 4; zero indicates an unused level.
layer5 BIGINT
Source hierarchy level 5; zero indicates an unused level.
source_timestamp VARCHAR
Original JST response or metadata creation timestamp.
metadata_json VARCHAR
All source series fields except observation arrays.
period VARCHAR
Native survey period code; interpret using frequency without inventing a date.
value DOUBLE
Numeric observation in published units; NULL for source missing values.
value_text VARCHAR
Original JSON numeric lexeme or string for exact decimal conversion.
Examples (2)

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;
Link
layers (database VARCHAR, include_headings := BOOLEAN, language := VARCHAR, max_rows := BIGINT, query := VARCHAR) 1 example

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.

Positional arguments
database VARCHAR
Official database code, for example IR01 or FM08.
Named arguments
include_headings := BOOLEAN
Include hierarchy headings that have no series code. · default false
language := VARCHAR
Response language: en for English or jp for Japanese labels. · default "en"
max_rows := BIGINT
Explicit output cap; zero retrieves all pages within the source selection. Filtering happens at the source only through function arguments. · default 0
query := VARCHAR
Case-insensitive local substring of series code or English/Japanese name. · default ""
Returns columns
database VARCHAR
Requested source database.
series_code VARCHAR
Source series code; NULL for hierarchy headings.
name VARCHAR
English series name when supplied.
name_ja VARCHAR
Japanese series name when supplied.
unit VARCHAR
English unit label in original source scale.
unit_ja VARCHAR
Japanese unit label when supplied.
frequency VARCHAR
Native frequency label; weekly subtypes remain distinct.
category VARCHAR
English source category.
category_ja VARCHAR
Japanese source category when supplied.
last_update DATE
Source update date, not an observation vintage.
start_period VARCHAR
First recorded native period from metadata.
end_period VARCHAR
Last recorded native period from metadata.
notes VARCHAR
Source notes when supplied.
layer1 BIGINT
Source hierarchy level 1; zero indicates an unused level.
layer2 BIGINT
Source hierarchy level 2; zero indicates an unused level.
layer3 BIGINT
Source hierarchy level 3; zero indicates an unused level.
layer4 BIGINT
Source hierarchy level 4; zero indicates an unused level.
layer5 BIGINT
Source hierarchy level 5; zero indicates an unused level.
source_timestamp VARCHAR
Original JST response or metadata creation timestamp.
metadata_json VARCHAR
All source series fields except observation arrays.
Example

Discover BoJ hierarchy headings

SELECT name, layer1, layer2
FROM boj.main.layers('IR01')
ORDER BY layer1, layer2, name;
Link
observations (database VARCHAR, series_codes VARCHAR[], end_period := VARCHAR, language := VARCHAR, max_rows := BIGINT, start_period := VARCHAR) 1 example

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.

Positional arguments
database VARCHAR
Official database code, for example IR01 or FM08.
series_codes VARCHAR[]
One to 1250 distinct source codes of the same frequency, without the database prefix.
Named arguments
end_period := VARCHAR
Inclusive native upper bound in the same frequency format; empty ends at latest source data. · default ""
language := VARCHAR
Response language: en for English or jp for Japanese labels. · default "en"
max_rows := BIGINT
Explicit output cap; zero retrieves all pages within the source selection. Filtering happens at the source only through function arguments. · default 0
start_period := VARCHAR
Inclusive native bound: YYYY, YYYYHH or YYYYQQ; monthly, daily and weekly requests use YYYYMM. Empty starts at source history. · default ""
Returns columns
database VARCHAR
Requested source database.
series_code VARCHAR
Source series code; NULL for hierarchy headings.
name VARCHAR
English series name when supplied.
name_ja VARCHAR
Japanese series name when supplied.
unit VARCHAR
English unit label in original source scale.
unit_ja VARCHAR
Japanese unit label when supplied.
frequency VARCHAR
Native frequency label; weekly subtypes remain distinct.
category VARCHAR
English source category.
category_ja VARCHAR
Japanese source category when supplied.
last_update DATE
Source update date, not an observation vintage.
start_period VARCHAR
First recorded native period from metadata.
end_period VARCHAR
Last recorded native period from metadata.
notes VARCHAR
Source notes when supplied.
layer1 BIGINT
Source hierarchy level 1; zero indicates an unused level.
layer2 BIGINT
Source hierarchy level 2; zero indicates an unused level.
layer3 BIGINT
Source hierarchy level 3; zero indicates an unused level.
layer4 BIGINT
Source hierarchy level 4; zero indicates an unused level.
layer5 BIGINT
Source hierarchy level 5; zero indicates an unused level.
source_timestamp VARCHAR
Original JST response or metadata creation timestamp.
metadata_json VARCHAR
All source series fields except observation arrays.
period VARCHAR
Native survey period code; interpret using frequency without inventing a date.
value DOUBLE
Numeric observation in published units; NULL for source missing values.
value_text VARCHAR
Original JSON numeric lexeme or string for exact decimal conversion.
Example

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;
Link
series (database VARCHAR, include_headings := BOOLEAN, language := VARCHAR, max_rows := BIGINT, query := VARCHAR) 2 examples

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.

Positional arguments
database VARCHAR
Official database code, for example IR01 or FM08.
Named arguments
include_headings := BOOLEAN
Include hierarchy headings that have no series code. · default false
language := VARCHAR
Response language: en for English or jp for Japanese labels. · default "en"
max_rows := BIGINT
Explicit output cap; zero retrieves all pages within the source selection. Filtering happens at the source only through function arguments. · default 0
query := VARCHAR
Case-insensitive local substring of series code or English/Japanese name. · default ""
Returns columns
database VARCHAR
Requested source database.
series_code VARCHAR
Source series code; NULL for hierarchy headings.
name VARCHAR
English series name when supplied.
name_ja VARCHAR
Japanese series name when supplied.
unit VARCHAR
English unit label in original source scale.
unit_ja VARCHAR
Japanese unit label when supplied.
frequency VARCHAR
Native frequency label; weekly subtypes remain distinct.
category VARCHAR
English source category.
category_ja VARCHAR
Japanese source category when supplied.
last_update DATE
Source update date, not an observation vintage.
start_period VARCHAR
First recorded native period from metadata.
end_period VARCHAR
Last recorded native period from metadata.
notes VARCHAR
Source notes when supplied.
layer1 BIGINT
Source hierarchy level 1; zero indicates an unused level.
layer2 BIGINT
Source hierarchy level 2; zero indicates an unused level.
layer3 BIGINT
Source hierarchy level 3; zero indicates an unused level.
layer4 BIGINT
Source hierarchy level 4; zero indicates an unused level.
layer5 BIGINT
Source hierarchy level 5; zero indicates an unused level.
source_timestamp VARCHAR
Original JST response or metadata creation timestamp.
metadata_json VARCHAR
All source series fields except observation arrays.
Examples (2)

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;
Link

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

Uses serieslayers

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

Uses layer_observationsobservations

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.