feat(config/scripts): GREEN config wiring + S6 recompute tooling

prod/configs/green.yml:
- asset_bucket_ban_set: [4] (B4 banned at selector level)
- s6_size_table: inline bootstrap multipliers (B0→0.4, B1→0.3, B3→2.0,
  B5→0.5, B6→1.5) matching CRITICAL_ASSET_PICKING S6 scenario
- esof_sizing_table: FAV→1.2, MILD_POS→0.6, UNKNOWN→0.25,
  MILD_NEG→0.0, UNFAV→0.0
- use_int_leverage: true (1x fixed pending winrate analysis)
- s6_table_path: pointer to generated YAML (recompute updates this)
BLUE (blue.yml) carries none of these keys → BLUE math unchanged.

prod/configs/green_s6_table.yml: bootstrap stub with frontmatter
(generated_at, source_branch, n_trades). Regenerated by recompute script.

prod/scripts/recompute_s6_coefficients.py:
  Queries trade_events, maps assets to KMeans buckets, derives per-bucket
  sizing mults. Variance guard: >20% net-PnL move flags bucket in
  dolphin.s6_recompute_log for manual review before promote.

prod/s6_recompute_flow.py:
  Prefect flow wrapping the recompute script. Cadence via
  S6_RECOMPUTE_INTERVAL_DAYS env (default 30). Kill-switch:
  S6_RECOMPUTE_DISABLED=1.

prod/scripts/analyze_leverage_winrate.py:
  Read-only walk of CH trade_events; bins trades by leverage_raw,
  emits per-bin WR/net-PnL/avg-MAE. Output informs the int-leverage
  rounding rule choice (Option 1 round-half-up vs Option 2 banker's round
  vs stay-at-1x). Does not auto-apply a rule change.

Plan refs: Tasks 3, 8, 10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hjnormey
2026-04-22 06:08:08 +02:00
parent 48dcf3fe13
commit 36d263eb91
6 changed files with 762 additions and 0 deletions

View File

@@ -66,3 +66,47 @@ hazelcast:
imap_pnl: DOLPHIN_PNL_GREEN
imap_state: DOLPHIN_STATE_GREEN
state_map: DOLPHIN_STATE_GREEN # capital persistence map (was defaulting to BLUE)
# ──────────────────────────────────────────────────────────────────────────────
# GREEN S6/EsoF/AEM sprint (exp/green-s6-esof-aem-shadow-2026-04-21).
# BLUE (prod/configs/blue.yml) does NOT set these keys → orchestrator loads them
# as None/False → BLUE math is byte-identical pre-sprint. To disable any branch
# on GREEN, comment the corresponding key — single kill-switch per feature.
# ──────────────────────────────────────────────────────────────────────────────
# Strictly-zero buckets banned at the ranking layer (selector skips them so the
# slot is handed to the next-best asset — does NOT waste capital with 0× sizing).
# Fractional buckets (B0/B1/B5) stay tradeable via s6_size_table below.
asset_bucket_ban_set: [4]
# Pointer to the generated S6 coefficient table. prod/scripts/recompute_s6_coefficients.py
# regenerates this file on the configured cadence (env S6_RECOMPUTE_INTERVAL_DAYS).
# Bucket → per-entry notional multiplier applied at esf_alpha_orchestrator.py single-site.
s6_table_path: prod/configs/green_s6_table.yml
# Inline fallback used when s6_table_path is missing (bootstrap / first-run):
# matches the S6 row from prod/docs/CRITICAL_ASSET_PICKING_BRACKETS_VS._ROI_WR_AT_TRADES.md.
# B4 is absent (banned above); B2 is absent (= 1.0x, no-op).
s6_size_table:
0: 0.40
1: 0.30
3: 2.00
5: 0.50
6: 1.50
# EsoF regime gate lives at the top of _try_entry (orchestrator single-site).
# mult == 0 → regime-wide skip (no selector/sizer work). UNKNOWN replaces NEUTRAL
# (signals-in-conflict is empirically the worst ROI state).
esof_sizing_table:
FAVORABLE: 1.20
MILD_POSITIVE: 0.60
UNKNOWN: 0.25
NEUTRAL: 0.25 # alias — historical CH rows / stale HZ snapshots
MILD_NEGATIVE: 0.00
UNFAVORABLE: 0.00
# Target exchanges (e.g. Binance) require integer leverage. Default 1x pending
# CH-trade-walk in prod/scripts/analyze_leverage_winrate.py to pick the rounding
# rule (round-half-up vs banker's round vs stay-at-1x). leverage_raw is preserved
# in CH trade_events + NDPosition for that analysis.
use_int_leverage: true

View File

@@ -0,0 +1,34 @@
# GREEN S6 bucket sizing table
# ────────────────────────────────────────────────────────────────────────────
# Auto-generated by prod/scripts/recompute_s6_coefficients.py.
# Bucket → per-entry notional multiplier applied at the orchestrator single-site
# (`nautilus_dolphin/nautilus_dolphin/nautilus/esf_alpha_orchestrator.py`).
#
# Semantics:
# value == 1.0 → no-op (same as BLUE)
# value < 1.0 → size down (fractional)
# value > 1.0 → size up (leaned-into bucket)
# absent bucket → 1.0 (no-op)
# value == 0.0 → prefer banning via `asset_bucket_ban_set` in green.yml
# (selector-ban reroutes to next-ranked asset;
# sizer 0× would waste the slot)
#
# Regeneration cadence: env S6_RECOMPUTE_INTERVAL_DAYS (default 30).
# If any bucket's net-PnL moves > ~20% between runs, the recompute flow flags
# the change in CH `dolphin.s6_recompute_log` for manual review before apply.
# ────────────────────────────────────────────────────────────────────────────
meta:
generated_at: "2026-04-21T00:00:00Z" # replaced on each recompute
source_branch: "exp/green-s6-esof-aem-shadow-2026-04-21"
n_trades: 0 # populated by recompute script
note: "Bootstrap stub — regenerate with prod/scripts/recompute_s6_coefficients.py before staging"
# Bucket → multiplier. B4 excluded (banned at selector). B2 omitted (= 1.0 no-op).
# Seeded from the S6 scenario in prod/docs/CRITICAL_ASSET_PICKING_BRACKETS_VS._ROI_WR_AT_TRADES.md.
buckets:
0: 0.40
1: 0.30
3: 2.00
5: 0.50
6: 1.50