A Python library for managing and analyzing macroeconomic time series data with vintage awareness.
Project description
MacroTrace
MacroTrace is a Python library for collecting, storing, and analyzing macroeconomic time-series vintages. It is designed for research workflows where the revision history matters just as much as the latest published value.
Documentation: https://john-ramsey.github.io/macrotrace/
Instead of treating a series as a single final dataset, MacroTrace helps you work with the sequence of releases that were available in real time. This makes it easier to study data revisions, reproduce historical analyses, and compare what was known at different publication dates.
Features
- Fetch vintage-aware macroeconomic time series from FRED and ONS
- Store releases locally in SQLite for reproducible, offline-friendly workflows
- Retrieve series as they were known on a specific date with
as_of(...) - Filter both vintage windows and data windows when loading a series
- Export to pandas DataFrames and Darts
TimeSeriesobjects - Plot vintages and revision comparisons with built-in Plotly tooling
Installation
Install the package from PyPI:
pip install macrotrace
Install the optional ONS Textual interface:
pip install "macrotrace[ons-tui]"
Requirements
- Python 3.11+
- A FRED API key for FRED-backed series
Set your FRED API key before loading FRED series:
export FRED_API_KEY="your_api_key_here"
Quick Start
from macrotrace import MTTimeSeries
payems = MTTimeSeries(
dataset_id="PAYEMS",
source="FRED",
)
print(payems)
july_2020 = payems.as_of("2020-07-15")
df = july_2020.to_dataframe()
MacroTrace stores fetched releases in a local SQLite database named
MacroTrace.db, making repeated loads faster and keeping vintage histories
available for later analysis.
For multi-dimensional datasets such as ONS releases, provide a series_key to
select a specific slice of the dataset:
from macrotrace import MTTimeSeries
gdp = MTTimeSeries(
dataset_id="gdp-to-four-decimal-places",
source="ONS",
series_key={
"geography": "K02000001",
"unofficialstandardindustrialclassification": "A--T",
},
)
Command-Line Tools
MacroTrace includes command-line tools for exploring ONS datasets:
macrotrace ons explorer
If you installed the optional TUI extra, you can also run:
macrotrace ons tui
Development
For local development, we use uv for dependency management and environment
execution.
Install the project with the development, docs, and optional TUI dependencies:
uv sync --extra ons-tui --group dev --group docs
Run tests inside the managed environment with:
uv run pytest
Code formatting is handled with black:
uv run black .
Project Status
MacroTrace is under active development as part of a PhD research project on macroeconomic data revisions.
License
MacroTrace is licensed under the GNU General Public License v3.0 or later
(GPL-3.0-or-later).
Project details
Release history Release notifications | RSS feed
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 macrotrace-0.1.0.tar.gz.
File metadata
- Download URL: macrotrace-0.1.0.tar.gz
- Upload date:
- Size: 441.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
827b3b6e0f04e87e7b726e8db3ab6479cf1046a8d6eb15e61ead2fd5a24462d1
|
|
| MD5 |
5d08a0ae413a1c3a63fb94bd02eb823f
|
|
| BLAKE2b-256 |
1977c96bcd23895e123b455a8a0ac58539a12aa43f8b6ac7817cfab1f7a0df76
|
Provenance
The following attestation bundles were made for macrotrace-0.1.0.tar.gz:
Publisher:
release.yml on john-ramsey/macrotrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macrotrace-0.1.0.tar.gz -
Subject digest:
827b3b6e0f04e87e7b726e8db3ab6479cf1046a8d6eb15e61ead2fd5a24462d1 - Sigstore transparency entry: 1397291049
- Sigstore integration time:
-
Permalink:
john-ramsey/macrotrace@ccd207477b4d53a6c1432526ac917b7a2e2482ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/john-ramsey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ccd207477b4d53a6c1432526ac917b7a2e2482ef -
Trigger Event:
push
-
Statement type:
File details
Details for the file macrotrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: macrotrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 102.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
278e8f602a52d0162f5ea498e83a2f6f2b69b32343839460bd50128b2b96ea09
|
|
| MD5 |
ad6cfa6617732879aa3f5b407294f001
|
|
| BLAKE2b-256 |
b5809a1dfd767c434513e435f1d4b40e8512cafc43a2679711eef3f4662bff43
|
Provenance
The following attestation bundles were made for macrotrace-0.1.0-py3-none-any.whl:
Publisher:
release.yml on john-ramsey/macrotrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macrotrace-0.1.0-py3-none-any.whl -
Subject digest:
278e8f602a52d0162f5ea498e83a2f6f2b69b32343839460bd50128b2b96ea09 - Sigstore transparency entry: 1397291094
- Sigstore integration time:
-
Permalink:
john-ramsey/macrotrace@ccd207477b4d53a6c1432526ac917b7a2e2482ef -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/john-ramsey
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ccd207477b4d53a6c1432526ac917b7a2e2482ef -
Trigger Event:
push
-
Statement type: