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.
It includes both synchronous and asynchronous clients, supports free USD endpoints, and offers a free Forex Price API for exchange rate data.
- Fetch:
- Macroeconomic indicators โ policy rates, inflation, GDP, unemployment, bond yields, and 100+ more
- FX spot rates with optional technical indicators (SMA, RSI, MACD, Bollinger Bands)
- Release calendars โ upcoming economic data release dates
- Data catalogue โ discover available indicators per currency
- COT data โ CFTC Commitment of Traders positioning
- Commodity prices โ gold, silver, platinum
- Free access to USD macro data.
- Free Forex Price API (
get_fx_price). - API key required only for non-USD indicators.
- Full support for:
- Synchronous client
- Asynchronous client
- Lightweight: depends only on
requestsandaiohttp.
Install from PyPI:
pip install fxmacrodataOr install the latest version from GitHub:
pip install git+https://github.com/fxmacrodata/fxmacrodata.gitfrom fxmacrodata import Client
client = Client(api_key="YOUR_API_KEY")
# Fetch macroeconomic indicators
data = client.get_indicator(
"aud", "policy_rate",
start_date="2023-01-01",
end_date="2023-11-01"
)
print(data)
# Free Forex Price Endpoint
fx = client.get_fx_price("usd", "gbp", start_date="2025-01-01")
print(fx)
# Forex with technical indicators
fx = client.get_fx_price("eur", "usd", indicators="sma_20,rsi_14,macd")
print(fx)
# Release calendar
calendar = client.get_calendar("usd")
print(calendar)
# Data catalogue โ discover available indicators
catalogue = client.get_data_catalogue("usd")
print(catalogue)
# COT positioning data
cot = client.get_cot("eur", start_date="2025-01-01")
print(cot)
# Commodity prices
gold = client.get_commodities("gold", start_date="2026-01-01")
print(gold)import asyncio
from fxmacrodata import AsyncClient
async def main():
async with AsyncClient(api_key="YOUR_API_KEY") as client:
# Fetch macroeconomic indicators
data = await client.get_indicator("eur", "inflation")
print(data)
# Free Forex Price Endpoint
fx = await client.get_fx_price("usd", "jpy")
print(fx)
# Release calendar
calendar = await client.get_calendar("usd")
print(calendar)
# Data catalogue
catalogue = await client.get_data_catalogue("usd")
print(catalogue)
# COT positioning
cot = await client.get_cot("jpy")
print(cot)
# Commodity prices
gold = await client.get_commodities("gold")
print(gold)
asyncio.run(main())Fetches macroeconomic indicator time series data.
currency:"usd","aud","eur","gbp","cad","nok","nzd","jpy","brl","cny","dkk","pln","sek","sgd", etc.indicator:"policy_rate","inflation","gdp","unemployment","trade_balance","current_account_balance","gov_bond_10y", etc.- API key required for non-USD.
Fetches daily FX spot rates (ECB reference rates) between two currencies.
indicators: Optional comma-separated technical indicators โ"sma_20","sma_50","sma_200","rsi_14","macd","ema_12","ema_26","bollinger_bands", or"all".- No API key needed.
Fetches upcoming economic data release dates for a currency.
indicator: Optional filter to a specific indicator slug.- Returns
announcement_datetime(Unix timestamp) andrelease(indicator slug).
Discovers available macroeconomic indicators for a given currency.
- Returns a dict keyed by indicator slug with
name,unit,frequency, andhas_official_forecast. - API key required for non-USD.
Fetches CFTC Commitment of Traders (COT) positioning data.
- Supported currencies:
AUD,CAD,CHF,EUR,GBP,JPY,NZD,USD. - API key required for non-USD.
Fetches commodity price time series.
indicator:"gold","silver", or"platinum".- API key required.
18 currencies supported: USD, EUR, GBP, JPY, AUD, CAD, CHF, NZD, HKD, SGD, NOK, PLN, SEK, DKK, BRL, CNY, KRW, MXN.
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.
| Category | Metric | USD | EUR | AUD | GBP |
|---|---|---|---|---|---|
| Economy | GDP Growth | โ | โ | โ | โ |
| Inflation Rate | โ | โ | โ | โ | |
| Trade Balance | โ | โ | โ | โ | |
| Current Account Balance | โ | โ | โ | โ | |
| Retail Sales | โ | โ | โ | โ | |
| Industrial Production | โ | โ | โ | โ | |
| Labor Market | Unemployment Rate | โ | โ | โ | โ |
| Employment Level | โ | โ | โ | โ | |
| Full-Time Employment | โ | โ | โ | โ | |
| Part-Time Employment | โ | โ | โ | โ | |
| Participation Rate | โ | โ | โ | โ | |
| Non-Farm Payrolls | โ | โ | โ | โ | |
| Monetary Policy | Policy Rate | โ | โ | โ | โ |
| Risk-Free Rate | โ | โ | โ | โ | |
| Central Bank Assets | โ | โ | โ | โ | |
| Government Bond Yields | 2-Year Govt Bond | โ | โ | โ | โ |
| 5-Year Govt Bond | โ | โ | โ | โ | |
| 10-Year Govt Bond | โ | โ | โ | โ | |
| Inflation-Linked Bond | โ | โ | โ | โ |
MIT License ยฉ FXMacroData
- Website: https://fxmacrodata.com
- API Docs: https://fxmacrodata.com/docs
- GitHub: https://github.com/fxmacrodata/fxmacrodata
- PyPI: https://pypi.org/project/fxmacrodata/
- Readthedocs: https://fxmacrodata.readthedocs.io/en/latest/
- Zenodo: https://zenodo.org/records/18280968