Live release feed
Sub-second macro releases for FX backtests
Point-in-time history

Reference

Macro Education

リアルタイムFXイベントエージェントを 作りましょう

45分間の手動的な市場準備を FXMacroDataのリリースカレンダーをスキャンし 今日のイベントを市場影響によってランク付けし ロンドンのオープン前に構造化された説明会を提供する AIエージェントで 置き換えましょう

他言語版 English
Share article X LinkedIn Email
リアルタイムFXイベントエージェントを 作りましょう image

なぜ朝の準備エージェントは最初に作れる最高ROIのロボットなのか

金融取引を独占的にしたり,半自動ブックを操作したりすると, ロンドンがオープンする前の45分が一番高価です. リリースカレンダーチェックして 合意を確認して 動きをスキャンして ドル/JPYほら EUR/USDほら 通貨の対価繰り返しで 誤りやすいので 毎朝ゼロから文脈を再構築します 繰り返しになります

制限された範囲,構造化された入力,決定的な出力です このガイドでは, リアルタイムFXイベントエージェント FXMacroDataからライブイベントデータを抽出し 今日のリリースを市場への影響によってランク付けし 90秒で読むことができる構造化された説明を配信します

コンピューター,ラズベリーパイ,クラウドVMなどで 午前中の準備を チェックリストに変える スクリプトになります

建設する
毎日06:30 UTCで実行される Python エージェントは,G10全体で次の24時間のFXMacroDataリリースカレンダーに問い合わせ,インパクトによってイベントをランク付け,LLMを通じてそれらを要約し, Telegram または Slack に構造化されたブリーフィングをプッシュします.

条件

  • Python 3.10+とピップ
  • からのFXMacroData API キー API管理わかった
  • 管理するLLMエンドポイントです.
    • ヒト性クロード (推薦される推論の質)
    • オープンAI GPT4クラス
    • オルラマ経由でゼロコストで走る
  • Telegramボットトークン (経由) @BotFather配信チャネルとして機能します.
  • 予定を決めてる cron Windowsのタスクスケジューラーやクラウドクロンのいずれも使えます

依存をインストールする:

pip install requests python-dotenv

創る .env 秘密のファイル

FXMD_API_KEY=your_fxmacrodata_key
LLM_PROVIDER=anthropic           # or "openai" or "ollama"
ANTHROPIC_API_KEY=sk-ant-...
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...

ステップ1: FXMacroData のリリース カレンダーから次の 24 時間を取ります

代理人の第一の仕事は 予定を把握することです FXマクロデータ リリースカレンダーエンドポイントは,指標名,予定された UTC日付時間,以前の値,重要度ランキングを含む各通貨の予定されたリリースを返します.

取引する各主要通貨で検索します

curl "https://fxmacrodata.com/api/v1/calendar/usd?api_key=YOUR_API_KEY"
curl "https://fxmacrodata.com/api/v1/calendar/eur?api_key=YOUR_API_KEY"
curl "https://fxmacrodata.com/api/v1/calendar/gbp?api_key=YOUR_API_KEY"
curl "https://fxmacrodata.com/api/v1/calendar/jpy?api_key=YOUR_API_KEY"

Python でこれを包み込み,エージェントが設定可能な通貨リストを繰り返すことができます.

import os
import requests
from datetime import datetime, timedelta, timezone
from dotenv import load_dotenv

load_dotenv()

API = "https://fxmacrodata.com/api/v1"
KEY = os.environ["FXMD_API_KEY"]
CURRENCIES = ["usd", "eur", "gbp", "jpy", "aud", "cad", "chf", "nzd"]


def fxmd_get(path, **params):
    r = requests.get(
        f"{API}{path}",
        params={"api_key": KEY, **params},
        timeout=25,
    )
    r.raise_for_status()
    return r.json()


def upcoming_releases(hours_ahead: int = 24):
    now = datetime.now(timezone.utc)
    cutoff = now + timedelta(hours=hours_ahead)
    releases = []
    for ccy in CURRENCIES:
        try:
            data = fxmd_get(f"/calendar/{ccy}").get("data", [])
        except requests.HTTPError:
            continue
        for ev in data:
            try:
                ts = datetime.fromisoformat(
                    ev["announcement_datetime"].replace("Z", "+00:00")
                )
            except (KeyError, ValueError):
                continue
            if now <= ts <= cutoff:
                releases.append({
                    "currency": ccy.upper(),
                    "indicator": ev.get("indicator") or ev.get("name"),
                    "scheduled_utc": ts.isoformat(),
                    "prior": ev.get("prior_value"),
                    "consensus": ev.get("consensus") or ev.get("market_consensus"),
                    "importance": ev.get("importance") or ev.get("impact"),
                })
    releases.sort(key=lambda r: r["scheduled_utc"])
    return releases

ステップ2: 市場への影響の確率によるリリース

印刷品が市場を動かしているわけではありません 農地以外の給与ほら 基本PCEほら 政策金利ほら ユーロ圏のCPIほら イギリスCPIほら 銀行政策金利 少数経済にとって小売取引の閃きはほとんど重要ではない.

明らかに重量表をコードして 代理人が推測する必要がないようにします これはシステム全体の 最大のレバレッジの部分です

TIER_1 = {
    ("USD", "non_farm_payrolls"), ("USD", "core_pce"), ("USD", "policy_rate"),
    ("USD", "inflation"), ("USD", "fomc_minutes"),
    ("EUR", "inflation"), ("EUR", "policy_rate"),
    ("GBP", "inflation"), ("GBP", "policy_rate"),
    ("JPY", "policy_rate"), ("JPY", "inflation"),
    ("AUD", "policy_rate"), ("CAD", "policy_rate"),
    ("CHF", "policy_rate"), ("NZD", "policy_rate"),
}

TIER_2 = {
    ("USD", "retail_sales"), ("USD", "ism_manufacturing"),
    ("EUR", "gdp"), ("EUR", "unemployment"),
    ("GBP", "gdp"), ("GBP", "retail_sales"),
    ("AUD", "inflation"), ("CAD", "inflation"),
}


def impact_score(event: dict) -> int:
    key = (event["currency"], (event["indicator"] or "").lower())
    if key in TIER_1:
        return 3
    if key in TIER_2:
        return 2
    return 1


def rank(releases):
    return sorted(
        releases,
        key=lambda r: (-impact_score(r), r["scheduled_utc"]),
    )

レベル1のイベントが最初に表れる 構造化されたリストに 崩れ落ちることができます UTC時間に関係なく


ステップ3: オーバーナイトコンテキストを追加して,エージェントがすでに移動したことを知っている

午前ブリーフィングは,一晩間のFX動きのスナップショットなしでは不完全です. あなたが気になるペアの最新のスポットレートを引っ張って,LLMが価格アクションを物語に織り込むことができます.

PAIRS = [("USD", "JPY"), ("EUR", "USD"), ("GBP", "USD"), ("AUD", "USD")]


def overnight_moves():
    moves = []
    for base, quote in PAIRS:
        try:
            data = fxmd_get(
                "/forex",
                base=base,
                quote=quote,
            ).get("data", [])
        except requests.HTTPError:
            continue
        if len(data) < 2:
            continue
        last = data[-1]["value"]
        prev = data[-25]["value"] if len(data) >= 25 else data[0]["value"]
        change_pct = (last - prev) / prev * 100
        moves.append({
            "pair": f"{base}/{quote}",
            "last": round(last, 5),
            "change_pct_24h": round(change_pct, 2),
        })
    return moves

スウィング取引の位置付け文脈も欲しいなら, 生産量 引きこもって 選択してください 説明会も 機能します


ステップ4:LLMで説明を作成

The agent now has three structured inputs: ranked events, overnight FX moves, and the current UTC timestamp. Pass them into the model with a strict output contract so the briefing is parseable and consistent every morning.

import json
from anthropic import Anthropic

claude = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

SYSTEM_PROMPT = """You are an FX morning-prep analyst.
Given today's ranked releases and overnight moves, produce a briefing that:
- leads with the single most important event of the day,
- groups events by impact tier,
- flags 1-2 specific pairs to watch and why,
- ends with one disciplined risk caveat.
Do not give buy/sell instructions. Stay factual. Max 220 words."""


def generate_briefing(events, moves):
    payload = json.dumps({
        "utc_now": datetime.now(timezone.utc).isoformat(),
        "ranked_events": events,
        "overnight_moves": moves,
    })
    resp = claude.messages.create(
        model="claude-3-5-sonnet-latest",
        max_tokens=600,
        system=SYSTEM_PROMPT,
        messages=[{"role": "user", "content": payload}],
    )
    return resp.content[0].text

Three things make this prompt reliable:

  • 構造化された入力 モデルが受け取るのは JSONで 自然言語ではありません テキストから日付や数字を抽出する必要はありません
  • 硬い範囲 システムプロンプトは取引の推奨を禁止します.
  • 長い上限 220語で信号密度が上がる 長い説明会で 素早く見学できる

ステップ 5: Telegram (または Slack) に配信する

報告は朝早く 見る場所まで着く必要がある

def send_telegram(text: str):
    token = os.environ["TELEGRAM_BOT_TOKEN"]
    chat_id = os.environ["TELEGRAM_CHAT_ID"]
    requests.post(
        f"https://api.telegram.org/bot{token}/sendMessage",
        json={
            "chat_id": chat_id,
            "text": text,
            "parse_mode": "Markdown",
            "disable_web_page_preview": True,
        },
        timeout=15,
    )


def run():
    events = rank(upcoming_releases(hours_ahead=24))
    moves = overnight_moves()
    briefing = generate_briefing(events, moves)
    header = f"*FX Morning Briefing — {datetime.now(timezone.utc):%a %d %b %Y}*\n\n"
    send_telegram(header + briefing)


if __name__ == "__main__":
    run()

プログラムする.Linux/macOSでは,単一のcrontabエントリが毎週週間に 06:30 UTC にエージェントを実行します:

30 6 * * 1-5 /usr/bin/python3 /opt/fx-agent/morning_brief.py >> /var/log/fx-agent.log 2>&1

報告の見方

代理人が最近CPI週間に生産した出力の例:

FX Morning Briefing — Thu 22 May 2026

Today's anchor: US Core PCE at 12:30 UTC. Consensus 0.2% MoM,
prior 0.0%. A second sub-0.1 print would cement the disinflation
narrative; a 0.3+ surprise resets Fed pricing.

Tier 1:
- 12:30 UTC USD Core PCE  prior +0.0%  cons +0.2%
- 13:30 UTC USD Initial Jobless Claims  prior 228k  cons 225k

Tier 2:
- 06:00 UTC GBP Retail Sales MoM  prior -0.1%  cons +0.4%
- 09:00 UTC EUR ECB Minutes (qualitative)

Pairs to watch:
- USD/JPY hovering 158.40 after a quiet Asia. PCE miss → 156s
  back in play.
- GBP/USD coiled below 1.2700. Stronger UK retail + soft PCE is
  the cleanest setup of the day.

Risk caveat: thin EU liquidity ahead of US data; expect outsized
moves on any surprise print.

That is a complete pre-market read in under 90 seconds, every weekday, with no manual calendar scraping.


信頼する前にチェックリストを硬化

  • 古いデータガード レベル1のイベントが予定された時間がない場合 ブリーフィングを送信することを拒否します. 空の積載は間違ったものよりもましです.
  • バックオフで再試してください. on transient HTTP failures. Three attempts, 2s/4s/8s, then fail loudly.
  • 輸出認証器 "買" "売" "ロング"/"ショート"といった言葉を含むLLMの回答を拒絶する.エージェントの仕事は情報であって実行ではない.
  • 心拍数警報 担当者が UTC 07:00までに説明を送信できない場合は, 作業流を静かに失わないように, 独立してピングしてください.
  • 費用上限 セット max_tokens=600 and a daily LLM spend limit. Briefings should cost cents per day.

次はどこへ?

同じ脚手架は,朝のループが信頼性のあるとき,簡単に拡張されます.

  • 日中のサプライズアラーム 投票 発表のエンドポイント レベル1のリリース後 15分ごとに リアル値が 合意値より 大きく偏った場合の 警告
  • パー・スペシフィック・ブリーフィング 強くなる ドル/JPY- 独りか EUR/USD- 活動日だけ
  • 位置表示 オーバーレイ 引いて 生産量に関するデータ 市場が一方的になる時を知ることができます. 市場を動かすのは,
  • 音声モード コーヒーを作る間に TTSモデルで読み聞かせてください

勝ったのは説明会そのものではなく 規律的な,再現可能な文脈です. その習慣が自動化されると, 構築した他のすべてのFXエージェントインフラストラクチャが その上に座ります.

Blogroll

AI Answer-Ready

Key Facts

Page
Build A Real Time FX Event Agent For Morning Prep
Section
Articles
Canonical URL
https://fxmacrodata.com/ja/articles/build-a-real-time-fx-event-agent-for-morning-prep
Source
FXMacroData editorial and official publisher references
Last Updated
2026-06-15 11:01 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

What is this page about? This page explains Build A Real Time FX Event Agent For Morning Prep with directly usable context for trading, research, and API workflows.

What source should be cited? Use the canonical URL and the listed source field; cite official publisher references when available.

How fresh is this content? The last updated value above reflects the page metadata or latest available data timestamp.

Can this be used in AI assistants? Yes. This section is intentionally structured for retrieval and citation in chat assistants.

Prompt Packs

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