Pre Trade Discipline Gate

作者 tradermontyeab8d5cb97b9无许可证2.9K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库3天前更新

Evaluate a local pre-trade checklist before manual order entry, blocking planless, oversized, revenge-risk, market-regime-blocked, or circuit-breaker-blocked entries while journaling the decision for trader-memory-core review.

包含脚本Business & Finance
AI 生成的概览

离线交易前检查清单闸门,批准、复核或阻止计划中的手动订单并记录决策。

功能
读取本地 JSON 或 YAML 候选手动订单清单,以及可选的市场状态、熔断器和交易者记忆核心产物,然后对每个可执行候选应用纪律规则。它会生成 pre_trade_discipline_decision JSON 产物、对应的 Markdown 报告,以及可选的 JSONL 日志行。决策为 GO、REVIEW_REQUIRED、NO_GO 或 NO_ACTIONABLE_ORDERS,报告可关联到论点状态而不改变复核计划。
适用场景
适用于在下达手动入场订单之前,尤其是在近期亏损之后,或已有上游敞口与熔断决策时。适合希望强制遵守检查清单和风险金额上限、并让其在后续复核中可见的交易者。
运行要求
需要 Python 3.9+ 和本地 JSON 或 YAML 答案文件。可选交易者记忆核心论点状态、exposure_decision JSON 和 circuit_breaker_decision JSON。该技能附带可执行脚本,离线运行,不下单也不获取市场数据。

Pre-Trade Discipline Gate

Overview

Evaluate whether a planned manual order should proceed before it is placed at the broker. This skill reads a local checklist plus optional market-regime, circuit-breaker, and trader-memory-core artifacts. It produces a pre_trade_discipline_decision artifact and can link that artifact back to the related thesis without changing the thesis review schedule.

The gate is intentionally offline. It does not place orders, cancel orders, call a broker API, or fetch market data.

When to Use

  • Immediately before placing any manual entry order
  • When a candidate has passed chart validation and position sizing
  • After a recent loss, to avoid revenge trades during the cooldown window
  • When the workflow has an upstream exposure_decision and circuit_breaker_decision
  • When you want checklist adherence to be visible in later trader-memory-core reviews

Prerequisites

  • Python 3.9+
  • A local JSON or YAML answers file with candidate-level checklist answers
  • Optional trader-memory-core thesis state under state/theses/
  • Optional exposure_decision JSON from market-regime-daily / exposure-coach
  • Optional circuit_breaker_decision JSON from drawdown-circuit-breaker

Workflow

Step 1: Prepare the Checklist

Create a JSON or YAML file with candidate answers. Only actionable manual-order intents are gated. Watchlist and ignore intents are journaled as NO_ACTIONABLE_ORDERS.

json
{  "candidates": [    {      "symbol": "AAPL",      "thesis_id": "th_aapl_gm_20260703_0001",      "order_intent": "ENTRY_READY",      "entry_in_written_plan": true,      "stop_predefined": true,      "size_within_plan": true,      "planned_risk_dollars": 500,      "actual_risk_dollars": 500,      "notes": "Entry matches the journaled breakout plan."    }  ]}

Actionable intents are ENTRY_READY, ACTIONABLE, ACTIONABLE_DAY1, and MANUAL_ORDER. Non-actionable intents such as WATCHLIST, DELAYED_EP_WATCH, PEAD_HANDOFF, IGNORE, and REJECTED are recorded but do not create an order permission.

Provide both planned_risk_dollars and actual_risk_dollars for every actionable candidate. Use a finite, non-negative number or numeric string; zero is valid. Treat missing values, booleans, non-numeric strings, NaN, infinities, and negative values as REVIEW_REQUIRED inputs and review them before placing an order.

Step 2: Run the Gate

bash
python3 skills/pre-trade-discipline-gate/scripts/check_pre_trade_discipline.py \  --answers-file state/manual-entry-checklist.json \  --state-dir state/theses \  --market-regime-decision reports/exposure_decision_latest.json \  --circuit-breaker-decision reports/circuit_breaker_decision_latest.json \  --output-dir reports/pre-trade-discipline \  --journal-dir state/journal/pre-trade-discipline

Set --as-of for deterministic testing or backfills:

bash
python3 skills/pre-trade-discipline-gate/scripts/check_pre_trade_discipline.py \  --answers-file state/manual-entry-checklist.json \  --as-of 2026-07-03T12:00:00-04:00

Step 3: Interpret the Decision

DecisionMeaning
GOAll actionable manual-order candidates passed the checklist and upstream gates
REVIEW_REQUIREDInputs are missing, unknown, or journaling failed; do not place orders until reviewed
NO_GOAt least one actionable candidate violated a discipline rule
NO_ACTIONABLE_ORDERSThe file contains no actionable manual orders; nothing should be placed

By default the CLI exits 0 for every valid decision and exits 1 only for input or runtime errors. Use --fail-on-non-go when a shell pipeline should return 2 for any non-GO decision.

Rules

The gate blocks an actionable candidate when:

  • The entry is not confirmed in the written plan
  • The stop is not predefined
  • The size is not confirmed within plan
  • Either risk-dollar field is missing or is not a finite, non-negative number (REVIEW_REQUIRED)
  • actual_risk_dollars exceeds planned_risk_dollars
  • trader-memory-core has a losing exit or partial loss inside the revenge window
  • exposure-coach recommendation is REDUCE_ONLY or CASH_PRIORITY
  • drawdown-circuit-breaker recommendation is COOLDOWN, HALTED, or TRADING_HALTED

Missing or unreadable market-regime or circuit-breaker artifacts produce REVIEW_REQUIRED for actionable orders. If no actionable order exists, the result remains NO_ACTIONABLE_ORDERS.

Outputs

The script writes:

  • pre_trade_discipline_decision_YYYY-MM-DD_HHMMSS.json
  • A matching markdown report unless --json-only is set
  • A JSONL journal row under state/journal/pre-trade-discipline/ when --journal-dir is provided

Each candidate result includes a checklist_answers object with the written-plan, stop, size, risk-dollar, and notes answers used for the decision, so later reviews can audit what was answered at order time. Invalid risk-dollar values are stored as JSON null. Valid JSON decimals that cannot round-trip through a binary float are retained as numeric strings so underflow or precision loss cannot change the gate decision.

If a candidate includes thesis_id and --state-dir is provided, the JSON report is linked into the thesis linked_reports list using trader-memory-core link_report. The skill does not call mark_reviewed and does not change monitoring review dates.

Resources

  • scripts/check_pre_trade_discipline.py - Main CLI and rule engine
  • references/discipline_gate_framework.md - Rule definitions and integration notes
  • skills/trader-memory-core/schemas/thesis.schema.json - Thesis state schema

Key Principles

  1. Manual execution only - The output is a pre-broker checklist gate, not an order router.
  2. Written plan first - No written entry plan, stop, or size confirmation means no manual entry.
  3. Producer-compatible state reading - Revenge-risk detection follows trader-memory-core timestamp and outcome behavior.
  4. Journal without review side effects - The gate links reports to theses without advancing review schedules.

来源与署名

来源:tradermonty/claude-trading-skills位于skills/pre-trade-discipline-gate提交eab8d5c

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架

更多来自 tradermonty/claude-trading-skills 的技能

Weekly Performance Digest

tradermonty

将已平仓的交易论点汇总为每周绩效报告,包含指标、模式分解和经验教训。

包含脚本
Data & Analytics2.9K3天前更新

Trade Performance Coach

tradermonty

审查已记录的交易,评估流程遵守、风险纪律、执行质量与行为模式,并生成教练报告。

包含脚本
Business & Finance2.9K3天前更新

Strategy Pivot Designer

tradermonty

检测回测迭代停滞,并为交易策略生成结构不同的策略转向方案。

包含脚本
Business & Finance2.9K3天前更新

Skill Designer

tradermonty

Design new Claude skills from structured idea specifications. Use when the skill auto-generation pipeline needs to produce a Claude CLI prompt that creates a complete skill directory (SKILL.md, references, scripts, tests) following repository conventions.

包含脚本
待分类2.9K3天前更新

Residual Edge Analyzer

tradermonty

Separate a strategy return series into declared baseline exposure and residual edge with returns-based OLS attribution, HAC inference, rolling stability, alternate-baseline sensitivity, and regime breakdowns. Use when evaluating whether backtest, out-of-sample, or live returns contain independent alpha beyond market, equal-weight, momentum, sector, or user-supplied factor returns; when explaining whether a drawdown came from baseline exposure or strategy-specific behavior; or when a strategy needs an attribution quality gate after backtesting. Do not use for holdings-based Brinson attribution, feature-level Shapley explanations, or analysis from summary metrics without a dated return series.

包含脚本
待分类2.9K3天前更新

Manifoldbt Backtester

tradermonty

Runs a declarative strategy spec over OHLCV bars with the manifoldbt Rust engine, pairs the fill log into round trips, and emits the eight inputs the backtest-expert skill scores. Use when the user wants to execute a backtest, measure a rule they have described, obtain win rate / average win / average loss / max drawdown from real bars, or feed backtest-expert with measured numbers instead of estimates.

包含脚本
待分类2.9K3天前更新