Metadata-Version: 2.4
Name: forexnewsradar
Version: 1.0.0
Summary: Fail-closed Forex & Gold (XAU/USD, EUR/USD) macro news direction (BUY/SELL) and T-5m volatility VETO client for Python trading bots and AI agents. EUR/USD free forever, zero API key.
Author-email: ForexNewsRadar <support@forexnewsradar.com>
License-Expression: MIT
Project-URL: Homepage, https://forexnewsradar.com
Project-URL: Documentation, https://forexnewsradar.com/methodology
Project-URL: API Playbook, https://forexnewsradar.com/solutions/forex-gold-macro-drift-api
Project-URL: Gold CPI & NFP API, https://forexnewsradar.com/solutions/gold-xauusd-cpi-nfp-news-api
Project-URL: Remote MCP Server, https://forexnewsradar.com/.well-known/mcp.json
Keywords: forex,forex-api,economic-calendar,xauusd,gold,eurusd,macro-news,trading-bot,algotrading,metatrader5,mt5,prop-firm,news-filter,mcp
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# forexnewsradar

Zero-dependency, **fail-closed** Python client and CLI for **[ForexNewsRadar](https://forexnewsradar.com)** — real-time Forex & Gold (`XAU/USD`, `EUR/USD`) macro news direction (`BUY` / `SELL` / `NEUTRAL`) and automated `T-5m` / whipsaw `VETO` risk gates across 18 FX and metals pairs.

**`EUR/USD` is live and free forever** with zero account, zero credit card, and zero API key.

## Why `forexnewsradar`?

- **Built for live FX & Gold bots, not raw calendar scraping:** Instead of brittle HTML scrapers that fail open on HTTP `429` rate limits, every network timeout, HTTP error, or stale heartbeat fails **closed** (`safe_to_trade=False`, `status="VETO"`).
- **Automatic broker symbol normalization:** Handles broker prefixes and suffixes out of the box (`EURUSD.pro`, `mEURUSD`, `iXAUUSDm`, `GOLD.raw`, `EUR/USD` -> canonical `EURUSD` / `XAUUSD`).
- **Post-Announcement Macro Drift + VETO:** Upstream per-pair 2-stage Gradient Boosting (GBM) models intentionally wait 15 to 30 seconds after a release so HFT spread vacuums refill before emitting directional drift (`BUY` / `SELL`), neutral stand-aside (`CLEAR`), or protective `VETO` locks (`Whipsaw`, `Collision`, `Foreign Noise`, `Toxic Window`, `T-5m PRE_NEWS`).
- **Zero external dependencies:** Pure Python standard library (`>=3.9`), typed (`py.typed`), lightweight `~300`-byte compact polling payload with built-in TTL caching.

## Installation

```bash
pip install forexnewsradar
```

## 5-Second Quickstart (Free Live `EUR/USD`, Zero API Key)

```python
from forexnewsradar import check_trade_gate

verdict = check_trade_gate("EURUSD.pro")
print(verdict.status, verdict.direction_bias, verdict.safe_to_trade, verdict.veto_reason)
```

## Production Bot Integration (With Caching + Fail-Closed Guard)

```python
from forexnewsradar import ForexNewsRadarClient

# Omit api_key for free live EUR/USD.
# Set FNR_API_KEY env var (or pass api_key="fnr_live_...") for Gold (XAUUSD), Silver (XAGUSD), and all 18 FX pairs.
client = ForexNewsRadarClient(cache_ttl_sec=15.0, min_pre_news_buffer_sec=300)

def allow_entry(broker_symbol: str, technical_side: str) -> bool:
    verdict = client.check_gate(broker_symbol, prop_account=True)
    if not verdict.safe_to_trade:
        print(f"Blocked {verdict.symbol}: {verdict.status} ({verdict.veto_reason})")
        return False
    if verdict.is_directional and verdict.direction_bias != technical_side:
        print(f"Skipped counter-macro {technical_side} vs {verdict.direction_bias}")
        return False
    return True
```

## CLI Usage

```bash
# Exit code 0 if safe_to_trade=true, exit code 2 if blocked/VETO (ideal for shell/cron guards)
forexnewsradar check EURUSD.pro

# Full JSON telemetry including recent releases and public closed ECN fills (TP / SL / TIME_EXIT)
forexnewsradar pair EURUSD
```

## Remote MCP for Claude Code, Cursor & AI Trading Agents

The same live `EUR/USD` macro gate is also available as a stateless Streamable HTTP MCP server (`30 req/min` free on `EUR/USD`, zero `Authorization` header required):

```json
{
  "mcpServers": {
    "forexnewsradar": {
      "type": "http",
      "url": "https://forexnewsradar.com/mcp"
    }
  }
}
```

## Links & Boundaries

- **Live Free EUR/USD Terminal & Closed ECN Log:** [forexnewsradar.com](https://forexnewsradar.com)
- **Methodology & Timing Architecture:** [forexnewsradar.com/methodology](https://forexnewsradar.com/methodology)
- **FX & Gold Macro Drift API Playbook:** [forexnewsradar.com/solutions/forex-gold-macro-drift-api](https://forexnewsradar.com/solutions/forex-gold-macro-drift-api)
- **Gold (XAU/USD) CPI & NFP News API:** [forexnewsradar.com/solutions/gold-xauusd-cpi-nfp-news-api](https://forexnewsradar.com/solutions/gold-xauusd-cpi-nfp-news-api)

Strictly read-only analytical software for informational use: zero custody, zero account management. Optional fixed-term passes (zero auto-renewal) unlock Gold (`XAU/USD`), Silver (`XAG/USD`), and the other 16 FX pairs across Tokyo, London, and New York sessions.
