Metadata-Version: 2.4
Name: forexnewsradar
Version: 1.1.0
Summary: Zero-dependency, fail-closed Python SDK & CLI for Forex & Gold (XAU/USD, EUR/USD) macro news direction (BUY/SELL) and T-5m volatility VETO across 18 pairs. EUR/USD free forever.
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 SDK and CLI for **[ForexNewsRadar](https://forexnewsradar.com)** — real-time Forex & Gold (`XAU/USD`, `EUR/USD`) macro news direction (`BUY` / `SELL` / `CLEAR`) and automated `T-5m` / whipsaw `VETO` gates across 18 FX and metals pairs.

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

## Install

```bash
pip install forexnewsradar
```

Pure Python standard library (`>=3.9`), fully typed (`py.typed`), zero third-party dependencies.

## 5-Second Quickstart (Free Live `EUR/USD`)

```python
import forexnewsradar as fnr

# 1. One-line boolean trade guard (fail-closed; handles broker suffixes automatically)
if fnr.is_safe("EURUSD.pro"):
    print("Safe to trade EUR/USD")

# 2. Compact fail-closed verdict (~300B payload — never raises on network or lock errors)
verdict = fnr.check("EURUSD.pro")
print(verdict)
# EURUSD: BUY [SAFE] | next event in 3h 07m

# 3. Full typed telemetry: trader headline, next Tier-1 catalyst, recent releases & closed ECN fills
eur = fnr.pair("EURUSD")
print(eur.trader_headline, "|", eur.explanation)
if eur.next_event:
    print("Next event:", eur.next_event.currency, eur.next_event.title, eur.next_event.scheduled_at)

# 4. Live 18-pair desk snapshot (shows which pairs are unlocked vs locked + direct unlock links)
board = fnr.board()
print(f"Unlocked: {board.auth.unlocked_count}/{board.auth.total_pairs}")
```

## Production Bot Client (Caching + Pro Pairs Like Gold `XAU/USD`)

Set `FNR_API_KEY` in your environment (or pass `api_key="fnr_live_..."`) to unlock Gold (`XAUUSD`), Silver (`XAGUSD`), and all 18 pairs.

```python
import forexnewsradar as fnr

with fnr.ForexNewsRadar(cache_ttl_sec=15.0, min_pre_news_buffer_sec=300) as radar:
    verdict = radar.check("XAUUSDm", prop_account=True)

    if verdict.locked:
        # Polite, explicit deep-link to unlock Gold ($9 single pair or $29 all 18, zero auto-renewal)
        print("Unlock XAU/USD:", verdict.unlock_url)
    elif not verdict.safe_to_trade:
        print(f"Blocked {verdict.symbol}: {verdict.status} ({verdict.veto_reason})")
    elif verdict.is_directional:
        print(f"Macro drift aligned: {verdict.direction_bias}")
```

When calling `radar.pair("XAUUSD")` without a key for Gold, the SDK raises a clean typed `PairLockedError` (no opaque HTTP 402 stacktrace) carrying `.symbol`, `.unlock_url`, `.single_price_usd`, and `.all_18_price_usd`:

```python
from forexnewsradar import ForexNewsRadar, PairLockedError

radar = ForexNewsRadar()
try:
    gold = radar.pair("XAUUSD")
except PairLockedError as exc:
    print(exc.unlock_url)  # https://forexnewsradar.com/?unlock=XAUUSD
```

## Zero-Traceback Terminal CLI

```bash
# View all 18 FX & Gold pairs (live status on unlocked pairs + direct unlock links on Pro pairs)
forexnewsradar board

# Fast fail-closed gate check (exit 0 = safe, exit 2 = blocked/VETO/locked)
forexnewsradar check EURUSD.pro
forexnewsradar check XAUUSD --json

# Full telemetry (next catalyst, recent macro prints, closed ECN TP/SL/TIME_EXIT log)
forexnewsradar pair EURUSD

# Check active FNR_API_KEY entitlement status
forexnewsradar status
```

## Why Fail-Closed?

- **Never fails open on news day:** Every timeout, network glitch, rate limit, or stale heartbeat returns `safe_to_trade=False` and `status="VETO"` in `check()` / `is_safe()`.
- **Automatic broker symbol normalization:** `EURUSD.pro`, `mEURUSD`, `iXAUUSDm`, `GOLD.raw`, `SILVER`, and `EUR/USD` all normalize automatically to canonical 6-letter symbols.
- **Post-Announcement Macro Drift + VETO:** Upstream per-pair 2-stage Gradient Boosting (GBM) models wait 15 to 30 seconds after a release so initial spread vacuums refill before publishing directional drift (`BUY` / `SELL`), neutral stand-aside (`CLEAR`), or protective `VETO` shields (`Whipsaw`, `Collision`, `Foreign Noise`, `Toxic Window`, `T-5m PRE_NEWS`).
- **Safe `repr()`:** `repr(ForexNewsRadar(api_key="..."))` always masks your secret key so it never leaks into logs.

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

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

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

## Links & Software Boundary

- **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 and engineering integration use: zero custody, zero account management. Optional fixed-term passes (`$9` single pair / `$29` all 18 pairs for 30 days, zero auto-renewal) unlock Gold (`XAU/USD`), Silver (`XAG/USD`), and the other 16 FX pairs across Tokyo, London, and New York sessions.
