Skip to content

Priority 1 (MCP roadmap): interval pool-liquidity snapshot#31

Merged
DevDizzle merged 6 commits into
masterfrom
mcp/p1-pool-liquidity
Jul 8, 2026
Merged

Priority 1 (MCP roadmap): interval pool-liquidity snapshot#31
DevDizzle merged 6 commits into
masterfrom
mcp/p1-pool-liquidity

Conversation

@DevDizzle

Copy link
Copy Markdown
Owner

What (top commit — 1289e5a)

The engine half of the MCP roadmap's Priority 1: liquidity you can check at any time (RM-006 / 1A):

  • signal-notifier/pool_liquidity.py — every ~10 min during RTH (plus a ~09:22 ET pre-open pass), re-fetches the full Polygon option snapshot for ALL ~50 current-pool contracts (OI, session volume, last trade, day OHLC, IV/greeks, underlying-price fallback chain) and appends one row per (contract, as_of) to the new profit_scout.pool_liquidity_snapshot table. Explicit-schema insert_rows_json — no load jobs, no autodetect (the 07-02 outage rule).
  • POST /refresh_pool_liquidity — NYSE-day + 09:15–16:05 ET self-gate; token-gated via secret-mounted POOL_LIQ_REFRESH_TOKEN (hmac.compare_digest); force/scan_date refused without the token; 120s spam guard.
  • Cloud Scheduler pool-liquidity-refresh2-52/10 9-16 * * 1-5 ET (offset keeps passes clear of the ~09:45 pick run on the same max-instances=1 service).
  • DDL script (executed), decision note, DATA-CONTRACTS section.

Leakage wall (the part that matters)

The table is TELEMETRY — never a feature: entry-day-live, as_of-keyed, never joined into enriched_features_v1/any as-of ≤ scan_date surface, never read by the tournament. The pick path's C1-walled _fetch_live_oi is untouched; run_notifier never imports the new module (verified by review). Quote columns are NULL placeholders pending the RM-001b quote-feed purchase; the MCP omits them while NULL.

Verification

  • gammarips-review: SHIP-WITH-FIXES — all 5 fixes applied (token gate fail-closed on force/scan_date, cron offset, scan_date 400, hmac.compare_digest, ET-date agg fallback).
  • Live since rev signal-notifier-00055-sgn: anonymous force → 403; tokened pass wrote 50/50 pool rows; scheduler job ENABLED.
  • MCP consumer: gammarips-mcp PR Fix README to match current pipeline #6 (cache-first get_contract_snapshot + new get_pool_liquidity), smoke 41/41.

Note on the stack

This branch is based on the local substrate-hardening-2026-07-01 line (4 prior commits: substrate hardening 7 must-fixes, 07-02 enrichment autodetect fix, harness doc de-drift, coherence waves) which was never pushed — those commits appear in this PR because they are its base and are already live in prod. Merge order is: those first (they're in this PR), or merge this PR whole.

🤖 Generated with Claude Code

DevDizzle and others added 6 commits July 1, 2026 23:43
…scovery (7 must-fixes)

- Atomic staging->verify->tx-replace write path (collector + enrichment), schema-drift-safe
- Close regime-lookahead leak (scan-date anchored features; entry-close -> oc_* telemetry)
- Degraded/empty-pool fail-loud + freshness monitor
- Uniqueness guard + per-scan_date Firestore lock + gated 06-10 source-dedup
- Persist mom_60 point-in-time + scheduled underlying-bar cache
- Opportunity surface (MFE/MAE) + interim 3-day label arm + label-semantics tags
- Features-only view + safe view + column tagging + dbt features model + DATA-CONTRACTS
- Fix unauth SQL-injection surface + degraded-day overwrite (review blockers)

All gammarips-review SHIP. Phase A deployed (enrichment-trigger-00046-stt, forward-paper-trader-00048-tqc). Backfill/view scripts gated (dry-run->--confirm), not yet run. Live pick/ledger/_simulate_contract mechanics unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… pipeline (07-02)

The Phase A atomic write path loaded staged rows with autodetect=True; the permanently-NULL recommended_spread_pct (no options quotes on this Polygon plan) inferred as STRING and clashed with the LIKE-cloned FLOAT, failing every enrichment load since 07-02 09:38 ET -> no candidates -> no pick, missed 10:00 entry. Fix: bind the load to the cloned live schema (schema=get_table(staging).schema, drop autodetect, keep ALLOW_FIELD_ADDITION); atomic stage->verify->tx-replace unchanged. Isolation-proven, gammarips-review SHIP, deployed enrichment-trigger-00047-t7t, verified end-to-end (scan 07-01 -> 50 candidates).

Also lands Phase B backfill fixes (both gammarips-review SHIP): backfill_mom_60 _update moved the CTE into the UPDATE FROM-subquery (BQ rejects WITH...UPDATE); backfill_opportunity_surface _merge builds staging via CREATE TABLE AS SELECT <cols> WHERE FALSE + explicit-typed load (CREATE TABLE LIKE cloned REQUIRED entry_day and the subset autodetect load 500'd). Decision-doc 07-02 CORRECTION section + handoff (NEXT_SESSION_PROMPT -> MCP productization focus).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… .gemini

Aligns the Claude Code harness + canonical docs to current reality and the owner-locked monetization direction (docs-only; no code/policy change).

CLAUDE.md: new Mission (free human UI = SEO funnel, monetize MCP access = BYO-agent, sell opportunity surface not a return, primitives-not-a-pick); Current policy V6 -> V7.1 Tilted GIGO (same-day 10:00 entry / +40 / -30 / flat 15:45, live-OI floor 1000 @ 09:45); repo map (agent-arena DEAD, +signal-judge/signal-notifier, gammarips-mcp noted as separate-repo product); fixed dead agent-arena deploy cmd + earnings-window wording.

README.md: full refresh (V4 whale-following -> V7.1 + product framing + current services). ARCHITECTURE/TRADING-STRATEGY/GLOSSARY/MODELS/DATA-CONTRACTS/TESTING: cohort 2026-06-26, live-OI floor DEPLOYED/1000, pick ~09:45 ET, enrichment score>=4 + spread-gate-retired + top-50 BULLISH, opportunity-surface + 3-day arm now LIVE, policy_version V7_1_TILTED_GIGO, agent-arena removed as live consumer.

agents: engineer (drop agent-arena/V2/V3/V3_MECHANICS, add MCP scope + never-autodetect + owner-waivable-DoD), researcher (repoint signals_labeled_v1 -> enriched_option_outcomes/enriched_features_v1 + substrate leakage tags), review (+autodetect-staged-load check that would've caught the 07-02 outage). Deleted deprecated .gemini/ harness (Gemini CLI no longer used). Corrected incident timestamp UTC->ET (05:38 ET).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… privacy on every channel

All deployed to prod 2026-07-03 with gammarips-review gates (BLOCK→fix→SHIP
where noted). Decision doc: docs/DECISIONS/2026-07-03-pool-track-record-and-
generator-depicking.md. Owner directive: "Run it… get us clean and consistent
engine to webapp."

- win-tracker (rev 00015+): NEW /pool_outcomes endpoint — whole-pool
  aggregates from enriched_option_outcomes → Firestore pool_outcomes/current
  for the public Track Record page. Sim-version-tag filtered (legacy NULL
  same-day cohort verified against the documented GIGO composite), honest
  V6-legacy 3d-arm labeling, opp-surface pinned to OPP_MFE_MAE_V1, 503
  fail-loud on degraded substrate. Cron: pool-outcomes-refresh 17:20 ET.
- enrichment-trigger (rev 00048): thesis prompt → thesis_v2_descriptive
  (no entry/target/stop voice, no "recommended", no scan-count quoting;
  FOCUS CONTRACT block; prompt_version stamped in traces).
- overnight-report-generator (rev 00019): report_v3_descriptive (Pool
  Snapshot replaces Directional Calls; no trade-instruction voice on any
  horizon; no bullish-share/z-score prose; no internal field-name debris).
- blog-generator (rev 00028): repositioned to free-site/Agent-Access; dead
  products forbidden at prompt level; webapp_visit paid-pitch regex learns
  "agent access"/$39. voice_rules exemplars updated (vendors into x-poster
  at ITS next deploy; RETIRED_ALIASES additions deliberately deferred).
- signal-notifier (revs 00053, 00054): subscriber pick fan-out RETIRED (the
  pick is the operator's private signal — old code would have emailed it to
  every new Agent Access subscriber) and the WhatsApp/OpenClaw channel
  DEPRECATED to a hard no-op (owner call; env vars were already absent).
  Operator email path byte-identical.
- forward-paper-trader + create_enriched_option_outcomes: comment-only —
  isolation notes updated to cite the 2026-07-03 read-path decision.
- docs: 2026-07-02 service-auth-hardening decision note (was untracked),
  2026-07-03 decision doc, NEXT_SESSION_PROMPT handoff.

Also this session (other surfaces): webapp main = e4f2c983 (Track Record,
six-item nav, Learn spine, de-picked emails), x-poster pick crons paused,
Firestore blog triage (9 archived + 301s, 3 patched).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New signal-notifier module + endpoint that re-reads liquidity for the WHOLE
current enriched pool every ~10 min during RTH (plus a pre-open pass) into
the new profit_scout.pool_liquidity_snapshot table, so the MCP can serve
decision-time liquidity cache-first (one call per shortlist instead of N
upstream fetches at 10:00 ET).

- pool_liquidity.py: full-snapshot fetch (OI/volume/last/day OHLC/IV/greeks
  + underlying-price fallback chain), explicit-schema insert_rows_json (no
  autodetect), fully fail-soft, HARD leakage wall — separate from the
  C1-walled _fetch_live_oi; never imported by run_notifier; table is
  TELEMETRY (as_of-keyed), never a feature.
- /refresh_pool_liquidity: NYSE-day + 09:15-16:05 ET self-gate; token-gated
  via secret-mounted POOL_LIQ_REFRESH_TOKEN (hmac.compare_digest); force/
  scan_date knobs refused without the token (review FIX-1); scan_date
  400-validated; 120s min-interval spam guard.
- Cloud Scheduler pool-liquidity-refresh: 2-52/10 9-16 * * 1-5 ET (offset
  clears the ~09:45 pick run on the same max-instances=1 service, FIX-2).
- DDL: scripts/ledger_and_tracking/create_pool_liquidity_snapshot.py
  (executed 2026-07-07; partition DATE(as_of), cluster contract).
- Docs: DECISIONS/2026-07-07-pool-liquidity-snapshot.md + DATA-CONTRACTS
  section (classification: TELEMETRY, never a feature; RM-001b NULL quote
  placeholders documented).

gammarips-review: SHIP-WITH-FIXES — all 5 fixes applied. Verified live:
rev signal-notifier-00055-sgn; anon force=403; tokened pass wrote 50/50;
scheduler job ENABLED. MCP counterpart: gammarips-mcp PR #6.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@DevDizzle DevDizzle merged commit 8f55f16 into master Jul 8, 2026
1 of 2 checks passed
@DevDizzle DevDizzle deleted the mcp/p1-pool-liquidity branch July 8, 2026 16:46
@DevDizzle DevDizzle restored the mcp/p1-pool-liquidity branch July 8, 2026 16:46
@DevDizzle DevDizzle deleted the mcp/p1-pool-liquidity branch July 8, 2026 16:47
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.

1 participant