pyfred-client 0.2.0__py3-none-any.whl
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.
- pyfred/__init__.py +53 -0
- pyfred/__main__.py +14 -0
- pyfred/core.py +2257 -0
- pyfred/py.typed +0 -0
- pyfred_client-0.2.0.dist-info/METADATA +390 -0
- pyfred_client-0.2.0.dist-info/RECORD +9 -0
- pyfred_client-0.2.0.dist-info/WHEEL +4 -0
- pyfred_client-0.2.0.dist-info/entry_points.txt +2 -0
- pyfred_client-0.2.0.dist-info/licenses/LICENSE +21 -0
pyfred/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pyfred-client
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python wrapper for the St. Louis Fed's FRED and ALFRED API: economic time series, their revisions and vintages, searches, categories, releases and tags as typed pandas or polars DataFrames.
|
|
5
|
+
Project-URL: Homepage, https://github.com/hmorao95/pyfred-client
|
|
6
|
+
Project-URL: Repository, https://github.com/hmorao95/pyfred-client
|
|
7
|
+
Project-URL: Changelog, https://github.com/hmorao95/pyfred-client/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Issues, https://github.com/hmorao95/pyfred-client/issues
|
|
9
|
+
Project-URL: Data source, https://fred.stlouisfed.org/docs/api/fred/
|
|
10
|
+
Author-email: Hugo Morão <132693995+hmorao95@users.noreply.github.com>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: alfred,api,economic data,federal reserve,fred,macroeconomics,real-time data,revisions,st. louis fed,time series,vintages
|
|
14
|
+
Requires-Python: >=3.12
|
|
15
|
+
Requires-Dist: openpyxl>=3.1
|
|
16
|
+
Requires-Dist: pandas>=2.2
|
|
17
|
+
Requires-Dist: pyarrow>=15.0
|
|
18
|
+
Requires-Dist: requests>=2.28
|
|
19
|
+
Requires-Dist: wrapkit<0.5,>=0.4
|
|
20
|
+
Provides-Extra: polars
|
|
21
|
+
Requires-Dist: polars>=1.0; extra == 'polars'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# pyfred-client
|
|
25
|
+
|
|
26
|
+
[](https://www.python.org/downloads/)
|
|
27
|
+
[](https://github.com/astral-sh/uv)
|
|
28
|
+
[](https://github.com/astral-sh/ruff)
|
|
29
|
+
[](https://mypy-lang.org/)
|
|
30
|
+
[](CHANGELOG.md)
|
|
31
|
+
[](LICENSE)
|
|
32
|
+
|
|
33
|
+
A small, typed Python wrapper for the
|
|
34
|
+
[FRED API](https://fred.stlouisfed.org/docs/api/fred/) of the Federal Reserve
|
|
35
|
+
Bank of St. Louis.
|
|
36
|
+
|
|
37
|
+
FRED (Federal Reserve Economic Data) publishes several hundred thousand
|
|
38
|
+
economic time series: GDP, prices, employment, interest rates, exchange
|
|
39
|
+
rates, regional data. ALFRED, served by the same API, keeps every past
|
|
40
|
+
vintage of them, so a series can be read as it stood on any date since its
|
|
41
|
+
first release. This wrapper handles the API's habits for you:
|
|
42
|
+
|
|
43
|
+
- Reads the observations of one or more series into typed `pandas`
|
|
44
|
+
DataFrames, **paging** through long histories automatically, with FRED's
|
|
45
|
+
own **transformations** (changes, percent changes, compounded rates, logs)
|
|
46
|
+
and **frequency aggregation** (monthly to quarterly, daily to weekly, ...).
|
|
47
|
+
- Reads **real-time data**: a series as of past vintages, its whole revision
|
|
48
|
+
history, its initial releases, with the real-time period of every value.
|
|
49
|
+
- Returns the API's rows as typed frames (FRED's `.` for a missing value as
|
|
50
|
+
NaN), or the **tidy long frame** shared by these wrappers, with each
|
|
51
|
+
series' unit.
|
|
52
|
+
- Describes and searches series, lists their vintage dates and walks
|
|
53
|
+
FRED's categories, releases and tags; calls any other endpoint raw.
|
|
54
|
+
- Returns polars on request, exports to CSV/Excel/Parquet/JSON and keeps a
|
|
55
|
+
CSV current with incremental upserts.
|
|
56
|
+
- Keeps to FRED's request limit (one request every 2 seconds) and retries
|
|
57
|
+
throttled or failed calls. Nothing is cached on disk: every call goes to
|
|
58
|
+
the API.
|
|
59
|
+
|
|
60
|
+
The API needs a free API key, which is treated as a secret throughout.
|
|
61
|
+
|
|
62
|
+
## Quickstart
|
|
63
|
+
|
|
64
|
+
You need Python 3.12 or newer and a FRED API key (free: create an account and request one at
|
|
65
|
+
<https://fredaccount.stlouisfed.org/apikeys>).
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install pyfred-client # or: uv add pyfred-client
|
|
69
|
+
export FRED_API_KEY=... # PowerShell: $env:FRED_API_KEY = "..."
|
|
70
|
+
|
|
71
|
+
# Find series, then fetch two of them since 2000, saved to outputs/
|
|
72
|
+
uv run pyfred-client search "real gross domestic product" --max-results 5
|
|
73
|
+
uv run pyfred-client observations GDPC1,UNRATE --start 2000 --out macro.csv
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A bare output filename is written into an `outputs/` folder under the current directory. Pass a path with a directory to write elsewhere.
|
|
77
|
+
|
|
78
|
+
The import name is `pyfred`; the command is `pyfred-client`. The optional polars output
|
|
79
|
+
needs the extra: `pip install "pyfred-client[polars]"`.
|
|
80
|
+
|
|
81
|
+
## Usage from Python
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from pyfred import EARLIEST, LATEST, FredClient
|
|
85
|
+
|
|
86
|
+
fred = FredClient() # the key from FRED_API_KEY, or FredClient(api_key=...)
|
|
87
|
+
|
|
88
|
+
# Find and describe series
|
|
89
|
+
fred.search("consumer price index", tags="usa;monthly", max_results=20)
|
|
90
|
+
fred.search("DGS*", search_type="series_id")
|
|
91
|
+
fred.series(["GDP", "CPIAUCSL"]) # title, units, frequency, last update, ...
|
|
92
|
+
|
|
93
|
+
# Observations: one or more series, inclusive periods
|
|
94
|
+
gdp = fred.observations("GDP", start="2010", end="2024-Q2")
|
|
95
|
+
rates = fred.observations(["DGS10", "DGS2"], start="2024-01", tidy=True)
|
|
96
|
+
|
|
97
|
+
# FRED's own transformations and aggregation
|
|
98
|
+
inflation = fred.observations("CPIAUCSL", start="2000", units="pc1")
|
|
99
|
+
monthly_oil = fred.observations("DCOILWTICO", frequency="m", aggregation_method="eop")
|
|
100
|
+
|
|
101
|
+
# Real-time data (ALFRED): every vintage, a past vintage, first releases
|
|
102
|
+
history = fred.observations(
|
|
103
|
+
"GDP", start="2019", realtime_start=EARLIEST, realtime_end=LATEST
|
|
104
|
+
)
|
|
105
|
+
fred.vintage_dates("GDP", realtime_start="2024")
|
|
106
|
+
as_of = fred.observations("GDP", vintage_dates=["2020-04-29", "2020-07-30"])
|
|
107
|
+
first = fred.observations("GDP", start="2015", output_type=4)
|
|
108
|
+
|
|
109
|
+
# Categories, releases, tags, anything else
|
|
110
|
+
fred.categories() # the top level; fred.categories(13) for the children of 13
|
|
111
|
+
fred.category_series(125, filter_variable="frequency", filter_value="Monthly")
|
|
112
|
+
fred.releases()
|
|
113
|
+
fred.release_series(53, max_results=50) # Gross Domestic Product
|
|
114
|
+
fred.tags(tag_group_id="geo", max_results=20)
|
|
115
|
+
fred.raw("release/dates", release_id=53, limit=5)
|
|
116
|
+
|
|
117
|
+
# Export and incremental update
|
|
118
|
+
fred.to_parquet("macro.parquet", ["GDPC1", "UNRATE", "CPIAUCSL"], start="1990")
|
|
119
|
+
fred.update_csv("rates.csv", ["DGS10", "DGS2"], start="2020", tidy=True)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
A wide table (one column per series) is one pivot away:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
wide = rates.pivot(index="date", columns="series_id", values="value")
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Data
|
|
129
|
+
|
|
130
|
+
### Observations
|
|
131
|
+
|
|
132
|
+
`observations(series_ids, start, end, ...)` makes one request per series
|
|
133
|
+
(paged by 100,000 observations) and stacks the answers. Its options are
|
|
134
|
+
FRED's own:
|
|
135
|
+
|
|
136
|
+
| Option | Values |
|
|
137
|
+
|---|---|
|
|
138
|
+
| `units` | `lin` (levels, the default), `chg` (change), `ch1` (change from a year ago), `pch` (percent change), `pc1` (percent change from a year ago), `pca` (compounded annual rate), `cch` (continuously compounded rate), `cca` (continuously compounded annual rate), `log` (natural log) |
|
|
139
|
+
| `frequency` | aggregate to a lower frequency: `d`, `w`, `bw`, `m`, `q`, `sa`, `a`, or a weekly or biweekly code with a fixed end day (`wef` ending Friday, ..., `bwew`, `bwem`) |
|
|
140
|
+
| `aggregation_method` | `avg` (the default), `sum` or `eop` (end of period); needs `frequency` |
|
|
141
|
+
| `realtime_start`, `realtime_end` | the real-time period (ALFRED); `EARLIEST` (`1776-07-04`) and `LATEST` (`9999-12-31`) for every vintage |
|
|
142
|
+
| `vintage_dates` | read the series as it stood on these days (instead of a real-time period) |
|
|
143
|
+
| `output_type` | `1` by real-time period (the default), `2` by vintage date, `3` new and revised observations by vintage date, `4` initial release only |
|
|
144
|
+
|
|
145
|
+
`start`, `end` and the real-time bounds are inclusive and accept `2024`,
|
|
146
|
+
`2024-Q2`, `2024-06` or a day. FRED refuses to aggregate a series to a
|
|
147
|
+
higher frequency than its own; its error message is passed on.
|
|
148
|
+
|
|
149
|
+
### Real-time data
|
|
150
|
+
|
|
151
|
+
By default FRED answers with the values as they stand today. A real-time
|
|
152
|
+
query (any of `realtime_start`, `realtime_end`, `vintage_dates`, or an
|
|
153
|
+
`output_type` of 2 to 4) adds the real-time period of each value:
|
|
154
|
+
`realtime_start` is the day the value was published, `realtime_end` the last
|
|
155
|
+
day it was the current one (NaT while it still is). With
|
|
156
|
+
`realtime_start=EARLIEST, realtime_end=LATEST` the frame holds a series' whole
|
|
157
|
+
revision history, one row per date and vintage. Output types 2 and 3 come
|
|
158
|
+
back with the vintage day as both ends of the period. More than 2,000
|
|
159
|
+
`vintage_dates` (FRED's cap per request) are sent in several requests.
|
|
160
|
+
|
|
161
|
+
To read a series as of a day, keep the rows whose period covers it:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
day = pd.Timestamp("2020-06-01")
|
|
165
|
+
as_known = history[
|
|
166
|
+
(history["realtime_start"] <= day)
|
|
167
|
+
& (history["realtime_end"].isna() | (history["realtime_end"] >= day))
|
|
168
|
+
]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Listings
|
|
172
|
+
|
|
173
|
+
| Method | Returns |
|
|
174
|
+
|---|---|
|
|
175
|
+
| `series(ids)` | one row per series: `series_id`, `title`, `frequency`, `units`, `seasonal_adjustment` (each with a `_short` twin), `observation_start`, `observation_end`, `last_updated` (UTC), `popularity`, `notes` |
|
|
176
|
+
| `search(text, ...)` | the same, plus `group_popularity`; 1,000 results by default (`max_results=None` for all) |
|
|
177
|
+
| `vintage_dates(id)` | `series_id`, `vintage_date` |
|
|
178
|
+
| `category(id)`, `categories(parent_id)` | `category_id`, `name`, `parent_id` (`0` is the root) |
|
|
179
|
+
| `category_series(id, ...)`, `release_series(id, ...)` | series, as `series` |
|
|
180
|
+
| `releases()`, `release(id)` | `release_id`, `name`, `press_release`, `link`, ... |
|
|
181
|
+
| `tags(...)` | `name`, `group_id`, `notes`, `created` (UTC), `popularity`, `series_count` |
|
|
182
|
+
|
|
183
|
+
The series lists take `tags` and `exclude_tags` (`"usa;monthly"` or a list),
|
|
184
|
+
`filter_variable` (`frequency`, `units` or `seasonal_adjustment`) with
|
|
185
|
+
`filter_value`, `order_by` and `sort_order`.
|
|
186
|
+
|
|
187
|
+
## Output shapes
|
|
188
|
+
|
|
189
|
+
### Default output
|
|
190
|
+
|
|
191
|
+
One row per series and observation date (and real-time period, for a
|
|
192
|
+
real-time query), as the API answers: `series_id`, `date`,
|
|
193
|
+
(`realtime_start`, `realtime_end`,) `value` (float64, NaN where FRED
|
|
194
|
+
publishes `.`). Rows are sorted by series, date and real-time start.
|
|
195
|
+
|
|
196
|
+
### Tidy output
|
|
197
|
+
|
|
198
|
+
`tidy=True` returns the long shape shared by these wrappers:
|
|
199
|
+
|
|
200
|
+
| Column | Holds |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `date` | the observation date (`datetime64[ns]`) |
|
|
203
|
+
| `series_id` | the series (and `realtime_start`, `realtime_end` for a real-time query) |
|
|
204
|
+
| `value` | float |
|
|
205
|
+
| `unit` | the series' unit from its metadata (one extra request per series, remembered by the client); with a transformation, its name with the unit in brackets (`Percent Change from Year Ago (Index 1982-1984=100)`) |
|
|
206
|
+
|
|
207
|
+
### Polars
|
|
208
|
+
|
|
209
|
+
With the extra installed (`pyfred-client[polars]`), `as_polars=True` on
|
|
210
|
+
`observations` returns a `polars.DataFrame`, with or without `tidy`.
|
|
211
|
+
|
|
212
|
+
### Incremental updates
|
|
213
|
+
|
|
214
|
+
`update_csv(path, series_ids, ...)` keeps a CSV of observations, default or
|
|
215
|
+
tidy. The first run writes the full extract (from `start`, if given). Later
|
|
216
|
+
runs re-fetch from `lookback_days` (730 by default: FRED's sources revise
|
|
217
|
+
recent history) before the last stored date of the series that lags most,
|
|
218
|
+
upsert, and leave the file untouched when nothing changed. A real-time query
|
|
219
|
+
is re-fetched whole. It returns only the new or revised rows. Use the same
|
|
220
|
+
series and options on every run; a comprehensive revision older than the
|
|
221
|
+
window needs a run with an early `start`.
|
|
222
|
+
|
|
223
|
+
The upsert key is `series_id` and `date`; a real-time extract adds
|
|
224
|
+
`realtime_start`, so each vintage of a value is its own row and a new vintage
|
|
225
|
+
is appended rather than overwriting the old one. Only `value` (and `unit`
|
|
226
|
+
in the tidy shape) is compared to detect a revision: the real-time period of
|
|
227
|
+
a plain request is always today, so comparing it would mark every row as
|
|
228
|
+
revised every day. `new_observations(existing, series_ids, ...)` returns
|
|
229
|
+
the same delta for a DataFrame or CSV path without writing anything.
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
fred.update_csv("gdp_vintages.csv", "GDP", realtime_start=EARLIEST, realtime_end=LATEST)
|
|
233
|
+
delta = fred.new_observations(
|
|
234
|
+
"rates.csv", ["DGS10", "DGS2"], start="2026-10", tidy=True
|
|
235
|
+
)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## API key
|
|
239
|
+
|
|
240
|
+
FRED requires a key on every request. Request one (free) at
|
|
241
|
+
<https://fredaccount.stlouisfed.org/apikeys>, then put it in the
|
|
242
|
+
`FRED_API_KEY` environment variable or pass `FredClient(api_key=...)`. Without
|
|
243
|
+
one the client stops at once with an error that says where to get it.
|
|
244
|
+
|
|
245
|
+
The key travels as a query parameter, so it is handled as a secret: log lines
|
|
246
|
+
are built without it, and the package and HTTP loggers (urllib3 logs full
|
|
247
|
+
URLs) mask it should it ever appear; it is never written to an output file;
|
|
248
|
+
error answers and transport errors are re-raised with it masked. The CLI
|
|
249
|
+
reads it only from the environment, never from a flag.
|
|
250
|
+
|
|
251
|
+
## Request limits
|
|
252
|
+
|
|
253
|
+
FRED allows [120 requests a minute per key](https://fred.stlouisfed.org/docs/api/fred/errors.html)
|
|
254
|
+
before it answers 429, and may block a key that keeps exceeding it. The
|
|
255
|
+
[robots.txt](https://api.stlouisfed.org/robots.txt) of the API host sets
|
|
256
|
+
`Crawl-delay: 2`. Both read 5 December 2026.
|
|
257
|
+
|
|
258
|
+
The client enforces the stricter of the two: one request every 2 seconds
|
|
259
|
+
(`pyfred.RATE_LIMIT`). Every network request waits its turn, including each
|
|
260
|
+
page of a listing and each retry. All clients in one
|
|
261
|
+
process share this budget. Separate processes do not coordinate, and FRED
|
|
262
|
+
counts per key, so two processes with one key can exceed the limit together.
|
|
263
|
+
|
|
264
|
+
To go slower, pass a lower `requests_per_second` (e.g. `0.2`). `None` or `0`
|
|
265
|
+
means the limit's rate; the throttle cannot be turned off, and a faster rate
|
|
266
|
+
raises `pyfred.RateLimitError` when the client is built.
|
|
267
|
+
|
|
268
|
+
A 500, 502, 503 or 504 answer or a dropped connection is retried with
|
|
269
|
+
exponential back-off (`max_retries`). FRED sends no `Retry-After`, so a 429
|
|
270
|
+
is retried only after a full minute, when a new window has begun.
|
|
271
|
+
Pages are as large as each endpoint allows: 100,000 observations, 10,000
|
|
272
|
+
vintage dates, 1,000 series, releases or tags.
|
|
273
|
+
|
|
274
|
+
## Command line
|
|
275
|
+
|
|
276
|
+
Every method of the CLI is a subcommand; run `uv run pyfred-client --help`.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
uv run pyfred-client search "consumer price index" --tags "usa;monthly" --max-results 10
|
|
280
|
+
uv run pyfred-client series GDP,CPIAUCSL
|
|
281
|
+
uv run pyfred-client vintage-dates GDP --realtime-start 2024
|
|
282
|
+
uv run pyfred-client categories
|
|
283
|
+
uv run pyfred-client category-series 125 --filter-variable frequency --filter-value Monthly
|
|
284
|
+
uv run pyfred-client releases --out releases.csv
|
|
285
|
+
uv run pyfred-client release-series 53 --max-results 20
|
|
286
|
+
uv run pyfred-client tags --tag-group-id geo --max-results 20
|
|
287
|
+
|
|
288
|
+
uv run pyfred-client observations GDP,GDPC1 --start 2000 --units pc1
|
|
289
|
+
uv run pyfred-client observations DCOILWTICO --start 2024 --frequency m --aggregation-method eop --tidy
|
|
290
|
+
uv run pyfred-client observations GDP --start 2019 --realtime-start 1776-07-04 --realtime-end 9999-12-31 --out gdp_vintages.parquet
|
|
291
|
+
uv run pyfred-client observations GDP --vintage-dates 2020-04-29,2020-07-30 --out gdp_asof.xlsx
|
|
292
|
+
|
|
293
|
+
uv run pyfred-client raw release/dates --release-id 53 --limit 5
|
|
294
|
+
uv run pyfred-client update-csv rates.csv DGS10,DGS2 --start 2020 --tidy
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Series ids and vintage dates are separated by `,` or `;`, tags by `;`.
|
|
298
|
+
`--out` picks the format from the suffix (`.csv`, `.xlsx`, `.parquet`,
|
|
299
|
+
`.json`); printed series listings leave out the long `notes`. A failed
|
|
300
|
+
command prints a one-line `Error: ...` and exits with code 1.
|
|
301
|
+
|
|
302
|
+
## Logging
|
|
303
|
+
|
|
304
|
+
The library logs to the `pyfred` logger and stays silent until you attach a
|
|
305
|
+
handler. Requests (without the key), throttle sleeps and each
|
|
306
|
+
page go out at `DEBUG`; retries after a 429/5xx answer at `WARNING`; one
|
|
307
|
+
summary line per fetch, search, export or incremental update at `INFO`.
|
|
308
|
+
|
|
309
|
+
```python
|
|
310
|
+
import logging
|
|
311
|
+
|
|
312
|
+
logging.basicConfig(format="%(asctime)s %(name)s %(levelname)s %(message)s")
|
|
313
|
+
logging.getLogger("pyfred").setLevel(logging.INFO)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
On the command line, two flags work with any command (before or after it):
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Colored log lines on stderr; stdout keeps only the command's output
|
|
320
|
+
uv run pyfred-client observations GDP --start 2024 --log-level info
|
|
321
|
+
|
|
322
|
+
# Also append a full DEBUG log with timestamps (bare names go to outputs/)
|
|
323
|
+
uv run pyfred-client update-csv rates.csv DGS10 --log-file fred.log
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
`--log-level` takes `debug`, `info`, `warning` (the default, which keeps the
|
|
327
|
+
CLI quiet) or `error`. When a command fails, the full traceback goes to the log
|
|
328
|
+
(visible with `--log-level debug`, always kept in `--log-file`).
|
|
329
|
+
|
|
330
|
+
## Development
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
uv sync
|
|
334
|
+
uv run pytest # network-mocked tests + coverage
|
|
335
|
+
uv run pytest -m live # one smoke test against the real API (needs FRED_API_KEY)
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Full quality gate (mirrors CI):
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
uv run ruff check . && uv run ruff format --check .
|
|
342
|
+
uv run codespell src tests README.md CHANGELOG.md
|
|
343
|
+
uv run deptry src
|
|
344
|
+
uv run interrogate -c pyproject.toml src tests # docstring coverage >= 95%
|
|
345
|
+
uv run mypy
|
|
346
|
+
uv run ty check
|
|
347
|
+
uv run pytest
|
|
348
|
+
uv run --group docs sphinx-build -W --keep-going -b html docs docs/_build/html
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## Citation
|
|
352
|
+
|
|
353
|
+
If you use this wrapper, please cite it (see [CITATION.cff](CITATION.cff)):
|
|
354
|
+
|
|
355
|
+
> Morão, H. (2026). *pyfred-client* (v0.2.0) [Software].
|
|
356
|
+
> https://pypi.org/project/pyfred-client/
|
|
357
|
+
|
|
358
|
+
Please also credit the data source: Federal Reserve Bank of St. Louis, FRED
|
|
359
|
+
(Federal Reserve Economic Data) and ALFRED (Archival FRED),
|
|
360
|
+
https://fred.stlouisfed.org/, and the original source of each series, which
|
|
361
|
+
FRED names on the series' page.
|
|
362
|
+
|
|
363
|
+
## Data and terms
|
|
364
|
+
|
|
365
|
+
The MIT License covers this code only, not the data.
|
|
366
|
+
|
|
367
|
+
Data: [FRED](https://fred.stlouisfed.org/) and
|
|
368
|
+
[ALFRED](https://alfred.stlouisfed.org/), Federal Reserve Bank of St. Louis,
|
|
369
|
+
through the [FRED API](https://fred.stlouisfed.org/docs/api/fred/), under the
|
|
370
|
+
[FRED terms of use](https://fred.stlouisfed.org/legal) (read 5 December
|
|
371
|
+
2026):
|
|
372
|
+
|
|
373
|
+
- The terms prohibit storing, caching or archiving any portion of FRED
|
|
374
|
+
content, and incorporating it in any other database or compilation. This
|
|
375
|
+
package keeps nothing on disk by itself, but `update_csv`, `to_parquet` and
|
|
376
|
+
the `--out` files store FRED content: use them for your own transient work
|
|
377
|
+
only. You are responsible for complying with the terms.
|
|
378
|
+
- Series whose notes contain the word "Copyright" are owned by third parties.
|
|
379
|
+
Using them beyond what the terms allow needs the data owner's permission;
|
|
380
|
+
the St. Louis Fed cannot give it.
|
|
381
|
+
- Attribute every use: cite the original source of the data and say that it
|
|
382
|
+
was accessed through FRED (the "Cite" tab under each FRED graph gives the
|
|
383
|
+
wording).
|
|
384
|
+
|
|
385
|
+
The files in `tests/fixtures/` are small answers modelled on the examples in
|
|
386
|
+
the FRED API documentation (see `tests/fixtures/NOTICE.md`).
|
|
387
|
+
|
|
388
|
+
This project is independent and not affiliated with or endorsed by the
|
|
389
|
+
Federal Reserve Bank of St. Louis. This product uses the FRED® API but is not
|
|
390
|
+
endorsed or certified by the Federal Reserve Bank of St. Louis.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pyfred/__init__.py,sha256=EYb698bkf1zheTvtlp_rRqhv4JpAKc68S4P0NB5Dy7U,1532
|
|
2
|
+
pyfred/__main__.py,sha256=Y3qmbFNMZESLxH1HIcNdjFWqWoFJB9ivzlpotw8lzps,343
|
|
3
|
+
pyfred/core.py,sha256=TloMrvY3jDJmdEtxwbldDnyfGXTzQGnA2kgm4-vJ130,84057
|
|
4
|
+
pyfred/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
pyfred_client-0.2.0.dist-info/METADATA,sha256=rOTNHjhmK24u47V0LD9yu06bf9k0EUruRste8y-nMKE,18345
|
|
6
|
+
pyfred_client-0.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
7
|
+
pyfred_client-0.2.0.dist-info/entry_points.txt,sha256=_Tco0A8STkM0ocQtRgZUpAh-7Se-0XFl5egg4eD0LeU,51
|
|
8
|
+
pyfred_client-0.2.0.dist-info/licenses/LICENSE,sha256=guoL63V0bzuv4TfPk4RxkITHpNwM_v3m6_2oAxFlF0k,1068
|
|
9
|
+
pyfred_client-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hugo Morão
|
|
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.
|