Skip to content

feat: 741 Pure Macro Matrix — regime gate on all BUY orders#203

Merged
Timwal78 merged 4 commits into
mainfrom
claude/iam-product-architecture-vkr8hy
Jun 21, 2026
Merged

feat: 741 Pure Macro Matrix — regime gate on all BUY orders#203
Timwal78 merged 4 commits into
mainfrom
claude/iam-product-architecture-vkr8hy

Conversation

@Timwal78

@Timwal78 Timwal78 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • New internal module core/api/macro_bp.py — 741 Pure Macro Matrix engine

    • Multi-layer EMA structural alignment via Tradier daily OHLCV (manifesto-compliant)
    • Classifies: PERFECT_BULLISH_REGIME / PERFECT_BEARISH_REGIME / CONSOLIDATION_CHOP
    • 1-hour per-symbol cache (daily regime is intraday-stable)
    • Internal HTTP route secret-gated via X-Macro-Secret header — not a public endpoint
  • core/app.py — registers internal macro blueprint alongside existing macro741_bp

  • iam_executor.py — regime gate before any BUY execution

    • Direct Python import — zero HTTP exposure, uses server-side cache
    • PERFECT_BEARISH_REGIME blocks BUY; SELL/exits always proceed
    • UNKNOWN / INSUFFICIENT_DATA fail open
  • iam_scanner.py — mandatory anchors always resolved every pass

  • tools/robinhood_executor_sml.py v3.4

    • Mandatory anchor symbols always injected into oracle poll
    • Regime gate in execution path, BUY side only
    • Secret-gated via MACRO_GATE_SECRET env var in executor.env
  • Dynamic options routingauto mode routes any symbol to calls/puts; chain availability is the natural gate

Test plan

  • IAM executor logs regime on every BUY attempt
  • PERFECT_BEARISH_REGIME symbol: BUY blocked, SELL proceeds
  • UNKNOWN / data fetch failure: BUY is NOT blocked (fail-open)
  • /api/macro/<symbol> without X-Macro-Secret → 403
  • /api/macro/<symbol> with correct secret → regime response
  • Robinhood executor v3.4 startup log confirms version
  • Mandatory anchors appear in every oracle poll log cycle
  • auto instrument mode: BUY → calls, SELL → puts on any symbol

🤖 Generated with Claude Code

https://claude.ai/code/session_019CTP9AwncFUZQvZxpXb6Np

@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)
signal-auction-loom Ready Ready Preview, Comment Jun 21, 2026 12:19am
squeeze-os Ready Ready Preview, Comment Jun 21, 2026 12:19am

claude added 2 commits June 21, 2026 00:03
- New blueprint: core/api/macro_bp.py
  • Computes EMAs [30,60,90,120,741] on 791 daily bars from Tradier
  • Classifies PERFECT_BULLISH_REGIME / PERFECT_BEARISH_REGIME / CONSOLIDATION_CHOP
  • 1-hour per-symbol cache (daily EMAs are intraday-stable)
  • GET /api/macro and GET /api/macro/<symbol>

- Registered in core/app.py at /api prefix

- iam_executor.py: _get_macro_regime() + gate before Tradier/Discord execution
  • PERFECT_BEARISH_REGIME blocks BUY; SELL/exits always proceed
  • UNKNOWN / INSUFFICIENT_DATA fail open (never block on data unavailability)

- tools/robinhood_executor_sml.py v3.3
  • _get_macro_regime() + 1-hour local cache
  • Macro gate in _execute() after god_stacked check, BUY side only
  • Version bump v3.2 → v3.3

Data source: Tradier daily OHLCV — DEVELOPER_MANIFESTO §3 compliant (no yfinance)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019CTP9AwncFUZQvZxpXb6Np
iam_scanner.py:
- _MANDATORY_ANCHORS = {AMC, GME, IWM} always prepended to every scan pass
- 100% FETCH preserved — anchors are deduplicated, never duplicated from live universe
- Anchors come first so they're never dropped by the TOP_N cap

iam_executor.py:
- Remove hardcoded ("IWM","SPY","QQQ") filter from auto options routing
- auto mode now tries options (calls/puts) on ANY symbol from the live universe
- Options chain availability is the natural gate — no chain → logged error, no crash
- BUY signal → calls, SELL signal → puts, extended hours → equity fallback unchanged

tools/robinhood_executor_sml.py v3.4:
- _MANDATORY_ANCHORS = {AMC, GME, IWM} — always injected into oracle poll
- After batch + history scan, fetch /api/oracle/{sym} for each missing anchor
- Wide open dynamic universe + guaranteed AMC/GME/IWM coverage every cycle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019CTP9AwncFUZQvZxpXb6Np
@Timwal78 Timwal78 force-pushed the claude/iam-product-architecture-vkr8hy branch from 66bcd85 to 7952e19 Compare June 21, 2026 00:03
/api/741macro is the paid pitch-deck product (x402, 0.04 RLUSD).
/api/macro was accidentally public — now secret-gated.

core/api/macro_bp.py:
- Kill public batch route (/api/macro) entirely
- /api/macro/<symbol> now requires X-Macro-Secret header → 403 without it
- MACRO_GATE_SECRET env var controls the secret

iam_executor.py:
- Drop HTTP call entirely — import _compute_regime() directly (same process)
- Zero network exposure, uses server-side 1-hour cache

tools/robinhood_executor_sml.py:
- _get_macro_regime() now sends X-Macro-Secret header from MACRO_GATE_SECRET env var
- No secret configured → fails open (UNKNOWN), never blocks trades

Add MACRO_GATE_SECRET to Render env + executor.env to activate the gate.

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

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

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

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

- Stack config moved to MACRO_STACK_CSV env var (Render secret) — no periods in code
- Response layers renamed L1-L5 (short→long) — opaque, no period values exposed
- Internal variable names cleaned up — no period references visible in source
- _REQUIRED_BARS computed from env config, not hardcoded
- Fails gracefully with NOT_CONFIGURED if MACRO_STACK_CSV not set

/api/741macro remains the paid public product.
/api/macro/<symbol> is secret-gated internal only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019CTP9AwncFUZQvZxpXb6Np
@Timwal78 Timwal78 merged commit b18adc7 into main Jun 21, 2026
3 of 4 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