High-performance Python client for IMF SDMX 3.0 exchange-rate data, with a monthly USD dataset helper.
Project description
imf-fx
High-performance Python client for IMF SDMX 3.0 exchange-rate data, with a production-ready monthly USD dataset helper.
Overview
The International Monetary Fund (IMF) publishes official exchange rate data through its SDMX 3.0 API.
imf-fx provides:
- Direct integration with the official SDMX 3.0 exchange-rate endpoint
- Batched country requests for efficient network usage
- Fast parsing using Polars
- Client-side time-window enforcement
- ISO2 and ISO3 country compatibility
- Log exchange rate output for modeling workflows
Unlike spreadsheet scraping or HTML extraction approaches, imf-fx uses the official IMF SDMX 3.0 API contract directly. This ensures structural stability and alignment with IMF data standards.
Why This Is Useful
Exchange rate normalization is essential for:
- Development finance analytics
- Aid Information Management Systems (AIMS)
- Development Finance Information Management Systems (DFIMS)
- IATI data processing
- OECD CRS normalization
- Public financial management dashboards
- Cross-country budget comparisons
- Financial modeling pipelines
Public finance systems frequently ingest transactions denominated in multiple currencies. Consistent historical FX normalization ensures:
- Accurate aggregation across currencies
- Time-consistent financial comparisons
- Reproducible modeling
- Transparent auditability of conversions
imf-fx provides a fast, structured, and authoritative way to obtain exchange rate data for these workflows.
Installation
pip install imf-fx
Python 3.11 or newer is required.
Quick Start
Download the full monthly USD dataset
from imf_fx import monthly_usd_only
df = monthly_usd_only()
print(df.head())
Bulk exports
The dataset can be written directly to CSV, or export to Parquet for use in other systems
from imf_fx import monthly_usd_only
df = monthly_usd_only()
df.write_csv("imf_monthly_usd.csv")
df.write_parquet("imf_monthly_usd.parquet")
Download a specific time-window
from imf_fx import monthly_usd_only
df = monthly_usd_only(
start="2020-M01",
end="2020-M12"
)
Retreive dataset with metadata
from imf_fx import monthly_usd_only
df, meta = monthly_usd_only(return_meta=True)
print(meta)
Example metadata output:
{
"countries_requested": 260,
"countries_with_data": 222,
"rows_final": 154333,
"min_period": "1924-M06",
"max_period": "2026-M01",
"elapsed_s": 2.7
}
Output Schema
The normalized dataset includes
| Column | Description |
|---|---|
country_iso3 |
ISO 3-letter country code |
country_iso2 |
ISO 2-letter country code |
country_name |
Country name |
date |
End-of-month date |
ym |
Year-month string (YYYY-MM) |
usd_per_domestic |
Domestic currency per 1 USD |
log_usd_per_domestic |
Natural log of exchange rate |
Both ISO2 and ISO3 codes are included to simplify integration with:
- IATI datasets
- OECD CRS datasets
- National aid platforms
- Government finance systems
- Custom financial tools and pipelines
Users do not need to perform separate country code mapping.
Performance
The dataset helper uses:
- Batched SDMX country keys (reducing HTTP calls)
- Parallel batch fetching
- Polars-based parsing for speed and memory efficiency
- Columnar construction rather than row-by-row dictionary assembly
Typical performance:
- Full historical dataset (1924–present)
- 150k rows
- ~2–3 seconds on a standard machine
Time-windowed requests are significantly faster.
Minimal Dependencies
External dependencies are intentionally minimal:
- requests
- polars
- pycountry
This keeps the package lightweight and suitable for integration into larger systems.
Public API
Stable public interface:
from imf_fx import monthly_usd_only
License
MIT License
IMF Data License
The source of the data is extracted from the IMF's Exchange Data.
Below is an excerpt on the IMF Copyright and Usage page, effective 11 October, 2024; accessed 2026-02-23:
You may download, extract, copy, create derivative works, publish, distribute, and use Data obtained from IMF Sites, subject to the following conditions:
Whether obtained directly from the IMF or another party, when Data is distributed or reproduced in any manner, it must appear accurately with attribution to the IMF as the source, e.g. “Source: International Monetary Fund, Database Name, <>.”
Users shall not infringe upon the integrity of the Data and in particular shall refrain from any act of alteration of the Data that intentionally affects its nature or accuracy. If the Data is materially transformed by the User, this must be stated explicitly along with the required source citation.
Users who make IMF Data available to other Users through any type of distribution or download environment agree to take reasonable efforts to communicate and promote compliance by their users with these terms.
If IMF Data is sold by Users as a standalone product, sellers must inform purchasers that the Data is available free of charge from the IMF.
The Data is provided to Users “as is” and without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement.
The policy of free access and free reuse of IMF Data does not imply a right to obtain confidential or any unpublished data, over which the IMF reserves all rights.
Except as stated in this Section on Data Usage, all other terms set forth in the general terms and conditions shall continue to apply to use of IMF Data.
For any potential commercial reuse of IMF Data, please email copyright@imf.org to request permission.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imf_fx-0.1.0.tar.gz.
File metadata
- Download URL: imf_fx-0.1.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069a2f6e0f6de4a752cbe997e6921d6da229ed6320ea5316a1b3520f7d450c3c
|
|
| MD5 |
547d21bd5169093f1dcfb303831ba9bd
|
|
| BLAKE2b-256 |
5d171c3abcecafb5cca75bdcec1c66c5c0653f37fa594a0e3d50d46a5813bee4
|
File details
Details for the file imf_fx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: imf_fx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6ee56730add09c794461cd8490fed11ec01f1f92d5e8eb9198d25e4f54b8868
|
|
| MD5 |
2a17ef07b242c5cf06634dfb60339fd6
|
|
| BLAKE2b-256 |
0a89b6bf15f72228fdc2eb532290d0c5b2813b9575dc41637668b5cd6410f141
|