Official macroeconomic, FX and central-bank data for 22 currencies as typed SQL tables, with the time each figure was published
Installing and Loading
INSTALL fxmacrodata FROM community;
LOAD fxmacrodata;
Example
-- The latest print of every US indicator, with the instant each was published.
-- USD needs no API key.
SELECT indicator, val, unit, announced_at, source
FROM fxmacrodata_latest('USD')
WHERE val IS NOT NULL
ORDER BY announced_at DESC;
-- What is due next
SELECT release, announced_at, event_importance
FROM fxmacrodata_calendar('USD')
WHERE announced_at > now()
ORDER BY announced_at
LIMIT 5;
-- One indicator's published history
SELECT date, val, announced_at
FROM fxmacrodata_announcements('USD', 'inflation')
ORDER BY date DESC;
About fxmacrodata
Reads FXMacroData, which collects releases from official publishers (statistical agencies, central banks) across 22 currencies and stamps every observation with the time it was published.
| Function | Returns |
|---|---|
fxmacrodata_latest(currency) |
The most recent print of every indicator for an economy |
fxmacrodata_announcements(currency, indicator) |
The published history of one indicator |
fxmacrodata_calendar(currency) |
Upcoming scheduled releases with publication times |
Columns are typed: val is DOUBLE and announced_at is TIMESTAMP, so figures can be
ordered, compared and aggregated without casting, and a missing figure stays NULL.
USD works without a key. For the other currencies and the full history window, set
FXMACRODATA_API_KEY in the environment; it is sent as an X-API-Key header, so it
never appears in a URL, a query plan or SQL history.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| fxmacrodata_announcements | table | NULL | NULL | |
| fxmacrodata_calendar | table | NULL | NULL | |
| fxmacrodata_latest | table | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.