Live release feed
Sub-second macro releases for FX backtests
Point-in-time history
USD 25/month
Start Free Trial

Open Source Integration

How-to Guides

How To Use Fxmacrodata Through Fast Trade

Use FXMacroData through Fast Trade by building pair-level macro context, attaching it to backtest research, and exposing it through the fast-trade MCP server.

Share article X LinkedIn Email
Pip, the FXMacroData robot mascot, sorting macro context cards for Fast Trade backtests and MCP tools
Pip organizes FXMacroData macro context for Fast Trade backtests, screening, and agent workflows.

Fast Trade is an open-source Python backtesting library built around portable strategy definitions, CLI workflows, local market archives, terminal views, and an MCP server. The FXMacroData integration gives that stack a macro-context layer for currency-pair research.

Quick answer: use FXMacroDataClient or build_macro_context() from fast_trade.fxmacrodata to fetch pair-level catalogue, calendar, announcement, and forex context before a Fast Trade run. Agents can call the same path through the Fast Trade MCP tool fxmacrodata_macro_context.

The useful pattern is not to call macro APIs from inside every trade decision. Fetch the context once, attach it to the research run, and let the strategy or agent decide how to use it.

Prerequisites

  • Use a current Fast Trade checkout or package version that includes fast_trade.fxmacrodata.
  • Set FXMACRODATA_API_KEY or FXMD_API_KEY in the same environment that runs Fast Trade when requesting protected pair, COT, commodity, session, or sentiment data.
  • Keep the macro context outside the strategy loop so repeated backtests use a stable input snapshot.

Fit

Use this for

Adding macro context to currency-pair backtests, strategy screens, agent prompts, and post-run diagnostics.

Choose Fast Trade when

You want a Python CLI and MCP-enabled research loop where backtests, saved runs, and agent tools share the same project surface.

Avoid

Treating macro context as an automatic buy or sell signal. It is an input for filtering, explaining, or stress-testing strategy output.

Why Fast Trade Works for Macro Context

Fast Trade already treats a strategy as a repeatable research object: data in, strategy rules, output summary, saved artifacts. FXMacroData fits beside that loop by giving the run currency-aware context before the backtest starts.

Fast Trade piece FXMacroData role How to use it
FXMacroDataClient Small REST client for macro, FX, COT, commodities, sessions, and sentiment endpoints. Use it when you want explicit calls from a notebook or script.
build_macro_context() Collects base and quote catalogue, calendar, announcement, and forex payloads for a pair. Use it as the standard context bundle for EUR/USD, GBP/USD, or another pair.
fxmacrodata_macro_context Exposes the same helper through the Fast Trade MCP server. Use it when an agent needs macro context before running a screen, inspecting a strategy, or summarizing a backtest.

Visual Check: Macro Context Flow

Before the strategy runs, build a stable context bundle. The same bundle can be saved with the run, inspected in a notebook, or passed to an agent.

Macro context bundle

Collect context before the Fast Trade run

FXMacroData supplies the macro inputs; Fast Trade keeps the strategy and result artifacts reproducible.

Pair

EUR/USD

Focus

policy_rate

Output

JSON context

1. Inputs

FXMacroData context

Calendar events, announcement values, FX reference rates, COT, and session context.

2. Bundle

build_macro_context

Normalize the base/quote pair, requested indicator, row limit, and API response shape.

3. Use

Research outputs

Attach the bundle to a backtest run, screen, terminal note, or Fast Trade MCP agent call.

Takeaway: macro context should be a declared input to the research run, not a hidden side effect buried inside the trading loop.

Integration Surface Map

Fast Trade exposes FXMacroData in two practical ways: direct Python calls for notebooks and scripts, and an MCP tool for agent workflows.

REST client

Use FXMacroDataClient when your script needs explicit endpoint calls.

Context helper

Use build_macro_context() when the research unit is a currency pair.

MCP tool

Use fxmacrodata_macro_context when an agent needs the same context.

Step 1: Install or Update Fast Trade

Install Fast Trade from PyPI, or use the open-source repository when you want the latest integration files:

pip install fast-trade

For a source checkout:

git clone https://github.com/jrmeier/fast-trade.git
cd fast-trade
python -m venv venv
source venv/bin/activate
pip install -e .

On Windows, activate with venv\Scripts\activate. If you already use Fast Trade in a strategy workspace, update the checkout before using the FXMacroData helper.

Step 2: Build Pair-Level Macro Context

For most pair research, start with build_macro_context(). It asks for a base currency, quote currency, indicator focus, and row limit, then returns a dictionary with the pair's macro and FX context.

For protected currency-pair data such as EUR/USD, set FXMACRODATA_API_KEY or FXMD_API_KEY before running the helper. Fast Trade reads either variable automatically, so the key stays out of notebooks, strategy files, and saved backtest artifacts.

from fast_trade.fxmacrodata import build_macro_context

context = build_macro_context(
    base="eur",
    quote="usd",
    indicator="policy_rate",
    limit=10,
)

print(context.keys())
print(context.get("forex", {}).get("data", [])[:2])

The helper is intentionally useful before a strategy run: it can collect the base catalogue, quote catalogue, filtered calendars, recent announcements, and FX data in one context object. Save that object beside the backtest output if the run depends on it.

Use FXMacroDataClient directly inside Fast Trade when you want a narrower call, such as a release calendar check or a COT snapshot.

Step 3: Use the MCP Tool

Fast Trade also exposes the macro-context helper through its MCP server. Start the local server from the same environment that has Fast Trade installed:

python -m fast_trade.mcp_server

An MCP-capable agent can then call fxmacrodata_macro_context with the same arguments:

{
  "base": "eur",
  "quote": "usd",
  "indicator": "policy_rate",
  "limit": 10
}

This is useful when an agent is reviewing a saved strategy, comparing a screen result against upcoming macro events, or explaining why a currency-pair backtest behaved differently around policy decisions.

Backtest Guardrails

Macro context can improve a research workflow only if it stays reproducible. Keep the context stable and auditable.

Guardrail Reason
Fetch context before the run Repeated parameter tests should use the same macro snapshot.
Save the context with results A reviewer should be able to see which release and FX rows informed the run.
Separate alpha from explanation Macro context can filter or explain strategy output without becoming an untested signal.
Use the right currency pair For cross pairs, build context for both legs rather than assuming USD-only behavior.

If the strategy depends on exact release timing, pair the context helper with the FXMacroData release calendar and make the blackout or event-window rule explicit. If the strategy depends on daily FX direction, inspect the EUR/USD dashboard or the relevant pair dashboard before encoding the rule.

Common Questions

Can Fast Trade use FXMacroData macro data?

Yes. Fast Trade includes FXMacroDataClient and build_macro_context(), which collect catalogue, calendar, announcement, and FX data for a currency pair.

When should I use FXMacroData with Fast Trade?

Use it when a backtest, screen, or agent needs macro context before evaluating strategy output. It is especially useful for pair research where policy, release timing, COT positioning, or FX reference data may change interpretation.

Can an agent access FXMacroData through Fast Trade MCP?

Yes. The Fast Trade MCP server exposes fxmacrodata_macro_context, so an agent can request the same macro context without writing a separate REST client.

Sources and References

With that setup, Fast Trade can treat FXMacroData as a reusable macro-context layer: collect the pair context once, keep it with the run, and expose the same context to agents through MCP when the research workflow needs explanation or review.

Blogroll

AI Answer-Ready

Key Facts

Page
How To Use FXmacrodata Through Fast Trade
Section
Articles
Canonical URL
https://fxmacrodata.com/articles/how-to-use-fxmacrodata-through-fast-trade
Source
FXMacroData editorial and official publisher references
Last Updated
2026-07-16 06:03 UTC

Provenance And Trust

Cite the canonical URL and source field above. Where available, this page maps to official publisher releases and timestamped updates.

Quick Q&A

Can Fast Trade use FXMacroData macro data? Yes. Fast Trade includes FXMacroDataClient and build_macro_context(), which collect catalogue, calendar, announcement, and FX data for a currency pair.

When should I use FXMacroData with Fast Trade? The helper is useful when a backtest or agent needs pair-level macro context before evaluating a strategy, screen, or research prompt.

Can agents access FXMacroData through Fast Trade MCP? Yes. The Fast Trade MCP server exposes fxmacrodata_macro_context, so agents can request the same macro context without writing a separate REST client.

Prompt Packs

Use these in ChatGPT, Claude, Gemini, Mistral, Perplexity, or Grok for consistent source-aware outputs.

Share page X LinkedIn Email