Skip to content

feat(741macro): 741 Pure Macro Matrix — x402-gated 5-EMA B2B endpoint#202

Merged
Timwal78 merged 2 commits into
mainfrom
claude/agent-credit-bureau-spec-y3zejd
Jun 20, 2026
Merged

feat(741macro): 741 Pure Macro Matrix — x402-gated 5-EMA B2B endpoint#202
Timwal78 merged 2 commits into
mainfrom
claude/agent-credit-bureau-spec-y3zejd

Conversation

@Timwal78

Copy link
Copy Markdown
Owner

741 Pure Macro Matrix

Adds /api/741macro — a new x402-gated premium endpoint implementing the 741 Pure Macro Matrix: a 5-layer EMA structural alignment engine for institutional macro regime detection.

API: GET/POST /api/741macro | Cost: 0.04 RLUSD | MCP tool: macro_741_scan


What It Does

Computes EMA 30 / 60 / 90 / 120 / 741 on daily closes for any set of US equity tickers and classifies each into one of three macro states:

State Meaning
PERFECT_BULLISH_REGIME EMA_30 > EMA_60 > EMA_90 > EMA_120 > EMA_741 — full institutional highway
PERFECT_BEARISH_REGIME Full stack inversion — macro distribution confirmed
CONSOLIDATION_CHOP Mixed stack — check squeeze_alert

squeeze_alert=true fires when CONSOLIDATION_CHOP and |matrix_spread_pct| < 5% — price coiling directly against the 741 anchor, macro breakout building.

matrix_spread_pct = ((EMA_30 - EMA_741) / EMA_741) * 100

Key Design Points

  • Fully dynamic ticker universe?symbols=SPY,QQQ,GME,NVDA (any comma-separated list, max 50). No hardcoded defaults.
  • Data chain: Tradier daily bars (primary, 1150-day lookback) → Alpaca fallback
  • Pure-Python EMA — no pandas in the hot path; seeded SMA + exponential smoothing
  • Discord webhook — fires on every PERFECT_BULLISH or PERFECT_BEARISH hit (non-blocking daemon thread, uses existing DISCORD_WEBHOOK_ALL env var)
  • 60-second per-ticker cache — back-to-back scans of the same symbol are effectively free
  • x402 gate — UUID f3a7c891-2d54-4b8e-9a1f-6c3d8e5f7b2a registered in proof402_integration.py

Files Changed

File Change
core/api/macro741_bp.py NEW — Flask blueprint + EMA engine + Discord notifier
proof402_integration.py Add /api/741macro endpoint UUID + price to ENDPOINTS, _PAYMENT_PRICES, _FREE_PREVIEW_BY_PATH
core/api/mcp_bp.py Add macro_741_scan tool to _TOOLS, _ENDPOINT_IDS, _PRICES, and _dispatch()
core/app.py Import and register macro741_bp at /api prefix

Example Usage

# Scan any tickers you choose
curl -X POST https://squeezeos-api.onrender.com/api/741macro \
  -H "X-Payment-Token: <token>" \
  -H "Content-Type: application/json" \
  -d '{"symbols": "SPY,QQQ,IWM,GME,NVDA,MSTR"}'
{
  "status": "success",
  "product": "741 Pure Macro Matrix",
  "summary": {"perfect_bullish": 2, "perfect_bearish": 1, "consolidation_chop": 3, "squeeze_alerts": 1},
  "results": [
    {
      "ticker": "SPY",
      "current_close": 547.21,
      "structural_alignment": "PERFECT_BULLISH_REGIME",
      "matrix_spread_pct": 12.847,
      "squeeze_alert": false,
      "layers": {"EMA_30": 548.1, "EMA_60": 541.3, "EMA_90": 532.7, "EMA_120": 521.4, "EMA_741": 486.2}
    }
  ]
}

⚠️ Pre-deploy: Register UUID in 402Proof Dashboard

Before merging to main, register the new endpoint UUID in the 402Proof dashboard:

  • UUID: f3a7c891-2d54-4b8e-9a1f-6c3d8e5f7b2a
  • Price: 0.04 RLUSD
  • Path: /api/741macro

Generated by Claude Code

5-layer EMA structural alignment engine (EMA 30/60/90/120/741) exposed
as a premium REST + MCP tool gated at 0.04 RLUSD via x402/402Proof.

- NEW core/api/macro741_bp.py — Flask blueprint at GET/POST /api/741macro
  • Fully dynamic ticker universe via ?symbols= (no hardcoded list)
  • Tradier primary, Alpaca fallback for 1150-day daily bar history
  • Pure-Python EMA computation (no pandas dependency in hot path)
  • PERFECT_BULLISH_REGIME / PERFECT_BEARISH_REGIME / CONSOLIDATION_CHOP
  • squeeze_alert flag when CHOP + |matrix_spread_pct| < 5% (macro coil)
  • Discord webhook (DISCORD_WEBHOOK_ALL) fires on PERFECT alignment hits
  • 60-second per-ticker in-memory cache; max 50 symbols per call
- EDIT proof402_integration.py — register /api/741macro UUID + price
- EDIT core/api/mcp_bp.py — add macro_741_scan MCP tool (schema + dispatch)
- EDIT core/app.py — import and register macro741_bp at /api prefix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyKH8i6w34HcLA3HGBzfQn
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/timothy-waltons-projects?upgradeToPro=build-rate-limit

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
squeeze-os Ready Ready Preview, Comment Jun 20, 2026 11:42pm

Adds Macro741ID constant (f3a7c891-2d54-4b8e-9a1f-6c3d8e5f7b2a) and
seeds the 741 Pure Macro Matrix endpoint (0.04 RLUSD) into 402Proof on
every boot. Without this, 402Proof cannot issue invoices for the new
B2B macro alignment endpoint.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyKH8i6w34HcLA3HGBzfQn
@Timwal78 Timwal78 marked this pull request as ready for review June 20, 2026 23:59
@Timwal78 Timwal78 merged commit e194c74 into main Jun 20, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants