pre-trade-discipline-gate
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePre-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 artifact and can link that artifact back to the related thesis without changing the thesis review schedule.
pre_trade_discipline_decisionThe gate is intentionally offline. It does not place orders, cancel orders, call a broker API, or fetch market data.
评估计划中的手动订单是否应在提交给经纪商前执行。该Skill会读取本地检查清单以及可选的市场机制、熔断机制和trader-memory-core工件。它会生成一个工件,并可将该工件关联到相关的交易论点(thesis),而不会改变论点的审核日程。
pre_trade_discipline_decision该校验门为离线设计,不会下单、取消订单、调用经纪商API或获取市场数据。
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 and
exposure_decisioncircuit_breaker_decision - When you want checklist adherence to be visible in later trader-memory-core reviews
- 下达任何手动入场订单前立即使用
- 当候选订单通过图表验证和仓位规模确认后
- 近期出现亏损后,用于避免冷却期内的报复性交易
- 工作流上游存在和
exposure_decision时circuit_breaker_decision - 希望检查清单的遵守情况在后续trader-memory-core审核中可见时
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 JSON from market-regime-daily / exposure-coach
exposure_decision - Optional JSON from drawdown-circuit-breaker
circuit_breaker_decision
- Python 3.9+
- 包含候选订单级检查清单答案的本地JSON或YAML文件
- 可选:下的trader-memory-core交易论点状态
state/theses/ - 可选:来自market-regime-daily / exposure-coach的JSON文件
exposure_decision - 可选:来自drawdown-circuit-breaker的JSON文件
circuit_breaker_decision
Workflow
工作流程
Step 1: Prepare the Checklist
步骤1:准备检查清单
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_ORDERSjson
{
"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 , , , and . Non-actionable intents such as , , , , and are recorded but do not create an order permission.
ENTRY_READYACTIONABLEACTIONABLE_DAY1MANUAL_ORDERWATCHLISTDELAYED_EP_WATCHPEAD_HANDOFFIGNOREREJECTEDProvide both and for every actionable candidate. Use a finite, non-negative number or numeric string; zero is valid. Treat missing values, booleans, non-numeric strings, , infinities, and negative values as inputs and review them before placing an order.
planned_risk_dollarsactual_risk_dollarsNaNREVIEW_REQUIRED创建包含候选订单答案的JSON或YAML文件。仅对可执行的手动订单意向进行校验。观察列表和忽略意向会被记录为。
NO_ACTIONABLE_ORDERSjson
{
"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."
}
]
}可执行意向包括、、和。非可执行意向如、、、和会被记录,但不会生成下单权限。
ENTRY_READYACTIONABLEACTIONABLE_DAY1MANUAL_ORDERWATCHLISTDELAYED_EP_WATCHPEAD_HANDOFFIGNOREREJECTED为每个可执行候选订单同时提供和。使用有限的非负数或数字字符串;零是有效的。将缺失值、布尔值、非数字字符串、、无穷大和负值视为输入,需在下单前进行审核。
planned_risk_dollarsactual_risk_dollarsNaNREVIEW_REQUIREDStep 2: Run the Gate
步骤2:运行校验门
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-disciplineSet for deterministic testing or backfills:
--as-ofbash
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:00bash
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设置参数用于确定性测试或回溯填充:
--as-ofbash
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:00Step 3: Interpret the Decision
步骤3:解读决策
| Decision | Meaning |
|---|---|
| All actionable manual-order candidates passed the checklist and upstream gates |
| Inputs are missing, unknown, or journaling failed; do not place orders until reviewed |
| At least one actionable candidate violated a discipline rule |
| The file contains no actionable manual orders; nothing should be placed |
By default the CLI exits for every valid decision and exits only for input or runtime errors. Use when a shell pipeline should return for any non- decision.
01--fail-on-non-go2GO| 决策结果 | 含义 |
|---|---|
| 所有可执行手动订单候选均通过检查清单和上游校验门 |
| 输入缺失、未知或记录失败;下单前需先审核 |
| 至少一个可执行候选违反了纪律规则 |
| 文件中无任何可执行手动订单;无需下单 |
默认情况下,CLI对所有有效决策返回退出码,仅在输入或运行时错误时返回退出码。当Shell流水线需要对任何非决策返回退出码时,使用参数。
01GO2--fail-on-non-goRules
规则
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 - exceeds
actual_risk_dollarsplanned_risk_dollars - trader-memory-core has a losing exit or partial loss inside the revenge window
- exposure-coach recommendation is or
REDUCE_ONLYCASH_PRIORITY - drawdown-circuit-breaker recommendation is ,
COOLDOWN, orHALTEDTRADING_HALTED
Missing or unreadable market-regime or circuit-breaker artifacts produce for actionable orders. If no actionable order exists, the result remains .
REVIEW_REQUIREDNO_ACTIONABLE_ORDERS当出现以下情况时,校验门将阻止可执行候选订单:
- 入场未在书面计划中确认
- 止损未预先定义
- 仓位规模未在计划范围内确认
- 任一风险美元字段缺失或不是有限的非负数(标记为)
REVIEW_REQUIRED - 超过
actual_risk_dollarsplanned_risk_dollars - trader-memory-core显示在报复窗口内存在亏损离场或部分亏损
- exposure-coach的建议为或
REDUCE_ONLYCASH_PRIORITY - drawdown-circuit-breaker的建议为、
COOLDOWN或HALTEDTRADING_HALTED
市场机制或熔断机制工件缺失或无法读取时,可执行订单会被标记为。如果没有可执行订单,结果仍为。
REVIEW_REQUIREDNO_ACTIONABLE_ORDERSOutputs
输出
The script writes:
pre_trade_discipline_decision_YYYY-MM-DD_HHMMSS.json- A matching markdown report unless is set
--json-only - A JSONL journal row under when
state/journal/pre-trade-discipline/is provided--journal-dir
Each candidate result includes a 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 , while valid values retain their original representation.
checklist_answersnullIf a candidate includes and is provided, the JSON report is linked into the thesis list using trader-memory-core . The skill does not call and does not change monitoring review dates.
thesis_id--state-dirlinked_reportslink_reportmark_reviewed脚本会生成以下内容:
pre_trade_discipline_decision_YYYY-MM-DD_HHMMSS.json- 对应的Markdown报告(除非设置了参数)
--json-only - 当提供参数时,在
--journal-dir下生成JSONL格式的记录行state/journal/pre-trade-discipline/
每个候选订单结果包含对象,其中包含用于决策的书面计划、止损、仓位规模、风险美元和备注答案,以便后续审核可追溯下单时的回答内容。无效的风险美元值会存储为JSON ,有效值则保留其原始格式。
checklist_answersnull如果候选订单包含且提供了参数,JSON报告会通过trader-memory-core的方法关联到交易论点的列表中。该Skill不会调用方法,也不会更改监控审核日期。
thesis_id--state-dirlink_reportlinked_reportsmark_reviewedResources
资源
- - Main CLI and rule engine
scripts/check_pre_trade_discipline.py - - Rule definitions and integration notes
references/discipline_gate_framework.md - - Thesis state schema
skills/trader-memory-core/schemas/thesis.schema.json
- - 主CLI和规则引擎
scripts/check_pre_trade_discipline.py - - 规则定义和集成说明
references/discipline_gate_framework.md - - 交易论点状态 schema
skills/trader-memory-core/schemas/thesis.schema.json
Key Principles
核心原则
- Manual execution only - The output is a pre-broker checklist gate, not an order router.
- Written plan first - No written entry plan, stop, or size confirmation means no manual entry.
- Producer-compatible state reading - Revenge-risk detection follows trader-memory-core timestamp and outcome behavior.
- Journal without review side effects - The gate links reports to theses without advancing review schedules.
- 仅支持手动执行 - 输出是经纪商下单前的检查清单校验门,而非订单路由工具。
- 书面计划优先 - 若无书面入场计划、止损或仓位规模确认,则不允许手动下单。
- 兼容生产者状态读取 - 报复性风险检测遵循trader-memory-core的时间戳和结果行为。
- 记录但不产生审核副作用 - 校验门将报告关联到交易论点,但不会推进审核日程。