FXMacroData Chainlink Integration
Deliver central-bank policy rates, CPI prints, CFTC COT positioning, and gold prices on-chain via a Chainlink External Adapter. Deploy the adapter alongside any Chainlink oracle node and write verified macro data to smart contracts on Ethereum, Arbitrum, Polygon, Avalanche, and 15+ EVM networks.
How it works
The adapter bridges the FXMacroData REST API to the Chainlink oracle network using the standard External Adapter protocol.
Smart contract requests data from oracle
Chainlink node calls this adapter via HTTP
Adapter fetches latest value from FXMacroData
Scaled integer written on-chain by oracle node
Data flow
Return value scaling
All float values are multiplied by 100 before being returned as uint256. A 4.25 % policy rate is stored on-chain as 425. Smart contract consumers must divide by 100 to recover the original decimal value.
Candidate feeds
Five flagship macro feeds covering monetary policy, inflation, positioning, and metals.
| On-chain feed | FXMacroData endpoint | Update cadence | On-chain value (example) |
|---|---|---|---|
| USD Fed Funds Rate | /v1/announcements/usd/policy_rate |
Per FOMC meeting (8×/year) | 425 = 4.25 % |
| USD CPI YoY | /v1/announcements/usd/inflation |
Monthly (BLS release) | 321 = 3.21 % |
| EUR ECB Deposit Rate | /v1/announcements/eur/policy_rate |
Per ECB meeting (8×/year) | 265 = 2.65 % |
| Gold spot (XAU/USD) | /v1/commodities/gold |
Daily | 316780 = $3,167.80 |
| USD COT net position | /v1/cot/usd |
Weekly (Fridays) | 4312700 = 43,127 contracts |
Any indicator in the FXMacroData catalogue can be exposed as an on-chain feed — the table above covers the highest-leverage starting points.
Setup guide
Four steps from clone to on-chain data.
Get a FXMacroData API key
Create an account at fxmacrodata.com/subscribe to obtain your API key. The key is held by the adapter process — it is never embedded in a smart contract.
Deploy the adapter
Clone the repo and run the adapter locally or with Docker:
Verify the adapter is live: curl http://localhost:8080/health → {"status":"ok"}
Register a bridge in your Chainlink node
In the Chainlink node UI go to Bridges → New Bridge and enter:
| Field | Value |
|---|---|
| Bridge Name | fxmacrodata-ea |
| Bridge URL | http://your-adapter-host:8080 |
Test the adapter
Send a test POST request to confirm the adapter responds correctly:
Adapter request reference
The adapter accepts POST / with a standard Chainlink External Adapter body.
Request body
Response body
endpoint |
Required fields | Description |
|---|---|---|
announcements (default) |
currency, indicator |
Central-bank indicators — policy rate, CPI, NFP, GDP, etc. |
commodities |
indicator |
Precious metals — gold, silver, platinum |
cot |
currency |
CFTC COT net positions — usd, eur, gbp, etc. |
Solidity consumer example
A minimal contract that requests the USD Fed Funds Rate via a Chainlink oracle and stores the latest value on-chain.
FXMacroDataConsumer.sol
Solidity ^0.8.19Deploy on a testnet first (Sepolia, Mumbai) and fund with test LINK before mainnet deployment. Full reference: Chainlink single-word response.
Notes
Key security
The FXMACRODATA_API_KEY is held by the node operator process. It is never embedded in a smart contract or logged to the chain.
Low-frequency data
Macro indicators update daily to monthly — no high-frequency oracle infrastructure is needed. A single job run per data release is sufficient.
On-chain integer scaling
All adapter results are val × 100. Smart contracts must divide by 100 to recover the original decimal value.
Any API alternative
For quick prototyping without running a node, use Chainlink Any API to call the FXMacroData REST endpoint directly from a job spec.