fxmacrodata 1.1.0__tar.gz → 1.2.1__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.
- {fxmacrodata-1.1.0/fxmacrodata.egg-info → fxmacrodata-1.2.1}/PKG-INFO +155 -27
- fxmacrodata-1.1.0/PKG-INFO → fxmacrodata-1.2.1/README.md +123 -49
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata/async_client.py +6 -3
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata/client.py +6 -3
- fxmacrodata-1.2.1/fxmacrodata/openbb/__init__.py +97 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/constants.py +120 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/launcher.py +58 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/metadata.py +352 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/__init__.py +0 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/commodities.py +105 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/cot.py +145 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/data_catalogue.py +143 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/forex.py +99 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/macro_indicators.py +113 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/models/release_calendar.py +94 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/router.py +109 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/utils/__init__.py +0 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/utils/catalogue.py +43 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/utils/helpers.py +135 -0
- fxmacrodata-1.2.1/fxmacrodata/openbb/workspace_backend.py +243 -0
- fxmacrodata-1.2.1/fxmacrodata.egg-info/PKG-INFO +365 -0
- fxmacrodata-1.2.1/fxmacrodata.egg-info/SOURCES.txt +37 -0
- fxmacrodata-1.2.1/fxmacrodata.egg-info/entry_points.txt +10 -0
- fxmacrodata-1.2.1/fxmacrodata.egg-info/requires.txt +44 -0
- fxmacrodata-1.2.1/pyproject.toml +103 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/tests/test_client.py +14 -7
- fxmacrodata-1.2.1/tests/test_client_auth.py +103 -0
- fxmacrodata-1.2.1/tests/test_openbb_helpers.py +99 -0
- fxmacrodata-1.2.1/tests/test_openbb_launchers.py +81 -0
- fxmacrodata-1.2.1/tests/test_openbb_metadata.py +58 -0
- fxmacrodata-1.2.1/tests/test_openbb_provider_fetchers.py +144 -0
- fxmacrodata-1.2.1/tests/test_openbb_workspace_backend.py +177 -0
- fxmacrodata-1.1.0/README.md +0 -208
- fxmacrodata-1.1.0/fxmacrodata.egg-info/SOURCES.txt +0 -14
- fxmacrodata-1.1.0/fxmacrodata.egg-info/requires.txt +0 -14
- fxmacrodata-1.1.0/pyproject.toml +0 -59
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/LICENSE +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata/__init__.py +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata/exceptions.py +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata/utils.py +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata.egg-info/dependency_links.txt +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/fxmacrodata.egg-info/top_level.txt +0 -0
- {fxmacrodata-1.1.0 → fxmacrodata-1.2.1}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fxmacrodata
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Python client for the FXMacroData API, providing forex macroeconomic data for traders, quants, and analysts.
|
|
5
5
|
Author-email: FXMacroData <info@fxmacrodata.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://fxmacrodata.com/?utm_source=pypi&utm_medium=
|
|
8
|
-
Project-URL: Documentation, https://fxmacrodata.com/api/docs?utm_source=pypi&utm_medium=
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://fxmacrodata.com/?utm_source=pypi&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=homepage
|
|
8
|
+
Project-URL: Documentation, https://fxmacrodata.com/api/docs?utm_source=pypi&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=docs
|
|
9
9
|
Project-URL: Source, https://github.com/fxmacrodata/fxmacrodata
|
|
10
10
|
Project-URL: Issues, https://github.com/fxmacrodata/fxmacrodata
|
|
11
11
|
Keywords: forex,macro data,macroeconomics,trading,quant,economic indicators,fxmacrodata,rapidapi
|
|
@@ -14,17 +14,42 @@ Description-Content-Type: text/markdown
|
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: requests>=2.28
|
|
16
16
|
Requires-Dist: aiohttp>=3.8
|
|
17
|
+
Provides-Extra: openbb
|
|
18
|
+
Requires-Dist: openbb>=4.7.2; extra == "openbb"
|
|
19
|
+
Requires-Dist: openbb-core>=1.6.10; extra == "openbb"
|
|
20
|
+
Provides-Extra: openbb-api
|
|
21
|
+
Requires-Dist: openbb>=4.7.2; extra == "openbb-api"
|
|
22
|
+
Requires-Dist: openbb-core>=1.6.10; extra == "openbb-api"
|
|
23
|
+
Requires-Dist: openbb-platform-api>=1.3.6; extra == "openbb-api"
|
|
24
|
+
Provides-Extra: openbb-cli
|
|
25
|
+
Requires-Dist: openbb>=4.7.2; extra == "openbb-cli"
|
|
26
|
+
Requires-Dist: openbb-core>=1.6.10; extra == "openbb-cli"
|
|
27
|
+
Requires-Dist: openbb-cli>=1.0; extra == "openbb-cli"
|
|
28
|
+
Provides-Extra: mcp
|
|
29
|
+
Requires-Dist: openbb>=4.7.2; extra == "mcp"
|
|
30
|
+
Requires-Dist: openbb-core>=1.6.10; extra == "mcp"
|
|
31
|
+
Requires-Dist: openbb-mcp-server>=1.4.1; extra == "mcp"
|
|
32
|
+
Provides-Extra: workspace
|
|
33
|
+
Requires-Dist: fastapi>=0.100; extra == "workspace"
|
|
34
|
+
Requires-Dist: uvicorn>=0.23; extra == "workspace"
|
|
17
35
|
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: fastapi>=0.100; extra == "dev"
|
|
37
|
+
Requires-Dist: httpx>=0.24; extra == "dev"
|
|
38
|
+
Requires-Dist: httpx2>=2.0; extra == "dev"
|
|
39
|
+
Requires-Dist: openbb-core>=1.6.10; extra == "dev"
|
|
40
|
+
Requires-Dist: openbb-platform-api>=1.3.6; extra == "dev"
|
|
18
41
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
19
43
|
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
20
44
|
Requires-Dist: python-dotenv>=1.1; extra == "dev"
|
|
21
45
|
Requires-Dist: python-semantic-release>=7.23; extra == "dev"
|
|
22
46
|
Requires-Dist: twine>=4.0; extra == "dev"
|
|
23
47
|
Requires-Dist: build>=1.0; extra == "dev"
|
|
24
|
-
Requires-Dist: ruff
|
|
25
|
-
Requires-Dist: mypy
|
|
26
|
-
Requires-Dist: black
|
|
48
|
+
Requires-Dist: ruff==0.15.22; extra == "dev"
|
|
49
|
+
Requires-Dist: mypy==2.3.1; extra == "dev"
|
|
50
|
+
Requires-Dist: black==26.5.1; extra == "dev"
|
|
27
51
|
Requires-Dist: types-requests>=2.28; extra == "dev"
|
|
52
|
+
Requires-Dist: uvicorn>=0.23; extra == "dev"
|
|
28
53
|
Dynamic: license-file
|
|
29
54
|
|
|
30
55
|
# FXMacroData Python SDK 🐍📊
|
|
@@ -34,24 +59,26 @@ Dynamic: license-file
|
|
|
34
59
|

|
|
35
60
|

|
|
36
61
|
|
|
37
|
-
The **FXMacroData Python SDK** provides a simple and efficient interface for fetching **macroeconomic indicators**, **forex prices**, **release calendars**, **COT positioning**, and **commodity prices** from [FXMacroData](https://fxmacrodata.com/?utm_source=github&utm_medium=
|
|
62
|
+
The **FXMacroData Python SDK** provides a simple and efficient interface for fetching **macroeconomic indicators**, **forex prices**, **release calendars**, **COT positioning**, and **commodity prices** from [FXMacroData](https://fxmacrodata.com/?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme).
|
|
38
63
|
|
|
39
|
-
|
|
64
|
+
Use synchronous and asynchronous clients to bring the data into research notebooks, backtests and applications.
|
|
65
|
+
|
|
66
|
+
[Subscribe to FXMacroData](https://fxmacrodata.com/subscribe?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=subscribe) for non-USD data, full available history, FX, commodities and positioning. Use the public USD workflow to evaluate the integration before connecting your subscription.
|
|
40
67
|
|
|
41
68
|
---
|
|
42
69
|
|
|
43
70
|
## 🌟 Features
|
|
44
71
|
|
|
45
72
|
- Fetch:
|
|
46
|
-
- **Macroeconomic indicators** — policy rates, inflation, GDP, unemployment, bond yields, and
|
|
73
|
+
- **Macroeconomic indicators** — policy rates, inflation, GDP, unemployment, bond yields, and more: 97 distinct indicators across 656 endpoints
|
|
47
74
|
- **FX spot rates** with optional technical indicators (SMA, RSI, MACD, Bollinger Bands)
|
|
48
75
|
- **Release calendars** — upcoming economic data release dates
|
|
49
76
|
- **Data catalogue** — discover available indicators per currency
|
|
50
77
|
- **COT data** — CFTC Commitment of Traders positioning
|
|
51
78
|
- **Commodity prices** — gold, silver, platinum
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
79
|
+
- Evaluate with public **USD** macro data covering the most recent 90 days; connect your FXMacroData subscription for full available history.
|
|
80
|
+
- FX spot-rate history through `get_fx_price`.
|
|
81
|
+
- A key from an authorized FXMacroData subscription is required for protected datasets, including non-USD indicators, FX spot-rate history, COT, and commodities.
|
|
55
82
|
- Full support for:
|
|
56
83
|
- **Synchronous client**
|
|
57
84
|
- **Asynchronous client**
|
|
@@ -92,7 +119,7 @@ data = client.get_indicator(
|
|
|
92
119
|
)
|
|
93
120
|
print(data)
|
|
94
121
|
|
|
95
|
-
#
|
|
122
|
+
# Forex price endpoint
|
|
96
123
|
fx = client.get_fx_price("usd", "gbp", start_date="2025-01-01")
|
|
97
124
|
print(fx)
|
|
98
125
|
|
|
@@ -131,7 +158,7 @@ async def main():
|
|
|
131
158
|
data = await client.get_indicator("eur", "inflation")
|
|
132
159
|
print(data)
|
|
133
160
|
|
|
134
|
-
#
|
|
161
|
+
# Forex price endpoint
|
|
135
162
|
fx = await client.get_fx_price("usd", "jpy")
|
|
136
163
|
print(fx)
|
|
137
164
|
|
|
@@ -156,6 +183,101 @@ asyncio.run(main())
|
|
|
156
183
|
|
|
157
184
|
---
|
|
158
185
|
|
|
186
|
+
## OpenBB Integration
|
|
187
|
+
|
|
188
|
+
FXMacroData supports all practical OpenBB integration paths from this package:
|
|
189
|
+
|
|
190
|
+
- OpenBB Python: installable provider/router extension for `obb.fxmacrodata.*`.
|
|
191
|
+
- OpenBB REST API: `/api/v1/fxmacrodata/*` routes through `openbb-api`.
|
|
192
|
+
- OpenBB Workspace, generated: widgets generated by `openbb-api` from inline metadata.
|
|
193
|
+
- OpenBB Workspace, custom: standalone backend serving `widgets.json`, `apps.json`, and data endpoints.
|
|
194
|
+
- OpenBB MCP: tools exposed through `openbb-mcp`.
|
|
195
|
+
- OpenBB CLI: commands available after `openbb-build`.
|
|
196
|
+
|
|
197
|
+
OpenBB packages require Python 3.10+. Install the OpenBB Python extra:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
pip install "fxmacrodata[openbb]"
|
|
201
|
+
openbb-build
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Then use FXMacroData from the OpenBB Python interface:
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
from openbb import obb
|
|
208
|
+
|
|
209
|
+
obb.user.credentials.fxmacrodata_api_key = "YOUR_API_KEY"
|
|
210
|
+
|
|
211
|
+
catalogue = obb.fxmacrodata.data_catalogue(
|
|
212
|
+
currency="USD",
|
|
213
|
+
provider="fxmacrodata",
|
|
214
|
+
).to_df()
|
|
215
|
+
|
|
216
|
+
inflation = obb.fxmacrodata.macro_indicators(
|
|
217
|
+
currency="USD",
|
|
218
|
+
indicator="inflation",
|
|
219
|
+
start_date="2020-01-01",
|
|
220
|
+
provider="fxmacrodata",
|
|
221
|
+
).to_df()
|
|
222
|
+
|
|
223
|
+
eurusd = obb.fxmacrodata.fx_historical(
|
|
224
|
+
base="EUR",
|
|
225
|
+
quote="USD",
|
|
226
|
+
start_date="2024-01-01",
|
|
227
|
+
provider="fxmacrodata",
|
|
228
|
+
).to_df()
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Run the OpenBB REST API and generated Workspace backend:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
pip install "fxmacrodata[openbb-api]"
|
|
235
|
+
openbb-build
|
|
236
|
+
fxmacrodata-openbb-api --host 127.0.0.1 --port 6900
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Workspace can be connected to `http://127.0.0.1:6900`. The generated
|
|
240
|
+
`/widgets.json` uses FXMacroData's inline OpenBB widget metadata.
|
|
241
|
+
|
|
242
|
+
Run the OpenBB Workspace custom backend:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
pip install "fxmacrodata[workspace]"
|
|
246
|
+
fxmacrodata-openbb-backend
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Default backend URL:
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
http://127.0.0.1:7779
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Workspace exposes `/widgets.json`, `/apps.json`, `/catalogue`,
|
|
256
|
+
`/release_calendar`, `/macro_indicator`, `/forex`, `/cot`, and `/commodity`.
|
|
257
|
+
Swagger/OpenAPI docs are disabled by default for this backend. For local
|
|
258
|
+
debugging only, set `FXMACRODATA_OPENBB_ENABLE_DOCS=1` before starting it.
|
|
259
|
+
|
|
260
|
+
Run OpenBB MCP:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
pip install "fxmacrodata[mcp]"
|
|
264
|
+
openbb-build
|
|
265
|
+
fxmacrodata-openbb-mcp --default-categories fxmacrodata --host 127.0.0.1 --port 8001
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Run OpenBB CLI:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
pip install "fxmacrodata[openbb-cli]"
|
|
272
|
+
openbb-build
|
|
273
|
+
openbb
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
See `docs/openbb-integration.md` for the full integration matrix and the
|
|
277
|
+
separate upstream OpenBB repository contribution path.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
159
281
|
## 📘 API Overview
|
|
160
282
|
|
|
161
283
|
### `get_indicator(currency, indicator, start_date=None, end_date=None)`
|
|
@@ -166,10 +288,10 @@ Fetches macroeconomic indicator time series data.
|
|
|
166
288
|
- **API key required for non-USD.**
|
|
167
289
|
|
|
168
290
|
### `get_fx_price(base, quote, start_date=None, end_date=None, indicators=None)`
|
|
169
|
-
Fetches daily FX spot rates
|
|
291
|
+
Fetches daily FX spot rates between two currencies.
|
|
170
292
|
|
|
171
293
|
- `indicators`: Optional comma-separated technical indicators — `"sma_20"`, `"sma_50"`, `"sma_200"`, `"rsi_14"`, `"macd"`, `"ema_12"`, `"ema_26"`, `"bollinger_bands"`, or `"all"`.
|
|
172
|
-
- **
|
|
294
|
+
- **API key required.**
|
|
173
295
|
|
|
174
296
|
### `get_calendar(currency, indicator=None)`
|
|
175
297
|
Fetches upcoming economic data release dates for a currency.
|
|
@@ -199,25 +321,31 @@ Fetches commodity price time series.
|
|
|
199
321
|
|
|
200
322
|
## 💹 Supported Currencies & Indicators
|
|
201
323
|
|
|
324
|
+
**18 currencies supported:** AUD, BRL, CAD, CHF, CNH, CNY, DKK, EUR, GBP, ILS, JPY, NGN, NOK, NZD, PEN, SEK, THB, USD.
|
|
325
|
+
|
|
326
|
+
The table below shows a sample of indicator coverage across four major currencies. Use `get_data_catalogue()` to discover the full list for any currency.
|
|
327
|
+
|
|
202
328
|
| Category | Metric | USD | EUR | AUD | GBP |
|
|
203
329
|
|---------|--------|-----|-----|-----|-----|
|
|
204
330
|
| **Economy** | GDP Growth | ✓ | ✓ | ✓ | ✓ |
|
|
205
331
|
| | Inflation Rate | ✓ | ✓ | ✓ | ✓ |
|
|
206
332
|
| | Trade Balance | ✓ | ✓ | ✓ | ✓ |
|
|
207
333
|
| | Current Account Balance | ✓ | ✓ | ✓ | ✓ |
|
|
334
|
+
| | Retail Sales | ✓ | ✓ | ✓ | ✓ |
|
|
335
|
+
| | Industrial Production | ✓ | — | — | — |
|
|
208
336
|
| **Labor Market** | Unemployment Rate | ✓ | ✓ | ✓ | ✓ |
|
|
209
|
-
| | Employment Level | ✓ |
|
|
210
|
-
| | Full-Time Employment | ✓ |
|
|
211
|
-
| | Part-Time Employment | ✓ |
|
|
212
|
-
| | Participation Rate | ✓ |
|
|
337
|
+
| | Employment Level | ✓ | ✓ | ✓ | ✓ |
|
|
338
|
+
| | Full-Time Employment | ✓ | ✓ | ✓ | — |
|
|
339
|
+
| | Part-Time Employment | ✓ | ✓ | ✓ | ✓ |
|
|
340
|
+
| | Participation Rate | ✓ | ✓ | ✓ | ✓ |
|
|
213
341
|
| | Non-Farm Payrolls | ✓ | — | — | — |
|
|
214
342
|
| **Monetary Policy** | Policy Rate | ✓ | ✓ | ✓ | ✓ |
|
|
215
|
-
| |
|
|
216
|
-
|
|
|
217
|
-
|
|
|
343
|
+
| | Risk-Free Rate | ✓ | ✓ | ✓ | ✓ |
|
|
344
|
+
| | Central Bank Assets | ✓ | — | ✓ | — |
|
|
345
|
+
| **Government Bond Yields** | 2-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
218
346
|
| | 5-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
219
347
|
| | 10-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
220
|
-
| | Inflation-Linked Bond | ✓ |
|
|
348
|
+
| | Inflation-Linked Bond | ✓ | ✓ | ✓ | ✓ |
|
|
221
349
|
|
|
222
350
|
---
|
|
223
351
|
|
|
@@ -229,8 +357,8 @@ MIT License © FXMacroData
|
|
|
229
357
|
|
|
230
358
|
## 🌐 Links
|
|
231
359
|
|
|
232
|
-
- Website: https://fxmacrodata.com
|
|
233
|
-
- API Docs: https://fxmacrodata.com/docs
|
|
360
|
+
- Website: https://fxmacrodata.com/?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme
|
|
361
|
+
- API Docs: https://fxmacrodata.com/docs?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme
|
|
234
362
|
- GitHub: https://github.com/fxmacrodata/fxmacrodata
|
|
235
363
|
- PyPI: https://pypi.org/project/fxmacrodata/
|
|
236
364
|
- Readthedocs: https://fxmacrodata.readthedocs.io/en/latest/
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: fxmacrodata
|
|
3
|
-
Version: 1.1.0
|
|
4
|
-
Summary: Python client for the FXMacroData API, providing forex macroeconomic data for traders, quants, and analysts.
|
|
5
|
-
Author-email: FXMacroData <info@fxmacrodata.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
Project-URL: Homepage, https://fxmacrodata.com/?utm_source=pypi&utm_medium=package&utm_campaign=python_sdk
|
|
8
|
-
Project-URL: Documentation, https://fxmacrodata.com/api/docs?utm_source=pypi&utm_medium=package&utm_campaign=python_sdk
|
|
9
|
-
Project-URL: Source, https://github.com/fxmacrodata/fxmacrodata
|
|
10
|
-
Project-URL: Issues, https://github.com/fxmacrodata/fxmacrodata
|
|
11
|
-
Keywords: forex,macro data,macroeconomics,trading,quant,economic indicators,fxmacrodata,rapidapi
|
|
12
|
-
Requires-Python: >=3.9
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: requests>=2.28
|
|
16
|
-
Requires-Dist: aiohttp>=3.8
|
|
17
|
-
Provides-Extra: dev
|
|
18
|
-
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
19
|
-
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
20
|
-
Requires-Dist: python-dotenv>=1.1; extra == "dev"
|
|
21
|
-
Requires-Dist: python-semantic-release>=7.23; extra == "dev"
|
|
22
|
-
Requires-Dist: twine>=4.0; extra == "dev"
|
|
23
|
-
Requires-Dist: build>=1.0; extra == "dev"
|
|
24
|
-
Requires-Dist: ruff>=0.0; extra == "dev"
|
|
25
|
-
Requires-Dist: mypy>=1.5; extra == "dev"
|
|
26
|
-
Requires-Dist: black>=24.0; extra == "dev"
|
|
27
|
-
Requires-Dist: types-requests>=2.28; extra == "dev"
|
|
28
|
-
Dynamic: license-file
|
|
29
|
-
|
|
30
1
|
# FXMacroData Python SDK 🐍📊
|
|
31
2
|
|
|
32
3
|

|
|
@@ -34,24 +5,26 @@ Dynamic: license-file
|
|
|
34
5
|

|
|
35
6
|

|
|
36
7
|
|
|
37
|
-
The **FXMacroData Python SDK** provides a simple and efficient interface for fetching **macroeconomic indicators**, **forex prices**, **release calendars**, **COT positioning**, and **commodity prices** from [FXMacroData](https://fxmacrodata.com/?utm_source=github&utm_medium=
|
|
8
|
+
The **FXMacroData Python SDK** provides a simple and efficient interface for fetching **macroeconomic indicators**, **forex prices**, **release calendars**, **COT positioning**, and **commodity prices** from [FXMacroData](https://fxmacrodata.com/?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme).
|
|
9
|
+
|
|
10
|
+
Use synchronous and asynchronous clients to bring the data into research notebooks, backtests and applications.
|
|
38
11
|
|
|
39
|
-
|
|
12
|
+
[Subscribe to FXMacroData](https://fxmacrodata.com/subscribe?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=subscribe) for non-USD data, full available history, FX, commodities and positioning. Use the public USD workflow to evaluate the integration before connecting your subscription.
|
|
40
13
|
|
|
41
14
|
---
|
|
42
15
|
|
|
43
16
|
## 🌟 Features
|
|
44
17
|
|
|
45
18
|
- Fetch:
|
|
46
|
-
- **Macroeconomic indicators** — policy rates, inflation, GDP, unemployment, bond yields, and
|
|
19
|
+
- **Macroeconomic indicators** — policy rates, inflation, GDP, unemployment, bond yields, and more: 97 distinct indicators across 656 endpoints
|
|
47
20
|
- **FX spot rates** with optional technical indicators (SMA, RSI, MACD, Bollinger Bands)
|
|
48
21
|
- **Release calendars** — upcoming economic data release dates
|
|
49
22
|
- **Data catalogue** — discover available indicators per currency
|
|
50
23
|
- **COT data** — CFTC Commitment of Traders positioning
|
|
51
24
|
- **Commodity prices** — gold, silver, platinum
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
25
|
+
- Evaluate with public **USD** macro data covering the most recent 90 days; connect your FXMacroData subscription for full available history.
|
|
26
|
+
- FX spot-rate history through `get_fx_price`.
|
|
27
|
+
- A key from an authorized FXMacroData subscription is required for protected datasets, including non-USD indicators, FX spot-rate history, COT, and commodities.
|
|
55
28
|
- Full support for:
|
|
56
29
|
- **Synchronous client**
|
|
57
30
|
- **Asynchronous client**
|
|
@@ -92,7 +65,7 @@ data = client.get_indicator(
|
|
|
92
65
|
)
|
|
93
66
|
print(data)
|
|
94
67
|
|
|
95
|
-
#
|
|
68
|
+
# Forex price endpoint
|
|
96
69
|
fx = client.get_fx_price("usd", "gbp", start_date="2025-01-01")
|
|
97
70
|
print(fx)
|
|
98
71
|
|
|
@@ -131,7 +104,7 @@ async def main():
|
|
|
131
104
|
data = await client.get_indicator("eur", "inflation")
|
|
132
105
|
print(data)
|
|
133
106
|
|
|
134
|
-
#
|
|
107
|
+
# Forex price endpoint
|
|
135
108
|
fx = await client.get_fx_price("usd", "jpy")
|
|
136
109
|
print(fx)
|
|
137
110
|
|
|
@@ -156,6 +129,101 @@ asyncio.run(main())
|
|
|
156
129
|
|
|
157
130
|
---
|
|
158
131
|
|
|
132
|
+
## OpenBB Integration
|
|
133
|
+
|
|
134
|
+
FXMacroData supports all practical OpenBB integration paths from this package:
|
|
135
|
+
|
|
136
|
+
- OpenBB Python: installable provider/router extension for `obb.fxmacrodata.*`.
|
|
137
|
+
- OpenBB REST API: `/api/v1/fxmacrodata/*` routes through `openbb-api`.
|
|
138
|
+
- OpenBB Workspace, generated: widgets generated by `openbb-api` from inline metadata.
|
|
139
|
+
- OpenBB Workspace, custom: standalone backend serving `widgets.json`, `apps.json`, and data endpoints.
|
|
140
|
+
- OpenBB MCP: tools exposed through `openbb-mcp`.
|
|
141
|
+
- OpenBB CLI: commands available after `openbb-build`.
|
|
142
|
+
|
|
143
|
+
OpenBB packages require Python 3.10+. Install the OpenBB Python extra:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install "fxmacrodata[openbb]"
|
|
147
|
+
openbb-build
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Then use FXMacroData from the OpenBB Python interface:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from openbb import obb
|
|
154
|
+
|
|
155
|
+
obb.user.credentials.fxmacrodata_api_key = "YOUR_API_KEY"
|
|
156
|
+
|
|
157
|
+
catalogue = obb.fxmacrodata.data_catalogue(
|
|
158
|
+
currency="USD",
|
|
159
|
+
provider="fxmacrodata",
|
|
160
|
+
).to_df()
|
|
161
|
+
|
|
162
|
+
inflation = obb.fxmacrodata.macro_indicators(
|
|
163
|
+
currency="USD",
|
|
164
|
+
indicator="inflation",
|
|
165
|
+
start_date="2020-01-01",
|
|
166
|
+
provider="fxmacrodata",
|
|
167
|
+
).to_df()
|
|
168
|
+
|
|
169
|
+
eurusd = obb.fxmacrodata.fx_historical(
|
|
170
|
+
base="EUR",
|
|
171
|
+
quote="USD",
|
|
172
|
+
start_date="2024-01-01",
|
|
173
|
+
provider="fxmacrodata",
|
|
174
|
+
).to_df()
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Run the OpenBB REST API and generated Workspace backend:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pip install "fxmacrodata[openbb-api]"
|
|
181
|
+
openbb-build
|
|
182
|
+
fxmacrodata-openbb-api --host 127.0.0.1 --port 6900
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Workspace can be connected to `http://127.0.0.1:6900`. The generated
|
|
186
|
+
`/widgets.json` uses FXMacroData's inline OpenBB widget metadata.
|
|
187
|
+
|
|
188
|
+
Run the OpenBB Workspace custom backend:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
pip install "fxmacrodata[workspace]"
|
|
192
|
+
fxmacrodata-openbb-backend
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Default backend URL:
|
|
196
|
+
|
|
197
|
+
```text
|
|
198
|
+
http://127.0.0.1:7779
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Workspace exposes `/widgets.json`, `/apps.json`, `/catalogue`,
|
|
202
|
+
`/release_calendar`, `/macro_indicator`, `/forex`, `/cot`, and `/commodity`.
|
|
203
|
+
Swagger/OpenAPI docs are disabled by default for this backend. For local
|
|
204
|
+
debugging only, set `FXMACRODATA_OPENBB_ENABLE_DOCS=1` before starting it.
|
|
205
|
+
|
|
206
|
+
Run OpenBB MCP:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
pip install "fxmacrodata[mcp]"
|
|
210
|
+
openbb-build
|
|
211
|
+
fxmacrodata-openbb-mcp --default-categories fxmacrodata --host 127.0.0.1 --port 8001
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Run OpenBB CLI:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
pip install "fxmacrodata[openbb-cli]"
|
|
218
|
+
openbb-build
|
|
219
|
+
openbb
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
See `docs/openbb-integration.md` for the full integration matrix and the
|
|
223
|
+
separate upstream OpenBB repository contribution path.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
159
227
|
## 📘 API Overview
|
|
160
228
|
|
|
161
229
|
### `get_indicator(currency, indicator, start_date=None, end_date=None)`
|
|
@@ -166,10 +234,10 @@ Fetches macroeconomic indicator time series data.
|
|
|
166
234
|
- **API key required for non-USD.**
|
|
167
235
|
|
|
168
236
|
### `get_fx_price(base, quote, start_date=None, end_date=None, indicators=None)`
|
|
169
|
-
Fetches daily FX spot rates
|
|
237
|
+
Fetches daily FX spot rates between two currencies.
|
|
170
238
|
|
|
171
239
|
- `indicators`: Optional comma-separated technical indicators — `"sma_20"`, `"sma_50"`, `"sma_200"`, `"rsi_14"`, `"macd"`, `"ema_12"`, `"ema_26"`, `"bollinger_bands"`, or `"all"`.
|
|
172
|
-
- **
|
|
240
|
+
- **API key required.**
|
|
173
241
|
|
|
174
242
|
### `get_calendar(currency, indicator=None)`
|
|
175
243
|
Fetches upcoming economic data release dates for a currency.
|
|
@@ -199,25 +267,31 @@ Fetches commodity price time series.
|
|
|
199
267
|
|
|
200
268
|
## 💹 Supported Currencies & Indicators
|
|
201
269
|
|
|
270
|
+
**18 currencies supported:** AUD, BRL, CAD, CHF, CNH, CNY, DKK, EUR, GBP, ILS, JPY, NGN, NOK, NZD, PEN, SEK, THB, USD.
|
|
271
|
+
|
|
272
|
+
The table below shows a sample of indicator coverage across four major currencies. Use `get_data_catalogue()` to discover the full list for any currency.
|
|
273
|
+
|
|
202
274
|
| Category | Metric | USD | EUR | AUD | GBP |
|
|
203
275
|
|---------|--------|-----|-----|-----|-----|
|
|
204
276
|
| **Economy** | GDP Growth | ✓ | ✓ | ✓ | ✓ |
|
|
205
277
|
| | Inflation Rate | ✓ | ✓ | ✓ | ✓ |
|
|
206
278
|
| | Trade Balance | ✓ | ✓ | ✓ | ✓ |
|
|
207
279
|
| | Current Account Balance | ✓ | ✓ | ✓ | ✓ |
|
|
280
|
+
| | Retail Sales | ✓ | ✓ | ✓ | ✓ |
|
|
281
|
+
| | Industrial Production | ✓ | — | — | — |
|
|
208
282
|
| **Labor Market** | Unemployment Rate | ✓ | ✓ | ✓ | ✓ |
|
|
209
|
-
| | Employment Level | ✓ |
|
|
210
|
-
| | Full-Time Employment | ✓ |
|
|
211
|
-
| | Part-Time Employment | ✓ |
|
|
212
|
-
| | Participation Rate | ✓ |
|
|
283
|
+
| | Employment Level | ✓ | ✓ | ✓ | ✓ |
|
|
284
|
+
| | Full-Time Employment | ✓ | ✓ | ✓ | — |
|
|
285
|
+
| | Part-Time Employment | ✓ | ✓ | ✓ | ✓ |
|
|
286
|
+
| | Participation Rate | ✓ | ✓ | ✓ | ✓ |
|
|
213
287
|
| | Non-Farm Payrolls | ✓ | — | — | — |
|
|
214
288
|
| **Monetary Policy** | Policy Rate | ✓ | ✓ | ✓ | ✓ |
|
|
215
|
-
| |
|
|
216
|
-
|
|
|
217
|
-
|
|
|
289
|
+
| | Risk-Free Rate | ✓ | ✓ | ✓ | ✓ |
|
|
290
|
+
| | Central Bank Assets | ✓ | — | ✓ | — |
|
|
291
|
+
| **Government Bond Yields** | 2-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
218
292
|
| | 5-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
219
293
|
| | 10-Year Govt Bond | ✓ | ✓ | ✓ | ✓ |
|
|
220
|
-
| | Inflation-Linked Bond | ✓ |
|
|
294
|
+
| | Inflation-Linked Bond | ✓ | ✓ | ✓ | ✓ |
|
|
221
295
|
|
|
222
296
|
---
|
|
223
297
|
|
|
@@ -229,8 +303,8 @@ MIT License © FXMacroData
|
|
|
229
303
|
|
|
230
304
|
## 🌐 Links
|
|
231
305
|
|
|
232
|
-
- Website: https://fxmacrodata.com
|
|
233
|
-
- API Docs: https://fxmacrodata.com/docs
|
|
306
|
+
- Website: https://fxmacrodata.com/?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme
|
|
307
|
+
- API Docs: https://fxmacrodata.com/docs?utm_source=github&utm_medium=referral&utm_campaign=fxmacrodata&utm_content=readme
|
|
234
308
|
- GitHub: https://github.com/fxmacrodata/fxmacrodata
|
|
235
309
|
- PyPI: https://pypi.org/project/fxmacrodata/
|
|
236
310
|
- Readthedocs: https://fxmacrodata.readthedocs.io/en/latest/
|
|
@@ -4,7 +4,7 @@ from .exceptions import FXMacroDataError
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class AsyncClient:
|
|
7
|
-
BASE_URL = "https://fxmacrodata.com
|
|
7
|
+
BASE_URL = "https://api.fxmacrodata.com"
|
|
8
8
|
|
|
9
9
|
def __init__(self, api_key: Optional[str] = None):
|
|
10
10
|
self.api_key: Optional[str] = api_key
|
|
@@ -60,7 +60,7 @@ class AsyncClient:
|
|
|
60
60
|
return await self._request(url, params, headers)
|
|
61
61
|
|
|
62
62
|
# ------------------------------------------------------------------
|
|
63
|
-
# FX spot rates
|
|
63
|
+
# FX spot rates
|
|
64
64
|
# ------------------------------------------------------------------
|
|
65
65
|
async def get_fx_price(
|
|
66
66
|
self,
|
|
@@ -80,7 +80,10 @@ class AsyncClient:
|
|
|
80
80
|
params["end_date"] = end_date
|
|
81
81
|
if indicators:
|
|
82
82
|
params["indicators"] = indicators
|
|
83
|
-
|
|
83
|
+
if not self.api_key:
|
|
84
|
+
raise FXMacroDataError("API key required for forex endpoints.")
|
|
85
|
+
headers = {"X-API-Key": self.api_key}
|
|
86
|
+
return await self._request(url, params, headers)
|
|
84
87
|
|
|
85
88
|
# ------------------------------------------------------------------
|
|
86
89
|
# Release calendar
|
|
@@ -4,7 +4,7 @@ from .exceptions import FXMacroDataError
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Client:
|
|
7
|
-
BASE_URL = "https://fxmacrodata.com
|
|
7
|
+
BASE_URL = "https://api.fxmacrodata.com"
|
|
8
8
|
|
|
9
9
|
def __init__(self, api_key: Optional[str] = None):
|
|
10
10
|
self.api_key = api_key
|
|
@@ -50,7 +50,7 @@ class Client:
|
|
|
50
50
|
return self._request(url, params, headers)
|
|
51
51
|
|
|
52
52
|
# ------------------------------------------------------------------
|
|
53
|
-
# FX spot rates
|
|
53
|
+
# FX spot rates
|
|
54
54
|
# ------------------------------------------------------------------
|
|
55
55
|
def get_fx_price(
|
|
56
56
|
self,
|
|
@@ -70,7 +70,10 @@ class Client:
|
|
|
70
70
|
params["end_date"] = end_date
|
|
71
71
|
if indicators:
|
|
72
72
|
params["indicators"] = indicators
|
|
73
|
-
|
|
73
|
+
if not self.api_key:
|
|
74
|
+
raise FXMacroDataError("API key required for forex endpoints.")
|
|
75
|
+
headers = {"X-API-Key": self.api_key}
|
|
76
|
+
return self._request(url, params, headers)
|
|
74
77
|
|
|
75
78
|
# ------------------------------------------------------------------
|
|
76
79
|
# Release calendar
|