fredq 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fredq-0.1.0/.gitignore +37 -0
- fredq-0.1.0/AGENTS.md +84 -0
- fredq-0.1.0/CHANGELOG.md +33 -0
- fredq-0.1.0/LICENSE +21 -0
- fredq-0.1.0/PKG-INFO +413 -0
- fredq-0.1.0/README.md +381 -0
- fredq-0.1.0/RELEASING.md +55 -0
- fredq-0.1.0/pyproject.toml +253 -0
- fredq-0.1.0/src/fredq/__init__.py +7 -0
- fredq-0.1.0/src/fredq/__main__.py +8 -0
- fredq-0.1.0/src/fredq/auth.py +114 -0
- fredq-0.1.0/src/fredq/cli.py +702 -0
- fredq-0.1.0/src/fredq/client.py +263 -0
- fredq-0.1.0/src/fredq/commands.py +1470 -0
- fredq-0.1.0/src/fredq/exceptions.py +54 -0
- fredq-0.1.0/src/fredq/params.py +247 -0
- fredq-0.1.0/src/fredq/parquet_writer.py +269 -0
- fredq-0.1.0/src/fredq/types.py +8 -0
- fredq-0.1.0/tests/__init__.py +1 -0
- fredq-0.1.0/tests/test_auth.py +197 -0
- fredq-0.1.0/tests/test_cli.py +615 -0
- fredq-0.1.0/tests/test_cli_architecture.py +248 -0
- fredq-0.1.0/tests/test_cli_endpoints.py +1140 -0
- fredq-0.1.0/tests/test_cli_endpoints_groups245.py +577 -0
- fredq-0.1.0/tests/test_cli_geofred.py +371 -0
- fredq-0.1.0/tests/test_cli_parquet.py +184 -0
- fredq-0.1.0/tests/test_client.py +295 -0
- fredq-0.1.0/tests/test_package_data.py +27 -0
- fredq-0.1.0/tests/test_params.py +332 -0
- fredq-0.1.0/tests/test_parquet_writer.py +292 -0
fredq-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Byte-compiled / optimized files
|
|
2
|
+
__pycache__/
|
|
3
|
+
|
|
4
|
+
# Test and coverage output
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.coverage
|
|
7
|
+
coverage.xml
|
|
8
|
+
junit*.xml
|
|
9
|
+
htmlcov/
|
|
10
|
+
|
|
11
|
+
# Virtual environments and uv cache
|
|
12
|
+
.venv/
|
|
13
|
+
.uv-cache/
|
|
14
|
+
|
|
15
|
+
# Tool caches
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
.tox/
|
|
18
|
+
.mypy_cache/
|
|
19
|
+
node_modules/
|
|
20
|
+
|
|
21
|
+
# Editors
|
|
22
|
+
.vscode/
|
|
23
|
+
|
|
24
|
+
# Claude Code local state
|
|
25
|
+
.claude/
|
|
26
|
+
|
|
27
|
+
# Local API key material (never commit)
|
|
28
|
+
.fredq-key
|
|
29
|
+
fredq-key.txt
|
|
30
|
+
|
|
31
|
+
# Worktrees + scratch
|
|
32
|
+
.worktrees/
|
|
33
|
+
output/
|
|
34
|
+
tmp/
|
|
35
|
+
|
|
36
|
+
# Ad-hoc fredq report fleet (generated artifacts, data dumps, builders)
|
|
37
|
+
report/
|
fredq-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
fredq exposes FRED (Federal Reserve Economic Data) HTTP endpoints as an LLM-friendly CLI that prints the raw JSON FRED returns.
|
|
5
|
+
|
|
6
|
+
## Stack
|
|
7
|
+
Python 3.10+, uv, httpx, argparse, pytest, pytest-httpx, ruff, pyright, tox, hatchling.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
- Install/sync: `uv sync --all-groups`
|
|
11
|
+
- Run CLI: `uv run fredq --help`
|
|
12
|
+
- Test single: `uv run pytest path/to/test_file.py`
|
|
13
|
+
- Test all: `uv run pytest`
|
|
14
|
+
- Lint: `uv run ruff check .`
|
|
15
|
+
- Format: `uv run ruff format .`
|
|
16
|
+
- Type check: `uv run pyright`
|
|
17
|
+
- Spell check: `npm run spell` or `make spell`
|
|
18
|
+
- Spell changed files: `npm run spell:changed` or `make spell-changed`
|
|
19
|
+
- Full check: `uv run tox`
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
- `src/fredq/client.py` -> FRED HTTP client (single async GET, api_key injection, retries, raw response retrieval).
|
|
23
|
+
- `src/fredq/auth.py` -> Read FRED_API_KEY from env or fallback file.
|
|
24
|
+
- `src/fredq/commands.py` -> command metadata used to build CLI commands, validation, and help.
|
|
25
|
+
- `src/fredq/params.py` -> CLI parameter coercion and validation helpers.
|
|
26
|
+
- `src/fredq/cli.py` -> argparse command tree and stdout/stderr behavior.
|
|
27
|
+
- `tests/` -> pytest tests mirroring `src/fredq/`.
|
|
28
|
+
|
|
29
|
+
## Rules
|
|
30
|
+
- IMPORTANT: `--help` is the primary product surface; keep it complete, adaptive, and generated from command metadata where practical.
|
|
31
|
+
- Do not add `describe`, `endpoints`, `params`, or other discovery commands; discovery belongs under `fredq --help` and `fredq <endpoint> --help`.
|
|
32
|
+
- Print FRED response bodies to stdout exactly as returned; do not model, reshape, pretty-print, or interpret endpoint JSON.
|
|
33
|
+
- Keep FRED endpoint knowledge in metadata and validation only; do not create response classes.
|
|
34
|
+
- Use `uv run python` for Python scripts; never use bare `python` or `python3`.
|
|
35
|
+
- Never log or print the FRED API key.
|
|
36
|
+
- Keep runtime dependencies narrow; do not add TUI, ORM, web framework, or rich formatting libraries.
|
|
37
|
+
|
|
38
|
+
## API key
|
|
39
|
+
- Primary: `FRED_API_KEY` environment variable.
|
|
40
|
+
- Fallback: file at `~/.fredq/api_key` (single line, key only).
|
|
41
|
+
- The CLI must redact the key from any error messages and never log it.
|
|
42
|
+
|
|
43
|
+
## Help text
|
|
44
|
+
When adding or editing a CLI command:
|
|
45
|
+
1. **Summary**: active verb, ≤68 chars (over wraps two-line in top-level help). `Fetch` (data), `List` (catalog), `Search` (text), `Show` (single entity), `Discover` (curated). Pair sibling commands with the same verb.
|
|
46
|
+
2. **Description**: describe response content, not fredq mechanics. Forbidden phrasings: `Calls FRED`, `writes to stdout`, `response-model mapping`. The root parser already covers output behavior. Do not paraphrase the summary.
|
|
47
|
+
3. **Notes**: real clarifications only — FRED quirks, switch-behavior surprises, dependencies. Drop diary entries and redundant restatements.
|
|
48
|
+
4. **Order in `COMMANDS` tuple by importance**: daily-driver → discovery → entity lookups → schema introspection. Never append to the end.
|
|
49
|
+
5. **Param boilerplate is shared** (`--api-key`, `--realtime-start`, `--realtime-end` use exact strings — copy them). Run `pytest -k help` before and after.
|
|
50
|
+
|
|
51
|
+
## Output formats
|
|
52
|
+
- **Default**: raw FRED JSON to stdout, exactly as returned.
|
|
53
|
+
- **Parquet**: opt-in via `--format parquet --out PATH`, `series-observations` only. Parses the response into a typed table (`date`, `value`, realtime bounds) with the response envelope stored as schema metadata. Other endpoints reject `--format parquet` with a usage error.
|
|
54
|
+
- Other endpoints stay JSON-only.
|
|
55
|
+
|
|
56
|
+
## Workflow
|
|
57
|
+
- Make minimal changes and avoid unrelated refactors.
|
|
58
|
+
- When adding a command or parameter, update validation, adaptive help, and tests in the same change.
|
|
59
|
+
- Prefer focused unit tests with mocked HTTP; mark live FRED tests as integration.
|
|
60
|
+
- Before considering code changes done, run `uv run tox`. It is the expected bundled verification for formatting, lint, type check, tests, and spelling.
|
|
61
|
+
- For command or parameter changes, also run the app against FRED after `tox`:
|
|
62
|
+
- `uv run fredq <command> --help`
|
|
63
|
+
- `uv run fredq <command> <minimal required parameters>`
|
|
64
|
+
- `uv run fredq <command> <parameters with each supported date format when dates are involved>`
|
|
65
|
+
- `uv run fredq <command> <parameters with meaningful values that could affect FRED's raw output>`
|
|
66
|
+
- When a parameter has a default, test both omission and explicit override if the default affects the request sent to FRED.
|
|
67
|
+
- Ask before making architectural changes that affect the CLI grammar or auth behavior.
|
|
68
|
+
|
|
69
|
+
## FRED API state probes
|
|
70
|
+
- When checking the current FRED API surface, use a varied set of series, releases, and categories so behavior is not inferred from one path only.
|
|
71
|
+
- Baseline probe targets:
|
|
72
|
+
- Series: `GNPCA` (annual GDP), `DGS10` (10y yield), `CPIAUCSL` (CPI), `UNRATE` (unemployment), `FEDFUNDS` (fed funds), `DEXCAUS` (CAD/USD)
|
|
73
|
+
- Categories: `32991` (Money, Banking), `0` (root)
|
|
74
|
+
- Releases: `53` (GDP), `10` (CPI), `175` (Employment)
|
|
75
|
+
- Sources: `1` (Board of Governors), `3` (Bureau of Labor Statistics)
|
|
76
|
+
- Add targeted probes when an endpoint is series-sensitive, but keep this baseline for broad API-surface discovery.
|
|
77
|
+
|
|
78
|
+
## GeoFRED / Maps
|
|
79
|
+
- Implemented under the `geofred` subcommand group (`series-group`, `series-data`, `regional-data`, `shapes`). Different base URL; regional data keyed by FIPS; `shapes` returns Highcharts-format GeoJSON in a Lambert Conformal Conic projection (not WGS84).
|
|
80
|
+
|
|
81
|
+
## Out of scope
|
|
82
|
+
- Mapping FRED JSON into Python domain models.
|
|
83
|
+
- Separate documentation/discovery subcommands.
|
|
84
|
+
- Secrets or API keys in checked-in files.
|
fredq-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to fredq are documented here. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0]
|
|
10
|
+
|
|
11
|
+
Initial release.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- CLI for every public FRED API endpoint, printing raw FRED JSON to stdout.
|
|
16
|
+
- Endpoint-specific commands across series, search, tags, categories,
|
|
17
|
+
releases, release tables, and sources.
|
|
18
|
+
- `series-observations` unit transforms (`--units`) and frequency aggregation
|
|
19
|
+
(`--frequency`).
|
|
20
|
+
- ALFRED point-in-time support: `--realtime-start` / `--realtime-end` and
|
|
21
|
+
`series-vintagedates`.
|
|
22
|
+
- GeoFRED / Maps regional data via the `geofred` subcommand group
|
|
23
|
+
(`series-group`, `series-data`, `regional-data`, `shapes`).
|
|
24
|
+
- Typed Parquet output for `series-observations` (`--format parquet --out`),
|
|
25
|
+
via the optional `parquet` extra.
|
|
26
|
+
- Adaptive `--help` generated from command metadata, with parameters, allowed
|
|
27
|
+
value sets, and examples.
|
|
28
|
+
- API key resolution from `FRED_API_KEY`, `~/.fredq/api_key`, or `--api-key`,
|
|
29
|
+
with the key redacted from all errors and logs.
|
|
30
|
+
- Exit-code contract: `0` success, `1` FRED request failure, `2` usage error.
|
|
31
|
+
|
|
32
|
+
[Unreleased]: https://github.com/joce/fredq/compare/v0.1.0...HEAD
|
|
33
|
+
[0.1.0]: https://github.com/joce/fredq/releases/tag/v0.1.0
|
fredq-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jocelyn Legault
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
fredq-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fredq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LLM-friendly CLI for raw FRED (Federal Reserve Economic Data) API JSON.
|
|
5
|
+
Project-URL: Homepage, https://github.com/joce/fredq
|
|
6
|
+
Project-URL: Repository, https://github.com/joce/fredq
|
|
7
|
+
Project-URL: Issues, https://github.com/joce/fredq/issues
|
|
8
|
+
Author-email: Jocelyn Legault <jocelynlegault@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,economic-data,federal-reserve,fred,llm-tools,macro
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
25
|
+
Classifier: Topic :: Utilities
|
|
26
|
+
Requires-Python: <4.0,>=3.10
|
|
27
|
+
Requires-Dist: httpx<1.0,>=0.28
|
|
28
|
+
Requires-Dist: typing-extensions>=4.13
|
|
29
|
+
Provides-Extra: parquet
|
|
30
|
+
Requires-Dist: pyarrow<25,>=15; extra == 'parquet'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# fredq
|
|
34
|
+
|
|
35
|
+
[](https://github.com/joce/fredq/actions/workflows/ci.yml)
|
|
36
|
+
[](https://codecov.io/gh/joce/fredq)
|
|
37
|
+
[](https://github.com/astral-sh/ruff)
|
|
38
|
+
[](https://github.com/psf/black)
|
|
39
|
+
[](https://github.com/joce/fredq/blob/main/LICENSE)
|
|
40
|
+
|
|
41
|
+
FRED Query — Federal Reserve Economic Data on the command line.
|
|
42
|
+
|
|
43
|
+
fredq brings the [FRED](https://fred.stlouisfed.org/docs/api/fred/) (Federal
|
|
44
|
+
Reserve Economic Data) HTTP endpoints to the command line. It is built for
|
|
45
|
+
scripts, agents, and quick terminal work that needs the JSON returned by the
|
|
46
|
+
FRED API.
|
|
47
|
+
|
|
48
|
+
The project stays deliberately close to the source. It does not reshape FRED
|
|
49
|
+
responses, define economic domain models, or add a discovery API beyond CLI
|
|
50
|
+
help.
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- Raw FRED JSON on stdout, with no pretty-printing or interpretation.
|
|
55
|
+
- Endpoint-specific commands for every public FRED API endpoint.
|
|
56
|
+
- Generated help that includes examples, parameters, and known value sets.
|
|
57
|
+
- Typed Parquet output for `series-observations` when a long time series is
|
|
58
|
+
more useful as a columnar table than as JSON.
|
|
59
|
+
- ALFRED point-in-time support (`--realtime-start`, `--realtime-end`,
|
|
60
|
+
`series-vintagedates`).
|
|
61
|
+
- GeoFRED / Maps regional data (`geofred` subcommands): regional time series,
|
|
62
|
+
all-region snapshots, series-group metadata, and GeoJSON shape files.
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
fredq is a Python 3.10+ project. Install it as a tool with
|
|
67
|
+
[uv](https://docs.astral.sh/uv/) or with pip:
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
uv tool install fredq
|
|
71
|
+
# or
|
|
72
|
+
pip install fredq
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
For Parquet output, include the `parquet` extra:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
uv tool install "fredq[parquet]"
|
|
79
|
+
# or
|
|
80
|
+
pip install "fredq[parquet]"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then run:
|
|
84
|
+
|
|
85
|
+
```powershell
|
|
86
|
+
fredq --help
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### From Source
|
|
90
|
+
|
|
91
|
+
To run from a local checkout (development):
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
uv sync --all-groups
|
|
95
|
+
uv run fredq --help
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Or install the checkout as a tool:
|
|
99
|
+
|
|
100
|
+
```powershell
|
|
101
|
+
uv tool install .
|
|
102
|
+
fredq --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## API Key
|
|
106
|
+
|
|
107
|
+
The FRED API requires a free API key. Request one at
|
|
108
|
+
<https://fred.stlouisfed.org/docs/api/api_key.html>.
|
|
109
|
+
|
|
110
|
+
fredq reads the key from, in order:
|
|
111
|
+
|
|
112
|
+
1. The `FRED_API_KEY` environment variable.
|
|
113
|
+
2. The first non-empty line of `~/.fredq/api_key`.
|
|
114
|
+
3. The `--api-key` flag (visible in process listings; prefer the env var).
|
|
115
|
+
|
|
116
|
+
On POSIX systems, restrict the key file so only your user can read it:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
chmod 600 ~/.fredq/api_key
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
fredq emits a warning if the file is readable by group or world. To disable
|
|
123
|
+
the file fallback entirely (for hermetic runs), set `FREDQ_DISABLE_KEY_FILE=1`
|
|
124
|
+
or pass `--no-key-file`.
|
|
125
|
+
|
|
126
|
+
fredq never prints, logs, or echoes the API key. The key is also redacted
|
|
127
|
+
from URLs in error messages and from any httpx debug logs emitted under
|
|
128
|
+
`--verbose`.
|
|
129
|
+
|
|
130
|
+
## Quick Start
|
|
131
|
+
|
|
132
|
+
Show metadata for a series:
|
|
133
|
+
|
|
134
|
+
```powershell
|
|
135
|
+
uv run fredq series --series-id GNPCA
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Fetch a series' observations:
|
|
139
|
+
|
|
140
|
+
```powershell
|
|
141
|
+
uv run fredq series-observations --series-id CPIAUCSL
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Apply a unit transformation and frequency aggregation:
|
|
145
|
+
|
|
146
|
+
```powershell
|
|
147
|
+
uv run fredq series-observations --series-id CPIAUCSL --units pch --frequency m
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Search for a series by keyword:
|
|
151
|
+
|
|
152
|
+
```powershell
|
|
153
|
+
uv run fredq series-search --search-text "10-year treasury" --limit 10
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Browse the FRED category tree from the root:
|
|
157
|
+
|
|
158
|
+
```powershell
|
|
159
|
+
uv run fredq category-children --category-id 0
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
List recent economic releases:
|
|
163
|
+
|
|
164
|
+
```powershell
|
|
165
|
+
uv run fredq releases --limit 10
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
List recent release publication dates across all releases:
|
|
169
|
+
|
|
170
|
+
```powershell
|
|
171
|
+
uv run fredq releases-dates --limit 20
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Show metadata for a specific release (53 = GDP):
|
|
175
|
+
|
|
176
|
+
```powershell
|
|
177
|
+
uv run fredq release --release-id 53
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Find all series tagged with a set of FRED tags:
|
|
181
|
+
|
|
182
|
+
```powershell
|
|
183
|
+
uv run fredq tags-series --tag-names "usa;monthly;cpi" --limit 25
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
ALFRED point-in-time: see what GDP looked like on a past date:
|
|
187
|
+
|
|
188
|
+
```powershell
|
|
189
|
+
uv run fredq series-vintagedates --series-id GNPCA
|
|
190
|
+
uv run fredq series-observations --series-id GNPCA --realtime-start 2024-09-25
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Fetch GeoFRED regional data — per-capita income by state for one year:
|
|
194
|
+
|
|
195
|
+
```powershell
|
|
196
|
+
uv run fredq geofred series-group --series-id WIPCPI
|
|
197
|
+
uv run fredq geofred series-data --series-id WIPCPI --start-date 2022-01-01
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Parquet Output
|
|
201
|
+
|
|
202
|
+
`series-observations` can write a typed Parquet table instead of raw JSON.
|
|
203
|
+
Install with the `parquet` extra to pull in `pyarrow`:
|
|
204
|
+
|
|
205
|
+
```powershell
|
|
206
|
+
uv sync --extra parquet
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Then pass `--format parquet --out PATH`:
|
|
210
|
+
|
|
211
|
+
```powershell
|
|
212
|
+
uv run fredq series-observations --series-id CPIAUCSL --units pch --frequency m \
|
|
213
|
+
--format parquet --out cpi_yoy.parquet
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
On success a single JSON descriptor line goes to stdout (the file format, out
|
|
217
|
+
path, row count, byte size). The Parquet schema is `date` (date32), `value`
|
|
218
|
+
(float64), `realtime_start` (date32), `realtime_end` (date32). FRED's
|
|
219
|
+
missing-value sentinel `.` is written as `NaN`. The full response envelope
|
|
220
|
+
(count, offset, limit, observation range, units, sort order) and the request
|
|
221
|
+
context (units, frequency, realtime range) are stored as schema key-value
|
|
222
|
+
metadata so the table is self-describing.
|
|
223
|
+
|
|
224
|
+
Parquet writes are scoped to `series-observations` only; every other command
|
|
225
|
+
stays JSON-only, and rejects `--format parquet` with a usage error. Parquet
|
|
226
|
+
output assumes FRED's default observation layout (one row per observation);
|
|
227
|
+
fredq does not expose FRED's alternative `output_type` modes.
|
|
228
|
+
|
|
229
|
+
## Commands
|
|
230
|
+
|
|
231
|
+
Use root help to see the command list:
|
|
232
|
+
|
|
233
|
+
```powershell
|
|
234
|
+
uv run fredq --help
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Current commands, grouped by how often they're reached for:
|
|
238
|
+
|
|
239
|
+
**Daily-driver fetches**
|
|
240
|
+
|
|
241
|
+
| Command | FRED data |
|
|
242
|
+
| --- | --- |
|
|
243
|
+
| `series` | Show metadata for one FRED series (title, units, frequency, observation range). |
|
|
244
|
+
| `series-observations` | Fetch the observation values for one FRED series. |
|
|
245
|
+
|
|
246
|
+
**Series discovery**
|
|
247
|
+
|
|
248
|
+
| Command | FRED data |
|
|
249
|
+
| --- | --- |
|
|
250
|
+
| `series-search` | Search FRED series by keyword. |
|
|
251
|
+
| `series-search-tags` | List tags for a series full-text search. |
|
|
252
|
+
| `series-search-related-tags` | List tags related to a search and existing tag filter. |
|
|
253
|
+
| `tags-series` | List series matching a set of FRED tags. |
|
|
254
|
+
| `tags` | List all FRED tags. |
|
|
255
|
+
| `related-tags` | List tags related to an existing tag filter. |
|
|
256
|
+
|
|
257
|
+
**Series-bound analysis**
|
|
258
|
+
|
|
259
|
+
| Command | FRED data |
|
|
260
|
+
| --- | --- |
|
|
261
|
+
| `series-vintagedates` | List vintage dates (revision dates) for one FRED series. |
|
|
262
|
+
| `series-categories` | List categories that contain a given series. |
|
|
263
|
+
| `series-tags` | List tags assigned to a FRED series. |
|
|
264
|
+
| `series-release` | Show the release that a FRED series belongs to. |
|
|
265
|
+
| `series-updates` | List recently updated FRED series. |
|
|
266
|
+
|
|
267
|
+
**Category browse**
|
|
268
|
+
|
|
269
|
+
| Command | FRED data |
|
|
270
|
+
| --- | --- |
|
|
271
|
+
| `category` | Show metadata for one FRED category. |
|
|
272
|
+
| `category-children` | List child categories of a FRED category. |
|
|
273
|
+
| `category-related` | List categories related to a given FRED category. |
|
|
274
|
+
| `category-series` | List series belonging to one FRED category. |
|
|
275
|
+
| `category-tags` | List tags for series in one FRED category. |
|
|
276
|
+
| `category-related-tags` | List tags related to a category and existing tag filter. |
|
|
277
|
+
|
|
278
|
+
**Releases and calendar**
|
|
279
|
+
|
|
280
|
+
| Command | FRED data |
|
|
281
|
+
| --- | --- |
|
|
282
|
+
| `releases` | List all FRED economic data releases. |
|
|
283
|
+
| `releases-dates` | List release dates across all FRED releases. |
|
|
284
|
+
| `release` | Show metadata for one FRED release. |
|
|
285
|
+
| `release-dates` | List publication dates for one FRED release. |
|
|
286
|
+
| `release-series` | List series belonging to one FRED release. |
|
|
287
|
+
| `release-sources` | List sources for one FRED release. |
|
|
288
|
+
| `release-tags` | List tags for one FRED release. |
|
|
289
|
+
| `release-related-tags` | List tags related to a release and existing tag filter. |
|
|
290
|
+
| `release-tables` | Fetch the hierarchical data table for one FRED release. |
|
|
291
|
+
|
|
292
|
+
**Sources**
|
|
293
|
+
|
|
294
|
+
| Command | FRED data |
|
|
295
|
+
| --- | --- |
|
|
296
|
+
| `sources` | List all FRED data sources. |
|
|
297
|
+
| `source` | Show metadata for one FRED source. |
|
|
298
|
+
| `source-releases` | List releases published by one FRED source. |
|
|
299
|
+
|
|
300
|
+
**GeoFRED / Maps (`geofred` subcommands)**
|
|
301
|
+
|
|
302
|
+
| Command | FRED data |
|
|
303
|
+
| --- | --- |
|
|
304
|
+
| `geofred series-group` | Show GeoFRED series-group metadata (region type, season, frequency, units). |
|
|
305
|
+
| `geofred series-data` | Fetch the regional time series for one FRED series. |
|
|
306
|
+
| `geofred regional-data` | Fetch a regional snapshot — all regions for a single date. |
|
|
307
|
+
| `geofred shapes` | Download a GeoJSON shape file for a region type, to `--out`. |
|
|
308
|
+
|
|
309
|
+
The GeoFRED endpoints use a different base URL and return regional data keyed by
|
|
310
|
+
FIPS code. `geofred shapes` returns Highcharts-format GeoJSON whose coordinates
|
|
311
|
+
are in a Lambert Conformal Conic projection (not WGS84); reproject before mixing
|
|
312
|
+
with lat/lon basemaps. See `fredq geofred --help` for the full subcommand list.
|
|
313
|
+
|
|
314
|
+
Each endpoint has its own adaptive help:
|
|
315
|
+
|
|
316
|
+
```powershell
|
|
317
|
+
uv run fredq series --help
|
|
318
|
+
uv run fredq series-observations --help
|
|
319
|
+
uv run fredq series-search --help
|
|
320
|
+
uv run fredq releases-dates --help
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Endpoint help is the primary documentation surface. It shows the FRED target
|
|
324
|
+
endpoint, accepted parameters, allowed value sets, defaults, and examples.
|
|
325
|
+
|
|
326
|
+
## Dates, Booleans, and Tag Lists
|
|
327
|
+
|
|
328
|
+
Date parameters accept:
|
|
329
|
+
|
|
330
|
+
- `YYYY-MM-DD` calendar dates.
|
|
331
|
+
- ISO 8601 datetimes (the time component is dropped; UTC assumed for naive
|
|
332
|
+
values).
|
|
333
|
+
- Unix timestamps in seconds (≥10 digits).
|
|
334
|
+
|
|
335
|
+
Boolean parameters accept common true and false forms such as `true`, `false`,
|
|
336
|
+
`1`, `0`, `yes`, and `no`.
|
|
337
|
+
|
|
338
|
+
Tag lists (`--tag-names`, `--exclude-tag-names`) use semicolons as
|
|
339
|
+
separators, matching FRED's wire format:
|
|
340
|
+
|
|
341
|
+
```powershell
|
|
342
|
+
uv run fredq tags-series --tag-names "usa;annual"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## ALFRED Point-in-Time
|
|
346
|
+
|
|
347
|
+
Most endpoints accept `--realtime-start` and `--realtime-end` to view data
|
|
348
|
+
as of a historical date (the [ALFRED](https://alfred.stlouisfed.org/)
|
|
349
|
+
archival API). Combined with `series-vintagedates`, this lets you replay
|
|
350
|
+
what an analyst would have seen on a specific past date — useful for
|
|
351
|
+
backtests and for distinguishing data revisions from real-time signals.
|
|
352
|
+
|
|
353
|
+
```powershell
|
|
354
|
+
# When were GNP revisions published?
|
|
355
|
+
uv run fredq series-vintagedates --series-id GNPCA
|
|
356
|
+
|
|
357
|
+
# What did GNP look like on 2024-09-25?
|
|
358
|
+
uv run fredq series-observations --series-id GNPCA \
|
|
359
|
+
--realtime-start 2024-09-25 --realtime-end 2024-09-25
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Output Contract
|
|
363
|
+
|
|
364
|
+
fredq writes the FRED response body to stdout exactly as returned. This makes
|
|
365
|
+
it easy to pipe into tools that expect JSON:
|
|
366
|
+
|
|
367
|
+
```powershell
|
|
368
|
+
uv run fredq series --series-id GNPCA | jq .
|
|
369
|
+
uv run fredq releases --limit 25 | jq '.releases[].name'
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Diagnostics, warnings, and errors are written to stderr. The exit code is
|
|
373
|
+
`0` on success, `1` on a FRED request failure, and `2` on a usage or
|
|
374
|
+
configuration error.
|
|
375
|
+
|
|
376
|
+
## Development
|
|
377
|
+
|
|
378
|
+
Install development dependencies:
|
|
379
|
+
|
|
380
|
+
```powershell
|
|
381
|
+
uv sync --all-groups
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Run the test suite:
|
|
385
|
+
|
|
386
|
+
```powershell
|
|
387
|
+
uv run pytest
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Run checks locally:
|
|
391
|
+
|
|
392
|
+
```powershell
|
|
393
|
+
uv run black --check .
|
|
394
|
+
uv run ruff format --check --diff .
|
|
395
|
+
uv run ruff check .
|
|
396
|
+
uv run pyright
|
|
397
|
+
uv run pytest -n auto
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Run the full project check, including Python checks across supported
|
|
401
|
+
versions and spelling:
|
|
402
|
+
|
|
403
|
+
```powershell
|
|
404
|
+
uv run tox
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
When adding or changing command metadata, update validation, adaptive help,
|
|
408
|
+
and tests together. Then verify the relevant command against FRED with its
|
|
409
|
+
help, minimal required parameters, and representative optional parameters.
|
|
410
|
+
|
|
411
|
+
## License
|
|
412
|
+
|
|
413
|
+
fredq is released under the MIT License. See [LICENSE](LICENSE).
|