Files
QuantEngineByItz/spec/formulas/domains/cash.yaml
kjh2064 aedabdd37b feat(quant-engine): v8.9 제안서 P0-P3 로드맵 채택 — 15개 의사결정 엔진 신규 구현
suggest/quant_investment_engine_v8_9_portfolio_optimizer_canonical_refactored.yaml의
implementation_todo_v8_9(P0~P4) 전체를 spec/tool/golden case 레벨로 구현.

- P0: PORTFOLIO_TRANSITION_UTILITY_V1, SELL_LOT_PARETO_SELECTOR_V1, FORECAST_SIMULATION_ENGINE_V1
- P1: SECTOR_EXPOSURE_GRAPH_V1/LEADER_LIFECYCLE_GATE_V1, EXECUTION_CAPACITY_LADDER_V1, MODEL_GOVERNANCE_KILL_SWITCH_V1
- P2: SCENARIO_SHOCK_MATRIX_V1, TRANSITION_SET_ENUMERATOR_V1, IMMUTABLE_DECISION_LEDGER_V1, EXECUTION_PLAN_COMPILER_V1
- P3: STATE_VECTOR_CONSTRUCTOR_V1, WALK_FORWARD_BOOTSTRAP_V1, TRANSITION_SET_ENUMERATOR_V1(MRC/CVaR 확장),
      REBALANCE_CADENCE_GATE_V1, WEEKLY_LEGACY_TRANSFER_PLAN_V1

기존 regime/cluster 연동 정책 수치(현금방어선, 반도체 cap)는 그대로 유지하고 신규 cap 필드만 추가.
spec/09_decision_flow.yaml과 runtime/active_artifact_manifest.yaml에 전 엔진 배선 완료.
governance/todo/v8_9_p{0,1,2,3}_adoption_plan.yaml에 각 단계 작업 추적 기록.

검증: validate_specs/validate_golden_coverage_100(100%)/validate_calibration_registry_v1/
validate_schema_model_generation_v1/validate_agents_shrink_v1 전부 PASS. golden test 53/53 PASS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 00:06:52 +09:00

1063 lines
37 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
schema_version: formula_domain.v1
source: C:\Temp\data_feed\spec\13_formula_registry.yaml
domain: cash
formulas:
MARKET_RISK_SCORE_V1:
purpose: 시장 위험 점수 MRS를 0~10으로 계산
inputs:
- field: vix_close
unit: index_points
- field: kospi_close
unit: index_points
- field: kospi_ma20
unit: index_points
- field: usd_krw
unit: KRW_per_USD
- field: usd_jpy_2d_change_pct
unit: percent
- field: credit_stress_status
unit: none
components:
vix_score:
rules:
- if: vix_close < 18
points: 0
- if: 18 <= vix_close <= 25
points: 2
- if: 25 < vix_close <= 35
points: 3
- if: vix_close > 35
points: 4
missing_points: 4
kospi_score:
rules:
- if: kospi_close >= kospi_ma20
points: 0
- if: kospi_close < kospi_ma20
points: 2
missing_points: 2
usd_krw_score:
rules:
- if: usd_krw < 1400
points: 0
- if: 1400 <= usd_krw <= 1450
points: 1
- if: usd_krw > 1450
points: 2
missing_points: 2
usd_jpy_score:
rules:
- if: usd_jpy_2d_change_pct > -1
points: 0
- if: usd_jpy_2d_change_pct <= -1
points: 1
missing_points: 1
credit_score:
rules:
- if: credit_stress_status == 'none'
points: 0
- if: credit_stress_status in ['caution', 'stress', 'DATA_MISSING']
points: 1
missing_points: 1
expression: min(10, vix_score + kospi_score + usd_krw_score + usd_jpy_score +
credit_score)
output:
field: market_risk_score
unit: points_0_10
missing_policy: 컴포넌트별 missing_points를 적용한다.
canonical_ref: spec/risk/market_risk_cash.yaml:risk_control.market_risk_score_based_cash
owner: quant_team
lifecycle_state: active
input_fields:
- vix_close
- kospi_close
- kospi_ma20
- usd_krw
- usd_jpy_2d_change_pct
- credit_stress_status
output_fields:
- market_risk_score
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
TARGET_CASH_PCT_V1:
purpose: MRS 기반 목표 현금비중 계산
inputs:
- field: market_risk_score
unit: points_0_10
- field: cash_floor_regime_min_pct
unit: percent
optional: true
expression: max(5 + (market_risk_score / 10) * 15, cash_floor_regime_min_pct)
output:
field: target_cash_pct
unit: percent
missing_policy: market_risk_score 미산출 시 MARKET_RISK_SCORE_V1을 먼저 실행. 그래도 불가하면
15% 및 신규매수 보류.
canonical_ref: spec/risk/market_risk_cash.yaml:risk_control.market_risk_score_based_cash
owner: quant_team
lifecycle_state: active
input_fields:
- market_risk_score
- cash_floor_regime_min_pct
output_fields:
- target_cash_pct
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
EXPECTED_EDGE_V1:
purpose: 비용과 신뢰도 차감 후 기대우위 계산
inputs:
- field: target_price
unit: KRW_per_share
- field: entry_price
unit: KRW_per_share
- field: stop_price
unit: KRW_per_share
- field: bayesian_confidence_multiplier
unit: ratio
- field: execution_cost_rate
unit: ratio
expression: ((target_price - entry_price) / (entry_price - stop_price)) * bayesian_confidence_multiplier
- execution_cost_rate
output:
field: expected_edge
unit: ratio
validation:
- target_price > entry_price
- entry_price > stop_price
- bayesian_confidence_multiplier >= 0
- execution_cost_rate >= 0
gates:
- if: expected_edge >= 1.5
action: EDGE_PASS
- if: expected_edge < 1.5
action: NO_A_GRADE_NO_IMMEDIATE_BUY
missing_policy: NO_EXPECTED_EDGE. A등급·즉시매수 금지.
canonical_ref: spec/strategy/entry_core.yaml:entry_timing_guardrails.numeric_gates.expected_edge_floor
owner: quant_team
lifecycle_state: active
input_fields:
- target_price
- entry_price
- stop_price
- bayesian_confidence_multiplier
- execution_cost_rate
output_fields:
- expected_edge
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RATIOS_V1:
purpose: 현금비중·매수가능현금·거래 후 현금비중 계산 (D+2 정산현금 단독 기준)
inputs:
- field: settlement_cash
unit: KRW
note: '사용자 지침: D+2 정산현금만이 현금이다.'
- field: reserved_order_amount
unit: KRW
- field: planned_buy_amount
unit: KRW
- field: sell_cash_proceeds_d2
unit: KRW
- field: total_asset
unit: KRW
outputs:
settlement_cash_ratio: settlement_cash / total_asset * 100
total_cash_ratio: settlement_cash / total_asset * 100
buy_power_cash: settlement_cash - reserved_order_amount
buy_power_ratio: (settlement_cash - reserved_order_amount) / total_asset * 100
post_trade_total_cash_ratio: (settlement_cash - planned_buy_amount + sell_cash_proceeds_d2)
/ total_asset * 100
output:
field: cash_ratio_set
unit: object
missing_policy:
settlement_cash: NO_CASH_CHECK
total_asset: NO_CASH_CHECK
reserved_order_amount: 0
sell_cash_proceeds_d2: 0
canonical_ref: spec/risk/portfolio_exposure.yaml:portfolio_exposure_framework.cash_floor.numeric_definitions
owner: quant_team
lifecycle_state: active
input_fields:
- settlement_cash
- reserved_order_amount
- planned_buy_amount
- sell_cash_proceeds_d2
- total_asset
output_fields:
- cash_ratio_set
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
TICK_NORMALIZER_V1:
purpose: '한국 KRX 호가 단위(tick size) 기준으로 지정가를 내림 정규화. HTS에 입력 불가능한 소수점·단위 불일치 가격(예:
144,568원, 25,886원)을 차단. 모든 주문 유형에 floor(내림) 적용 — 매수는 낮은 가격(유리), 손절·익절은 체결 확률
우선.
'
applicable: 모든 지정가(매수·손절·익절·trailing_stop) 출력 전 최종 패스. HS008 강제.
inputs:
- field: raw_price
unit: KRW_per_share
tick_table:
- condition: 0 < raw_price < 2000
tick_size: 1
example: 1,500원 → 1원 단위
- condition: 2000 <= raw_price < 5000
tick_size: 5
example: 3,750원 → 5원 단위
- condition: 5000 <= raw_price < 20000
tick_size: 10
example: 12,345원 → 10원 단위
- condition: 20000 <= raw_price < 50000
tick_size: 50
example: 35,780원 → 50원 단위
- condition: 50000 <= raw_price < 200000
tick_size: 100
example: 144,568원 → 100원 단위
- condition: 200000 <= raw_price < 500000
tick_size: 500
example: 196,800원 → 500원 단위
- condition: raw_price >= 500000
tick_size: 1000
example: 650,000원 → 1,000원 단위
expression: floor(raw_price / tick_size) * tick_size
output:
field: tick_normalized_price
unit: KRW_per_share
examples:
- raw_price: 144568
tick_size: 100
result: 144500
note: 50만 원 미만 → 100원 단위
- raw_price: 25886
tick_size: 50
result: 25850
note: 5만 원 미만 → 50원 단위
- raw_price: 196800
tick_size: 500
result: 196500
note: 20만 원 이상 → 500원 단위
- raw_price: 12340
tick_size: 10
result: 12340
note: 이미 정규화됨 — 변경 없음
missing_policy:
raw_price: NO_TICK_PRICE — 해당 행 INVALID_TICK 처리
prohibition:
- 소수점 포함 가격을 TICK_NORMALIZER_V1 없이 플레이북에 기재 금지
- tick_size 오산출로 500원 단위 종목에 100원 단위 적용 금지
- 정규화 전 raw_price를 HTS 입력 가격으로 제시 금지
canonical_ref: spec/00_execution_contract.yaml:hard_stops.HS008_TICK_NORMALIZED_REQUIRED
version: 2026-05-18_AUDIT_RESPONSE_V2
owner: quant_team
lifecycle_state: active
input_fields:
- raw_price
output_fields:
- tick_normalized_price
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SATELLITE_FAILURE_GATE_V1:
purpose: '위성 포지션 전체 중 BROKEN/CLOSE_POSITION 비율이 임계값을 초과하면 TRIGGERED를 발동, 위성 전체
신규매수를 자동 차단하고 정리 대상 종목을 cashPreservePlan에 자동 포함한다. 개별 종목 판단의 합산이 아닌 ''집단 실패''
신호로 포트폴리오 전체를 방어한다.
'
applicable: calcApexExecutionHarness_ 내에서 포트폴리오 집계 후 실행.
inputs:
- field: satellite_holdings[].composite_verdict
unit: enum
- field: satellite_holdings[].rs_verdict
unit: enum
- field: satellite_holdings[].ret20d
unit: ratio
optional: true
- field: satellite_holdings[].excess_ret_10d
unit: pct
optional: true
trigger_conditions:
condA: rs_verdict=BROKEN 또는 composite_verdict=CLOSE_POSITION인 위성 수 >= 3
condB: composite_verdict IN [REDUCE_CANDIDATE, EXIT_REVIEW, CLOSE_POSITION]
비율 >= 60%
condC: 위성 평균 20D 수익률 <= -10% AND 평균 초과낙폭 >= 8%
trigger: condA OR condB OR condC
output:
field: sfg_v1
unit: enum [TRIGGERED, CLEAR]
additional_fields:
- sfg_reason: 트리거된 조건 코드
- sfg_broken_count: BROKEN/CLOSE_POSITION 위성 수
- sfg_failure_rate: 실패율 0.0~1.0
sfg_action:
TRIGGERED:
- '모든 위성 신규 BUY: BLOCKED (rag_v1 결과 무관)'
- 'composite_verdict=CLOSE_POSITION 위성: 매도 1순위 지정'
- 'composite_verdict=EXIT_REVIEW 위성: rebound_wait_qty 활성화'
CLEAR: 정상 판단 흐름 유지
clear_conditions:
- sfg_broken_count < 2
- sfg_failure_rate < 0.40
clear_conditions_note: 두 조건 모두 충족 시 TRIGGERED → CLEAR 해제. 1회 반등으로 해제 금지.
ground_truth: harness
llm_allowed: cite_only
prohibition:
- sfg_v1 = TRIGGERED 상태에서 LLM이 '이 위성은 괜찮으니 매수' 판단 금지
- sfg_broken_count를 LLM이 직접 집계 금지 — 하네스 출력값만 인용
- TRIGGERED 해제를 위한 조건 없이 '상황이 나아졌으니' 임의 해제 금지
canonical_ref: spec/13_formula_registry.yaml:COMPOSITE_VERDICT_V1
version: 2026-05-21_CLA_HARNESS_V1
owner: quant_team
lifecycle_state: active
input_fields:
- satellite_holdings[].composite_verdict
- satellite_holdings[].rs_verdict
- satellite_holdings[].ret20d
- satellite_holdings[].excess_ret_10d
output_fields:
- sfg_v1
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_CREATION_PURPOSE_LOCK_V1:
purpose: 현금 만들기 또는 위성 편입 재원 마련만을 이유로 코어/주도주 매도를 생성하지 못하게 한다.
inputs:
- field: composite_verdict
unit: enum
- field: rs_verdict
unit: enum
- field: brt_verdict
unit: enum
- field: excess_drawdown_pctp
unit: pct_points
optional: true
- field: recovery_ratio_20d
unit: ratio
optional: true
- field: sfg_v1
unit: enum
optional: true
valid_sell_reasons:
- composite_verdict IN [REDUCE_CANDIDATE, EXIT_REVIEW, CLOSE_POSITION]
- stop_breach_gate = BREACH
- rs_verdict = BROKEN 또는 brt_verdict = BROKEN
- excess_drawdown_pctp >= 10 AND recovery_ratio_20d < 0.50
- sfg_v1 = TRIGGERED
invalid_sell_reasons:
- cash_floor 미달 단독
- 섹터/클러스터 비중 초과 단독
- 위성 신규 편입 재원 확보
reinvestment_gate: SAQG_V1=ELIGIBLE AND RAG_V1=PASS AND 신규 후보가 매도 후보보다 기대값 우위일
때만 재투자 허용
output:
field: cash_creation_purpose_lock
additional_fields:
- sell_reason_validity
- reinvestment_allowed
ground_truth: harness
llm_allowed: cite_only
version: 2026-05-21_CCPL_V1
owner: quant_team
lifecycle_state: active
input_fields:
- composite_verdict
- rs_verdict
- brt_verdict
- excess_drawdown_pctp
- recovery_ratio_20d
- sfg_v1
output_fields:
- cash_creation_purpose_lock
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RECOVERY_OPTIMIZER_V1:
purpose: '목표 현금 회복액에 최소 주식가치 훼손으로 도달하는 최적 매도 조합을 결정론적 산출. LLM이 "63주+24주+19주+1주"
즉석 계산(HS011 위반) 재발 방지.
'
applicable: CASH_SHORTFALL_V1 및 H2 sell_priority 확정 후 실행.
inputs:
- field: cash_shortfall_target_krw
unit: KRW
note: G1 CASH_SHORTFALL_V1 확정값
- field: cash_shortfall_min_krw
unit: KRW
note: G1 확정값
- field: sell_candidates_json
unit: list
note: H2 regime_rank 순서
- field: immediate_sell_qty
unit: shares
note: K2 산출값 또는 holding_qty
- field: sell_limit_price
unit: KRW_per_share
- field: holding_qty
unit: shares
algorithm:
step1: H2 regime_rank 순서로 expected_krw = immediate_sell_qty × sell_limit_price
누적
step2: cumulative_krw >= cash_shortfall_min_krw 도달 시 중단
step3: shortfall 미달 시 다음 H2 순위 종목 추가
step4: 모두 소진 후 shortfall 잔여 시 EMERGENCY 경보 + emergency_full_sell 재판정
output:
field: cash_recovery_plan_json
schema:
target_krw: KRW
min_krw: KRW
plan_status: enum [SUFFICIENT, PARTIAL, EMERGENCY]
sell_sequence:
- ticker: 종목코드
qty: shares (정수)
limit_price: KRW_per_share
expected_krw: KRW
cumulative_krw: KRW
formula: CASH_RECOVERY_OPTIMIZER_V1
gap_remaining_krw: KRW
ground_truth: harness
llm_allowed: cite_only
prohibition:
- LLM이 '약 N원 필요하니 X주 팔자' 즉석 계산 금지 (HS011)
- sell_sequence[] 배열 임의 재정렬·종목 변경 금지
- plan_status=EMERGENCY이면 K2 emergency_full_sell 재판정 없이 전량매도 지시 금지
canonical_ref: AGENTS.md:Direction A2, G1, G2, H2
version: 2026-05-22_3RD_HARNESS
owner: quant_team
lifecycle_state: active
input_fields:
- cash_shortfall_target_krw
- cash_shortfall_min_krw
- sell_candidates_json
- immediate_sell_qty
- sell_limit_price
- holding_qty
output_fields:
- cash_recovery_plan_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SELL_WATERFALL_ENGINE_V1:
purpose: '"주식가치를 크게 훼손하지 않으면서 반등 시 수익까지 고려"하는 현금확보 매도 표준화. K2(50/50 분할)를 확장한 4단계
체계. CASH_RECOVERY_OPTIMIZER_V1과 연동.
'
applicable: CASH_RECOVERY_OPTIMIZER_V1 직후. 현금 부족 시 자동 발동.
inputs:
- field: cash_recovery_plan_json
unit: json
note: CASH_RECOVERY_OPTIMIZER_V1 산출
- field: emergency_full_sell
unit: boolean
note: K2 산출값
- field: oversold_gate
unit: enum
note: K2 oversold 판정
- field: rsi14
unit: score
- field: close
unit: KRW_per_share
- field: prev_close
unit: KRW_per_share
- field: atr20
unit: KRW_per_share
stage_logic:
stage_4_emergency:
condition: emergency_full_sell == true
action: H2 최우선 종목 전량 즉시 매도 (시장가 -1tick)
purpose: 마진콜·D+2 결제 위기 방지
stage_1_immediate_trim:
condition: emergency_full_sell == false
action: H2 1순위 50% 즉시 지정가 매도
limit_price_formula: 'prev_close - 0.3 * atr20 (OVERSOLD 구간: prev_close +
0.5 * atr20)'
prerequisite: SELL_PRICE_SANITY_V1 PASS 필수
stage_2_rebound_wait:
condition: stage_1 실행 후
action: 나머지 50% 반등 트리거 대기
rebound_trigger_price: prev_close + 0.5 * atr20 (tick 정규화)
rebound_tp_price: prev_close + 1.0 * atr20 (반등 수익 포착)
deadline: 3 영업일. 초과 시 stage_1 가격으로 자동 전환.
stage_3_cascading_trim:
condition: stage_1+2 후 cash_shortfall 잔여
action: H2 2순위→3순위 순서로 stage_1/2 반복
stop_condition: cumulative_krw >= cash_shortfall_min_krw
output:
field: waterfall_plan_json
schema:
current_stage: int 1~4
stage_label: enum [IMMEDIATE_TRIM, REBOUND_WAIT, CASCADING_TRIM, EMERGENCY_EXIT]
sell_sequence:
- ticker: 종목코드
stage: int
qty: shares
limit_price: KRW_per_share (stage2는 null)
rebound_trigger_price: KRW_per_share (stage2만)
rebound_tp_price: KRW_per_share (stage2만)
deadline: date (stage2만)
expected_immediate_krw: KRW
expected_rebound_tp_krw: KRW
total_recovery_potential_krw: KRW
ground_truth: harness
llm_allowed: cite_only
prohibition:
- waterfall_plan_json.sell_sequence 순서 임의 변경 금지
- stage 건너뜀 금지 (stage1→stage3 직행 금지)
- rebound_wait_qty를 '현금이 급하다'는 이유로 즉시 매도 전환 금지 (K2 연동)
- rebound_tp_price가 있으면 HTS 주문표에 '반등 익절가' 컬럼 필수 표기
canonical_ref: AGENTS.md:Direction C1, K2
version: 2026-05-22_3RD_HARNESS
owner: quant_team
lifecycle_state: active
input_fields:
- cash_recovery_plan_json
- emergency_full_sell
- oversold_gate
- rsi14
- close
- prev_close
- atr20
output_fields:
- waterfall_plan_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SELL_LOT_PARETO_SELECTOR_V1:
purpose: >
SELL_WATERFALL_ENGINE_V1의 동일 hard_precedence 단계 안에서 후보 lot을 점수화하고,
세금 회피 효과·반등 후 재진입 비용·놓친 상승분까지 포함한 다목적(Pareto) 비교로
동순위 후보 중 어느 lot을 먼저 매도할지 결정론적으로 선택한다.
(governance/todo/v8_9_p0_adoption_plan.yaml P0-2.1,
source: suggest/quant_investment_engine_v8_9_portfolio_optimizer_canonical_refactored.yaml:sell_and_cash_repair_optimizer_v8_9)
applicable: SELL_WATERFALL_ENGINE_V1의 동일 stage 내 후보가 2개 이상일 때.
inputs:
- field: avoided_tail_loss_krw
unit: KRW
- field: cash_repair_benefit_krw
unit: KRW
- field: concentration_reduction_benefit_krw
unit: KRW
- field: tax_loss_benefit_krw
unit: KRW
note: 손실 lot 매도 시 세금 절감 효과(tax-loss harvesting). 비과세 계좌는 0.
- field: tax_fee_slippage_krw
unit: KRW
- field: reentry_cost_krw
unit: KRW
note: 매도 후 동일·유사 종목 재진입 시 예상 거래비용·스프레드 비용.
- field: missed_upside_penalty_krw
unit: KRW
note: 매도하지 않았다면 얻었을 상승분 추정치. CE70_NET_PROFIT_KRW 분포가 있으면 그 값을 사용하고, 없으면 0(추정 금지).
expression: >
LOT_SELL_SCORE_KRW = avoided_tail_loss_krw + cash_repair_benefit_krw + concentration_reduction_benefit_krw
+ tax_loss_benefit_krw - tax_fee_slippage_krw - reentry_cost_krw - missed_upside_penalty_krw
output:
field: lot_sell_score_krw
unit: KRW
pareto_dominance_rule:
purpose: 동일 hard_precedence 단계 안에서 단일 점수만으로 비교하기 모호할 때 다목적 우위를 결정론적으로 판정.
objectives_maximize: [avoided_tail_loss_krw, cash_repair_benefit_krw, concentration_reduction_benefit_krw, tax_loss_benefit_krw]
objectives_minimize: [tax_fee_slippage_krw, reentry_cost_krw, missed_upside_penalty_krw]
dominates_if: >
candidate A가 모든 objectives_maximize 항목에서 B 이상이고 모든 objectives_minimize 항목에서 B 이하이며,
적어도 한 항목에서 A가 B보다 우월하면 A dominates B.
tie_breaker_if_no_dominance:
- lot_sell_score_krw 높은 순
- tax_fee_slippage_krw 낮은 순
- reentry_cost_krw 낮은 순
missing_policy:
missed_upside_penalty_krw: CE70_NET_PROFIT_KRW 분포 없으면 0 사용(추정 아님 — 보수적 하한). 0 사용 사실을 output에 명시.
tax_loss_benefit_krw: 계좌유형 미확인 시 0 (taxable 가정 금지, ISA/연금 비과세 가정도 금지 — DATA_MISSING 표기)
canonical_ref: spec/risk/portfolio_exposure.yaml:sell_priority_engine.candidate_scoring
implementation: tools/build_sell_waterfall_engine_v4.py
owner: quant_team
lifecycle_state: shadow
input_fields:
- avoided_tail_loss_krw
- cash_repair_benefit_krw
- concentration_reduction_benefit_krw
- tax_loss_benefit_krw
- tax_fee_slippage_krw
- reentry_cost_krw
- missed_upside_penalty_krw
output_fields:
- lot_sell_score_krw
golden_cases:
- V89_029_deconcentration_trim
- V89_030_profit_lock
- V89_031_tax_drag_too_high
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SMART_MONEY_LIQUIDITY_GATE_V1:
purpose: '스마트머니·유동성 차단 게이트. SM001(외국인+기관 동시 순매도→BLOCK_BUY), SM002(5일 평균 거래대금 <
50억→LIMIT_QUANTITY), SM003(RSI14>70 AND flow_credit<0.3→BLOCK_BUY) 결정론 구현. FINAL_JUDGMENT_GATE_V1의
J04 입력.
'
output:
file: Temp/smart_money_liquidity_gate_v1.json
expected_outputs:
- gate
- coverage_pct
- ticker_count
llm_allowed: cite_only
version: 2026-05-28_PHASE6
owner: quant_team
lifecycle_state: active
input_fields: []
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASHFLOW_STABILITY_GATE_V1:
purpose: 영업/잉여 현금흐름 및 회계 위험으로 현금흐름 안정성 게이트를 잠금.
inputs:
- field: operating_cf_krw
unit: KRW
optional: true
- field: free_cf_krw
unit: KRW
optional: true
- field: accrual_ratio_pct
unit: percent
optional: true
output:
field: cashflow_stability_json
llm_allowed: cite_only
version: 2026-05-25_PROPOSAL54
owner: quant_team
lifecycle_state: active
input_fields:
- operating_cf_krw
- free_cf_krw
- accrual_ratio_pct
output_fields:
- cashflow_stability_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SMART_CASH_RECOVERY_V3:
purpose: '국면별 동적 rebound_factor + 유동성 라벨(DEEP/NORMAL/THIN/FROZEN) 기반으로 선제매도 분할
방식(exec_mode)을 결정론적으로 산출한다. 설거지·지하실 매도를 차단하고 반등 수익을 포착한다. SCRS-V2 V3 확장판.
'
inputs:
- field: value_preservation_scorer_v1_json
unit: json
- field: scrs_v2_json
unit: json
- field: market_regime_state
unit: label
- field: macro_risk_regime
unit: label
- field: ATR20
unit: KRW_per_share
- field: AvgTradeValue_5D_M
unit: KRW_hundred_million
- field: Spread_Pct
unit: percent
output:
field: smart_cash_recovery_v3_json
expected_outputs:
- gate
- regime
- rebound_factor_atr
- distinct_exec_modes
llm_allowed: cite_only
version: 2026-05-27_PHASE1
owner: quant_team
lifecycle_state: active
input_fields:
- value_preservation_scorer_v1_json
- scrs_v2_json
- market_regime_state
- macro_risk_regime
- ATR20
- AvgTradeValue_5D_M
- Spread_Pct
output_fields:
- smart_cash_recovery_v3_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
LIQUIDITY_FLOW_SIGNAL_V1:
purpose: 'AvgTradeValue_20D_M 기반으로 종목별 유동성을 DEEP/NORMAL/THIN/FROZEN으로 분류하고 매도
실행 모드(MARKET_OK/LIMIT_NEAR_BID/TWAP_SPLIT/HOLD)를 결정한다.
'
output:
field: liquidity_flow_signal_v1_json
expected_outputs:
- gate
- label_diversity
- row_count
llm_allowed: cite_only
version: 2026-05-27_PHASE3
owner: quant_team
lifecycle_state: active
input_fields: []
output_fields:
- liquidity_flow_signal_v1_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASHFLOW_QUALITY_SIGNAL_V1:
purpose: 'OCF/FCF 기반 현금흐름 안정성을 결정론적으로 라벨링한다. ROBUST/STABLE/VOLATILE/RISKY/DATA_MISSING
라벨과 ACCOUNTING_RISK 플래그(OCF < NI 의심)를 산출한다.
'
output:
field: cashflow_quality_signal_v1_json
expected_outputs:
- gate
- accounting_risk_count
- data_missing_pct
llm_allowed: cite_only
version: 2026-05-27_PHASE2B
owner: quant_team
lifecycle_state: active
input_fields: []
output_fields:
- cashflow_quality_signal_v1_json
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
EXECUTION_METHOD_LADDER_V1:
purpose: '매도 실행 방식 계약표. NORMAL_LIQUIDITY / HIGH_LIQUIDITY_BREACH / OVERSOLD_REBOUND
/ EMERGENCY 의 order_type, split_count, trigger_rule 을 단일 표로 고정한다. LLM은 ladder를
재해석하지 않고 Temp/sell_execution_timing_lock_v2.json 과 Temp/sell_waterfall_engine_v2.json
을 복사 참조만 한다.
'
inputs:
- field: sell_timing_verdict
unit: enum
- field: sell_waterfall_gate
unit: enum
- field: smart_cash_recovery_gate
unit: enum
output:
file: Temp/execution_method_ladder_v1.json
expected_outputs:
- gate
- market_order_default_count
- emergency_full_sell_without_flag_count
llm_allowed: cite_only
version: 2026-06-06_PHASE6
owner: quant_team
lifecycle_state: active
input_fields:
- sell_timing_verdict
- sell_waterfall_gate
- smart_cash_recovery_gate
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CANONICAL_METRICS_V1:
purpose: 'spec/25_canonical_metrics_registry.yaml에 정의된 논리 지표(cluster_pct, cash_min_required_krw
등)를 단일 정규 원천에서 산출해 Temp/canonical_metrics_v1.json으로 제공. 렌더러가 여러 JSON 객체에서 같은
지표를 중복 읽어 불일치 값을 출력하는 버그를 차단한다(단일 진실원천 아키텍처).
'
input_fields:
- semiconductor_cluster_json.combined_pct
- cash_recovery_display_json.min_required_krw
- trim_plan_to_min_cash_json[].accumulated_krw
- scrs_v2_json.selected_combo[].immediate_qty
- prices_json[].profit_pct
- prices_json[].stop_price
- prices_json[].tp1_price
- proposal_reference_json[].proposed_limit_price_krw
- sell_quantities_json[].sell_qty
expected_outputs:
- metrics.cluster_pct
- metrics.cash_min_required_krw
- metrics.cash_reference_total_krw
- per_ticker.scrs_immediate_qty
- per_ticker.scrs_rebound_qty
- per_ticker.ticker_profit_pct
- per_ticker.ticker_stop_price
- per_ticker.ticker_limit_price
- per_ticker.ticker_base_qty
- per_ticker.ticker_tp1_price
- resolved_count
- unresolved
- gate
llm_allowed: cite_only
version: 2026-05-29_PHASE7
owner: quant_team
lifecycle_state: active
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
REGIME_CASH_UPLIFT_V1:
purpose: '국면별 최소 현금비율 상향값을 산출해 cash floor의 하한을 정한다.
'
inputs:
- field: market_regime
unit: enum
- field: market_risk_score
unit: score_0_10
output:
field: regime_cash_uplift_min_pct
input_fields:
- market_regime
- market_risk_score
expected_outputs:
- regime_cash_uplift_min_pct
llm_allowed: cite_only
version: 2026-05-30_PHASE8
owner: quant_team
lifecycle_state: active
output_fields:
- regime_cash_uplift_min_pct
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_FLOOR_V1:
purpose: '목표 현금비중과 현금 부족액의 최소 기준을 확정한다.
'
inputs:
- field: total_asset
unit: KRW
- field: settlement_cash_d2_krw
unit: KRW
- field: market_risk_score
unit: score_0_10
output:
field: cash_floor_min_pct
input_fields:
- total_asset
- settlement_cash_d2
- market_risk_score
expected_outputs:
- cash_floor_min_pct
- cash_shortfall_min_krw
- cash_shortfall_target_krw
llm_allowed: cite_only
version: 2026-05-30_PHASE8
owner: quant_team
lifecycle_state: active
output_fields:
- cash_floor_min_pct
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RAISE_PARETO_EXECUTOR_V2:
purpose: '현금 확보 매도에서 파레토 최적 종목·수량 조합을 산출한다.
'
input_fields:
- sell_candidates
- cash_shortfall_krw
- value_damage_weights
expected_outputs:
- pareto_sell_plan
- cash_raise_efficiency
llm_allowed: cite_only
version: 2026-06-03_ORPHAN_RECONCILE
owner: quant_team
lifecycle_state: active
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RAISE_VALUE_OPTIMIZER_V3:
purpose: '현금확보 매도의 가치 손실을 최소화하는 종목·수량·실행방식을 결정한다.
'
input_fields:
- sell_candidates
- cash_shortfall_krw
- rebound_potential
expected_outputs:
- optimized_sell_plan
- value_damage_pct
llm_allowed: cite_only
version: 2026-06-03_ORPHAN_RECONCILE
owner: quant_team
lifecycle_state: active
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RECOVERY_OPTIMIZER_V4:
purpose: 'TRIM 우선순위·K2 분할·반등 대기를 결합해 현금 회복 실행 계획을 산출한다.
'
input_fields:
- trim_candidates
- cash_shortfall_krw
- rebound_trigger_prices
expected_outputs:
- cash_recovery_plan
- expected_recovery_krw
llm_allowed: cite_only
version: 2026-06-03_ORPHAN_RECONCILE
owner: quant_team
lifecycle_state: active
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
CASH_RECOVERY_V1:
purpose: '현금 부족액 대비 단순 비례 매도 계획을 산출한다 (V4로 대체됨, 하위호환 유지).
'
input_fields:
- sell_candidates
- cash_shortfall_krw
expected_outputs:
- recovery_sell_qty
- recovery_krw
llm_allowed: cite_only
version: 2026-06-03_ORPHAN_RECONCILE
owner: quant_team
lifecycle_state: active
output_fields: []
missing_policy: DATA_MISSING. 계산 결과를 추정하지 않는다.
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
SELL_SLIPPAGE_BUDGET_FACTOR_V1:
purpose: 현금확보 매도 ADV 5% 참여율 한도 TWAP 분할 — 설거지·주식가치 훼손 최소화 (Direction VD1)
agents_md_ref: 'Direction VD1: VALUE_DAMAGE_RAW_GATE_V1 — TWAP 참여율 의무'
inputs:
- field: adv20
unit: KRW
note: 20일 평균 거래대금
- field: current_price
unit: KRW_per_share
- field: sell_qty
unit: shares
- field: emergency_full_sell
unit: boolean
optional: true
expression: max_child_qty = floor(adv20 * 0.05 / current_price); n_slices = ceil(sell_qty
/ max_child_qty); participation_rate = sell_qty * current_price / adv20
components:
adv_participation_cap:
value: 0.05
unit: ratio
calibration_status: EXPERT_PRIOR
note: ADV 5% 초과 단일 주문은 시장충격 위험. TWAP 분할 의무.
output:
max_child_qty: floor(ADV20 x 0.05 / price)
n_slices: ceil(qty / max_child_qty)
participation_rate: qty x price / ADV20
twap_required: participation_rate > 0.05
hard_override:
- condition: emergency_full_sell == true
action: TWAP 의무 면제 — 단, hts_limit_price 산출 의무 유지
gate:
INVALID_SELL_NO_LIMIT: hts_limit_price=null AND emergency_full_sell!=true
TWAP_REQUIRED: participation_rate > 0.05 AND emergency_full_sell!=true
missing_policy: adv20 미확인 시 TWAP_REQUIRED 보수적 적용
implementation: tools/build_value_preservation_scorer_v1.py:NF4
calibration_ref: spec/calibration_registry.yaml:NF4 (EXPERT_PRIOR)
version: 2026-06-04_NF4
owner: quant_team
lifecycle_state: active
input_fields:
- adv20
- current_price
- sell_qty
- emergency_full_sell
output_fields: []
golden_cases: []
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation
WEEKLY_LEGACY_TRANSFER_PLAN_V1:
purpose: >
주간 레거시종목→CMA 이전 계획(weekly_legacy_to_cma_transfer_plan_krw)을 입금이 실제로
확인되기 전까지는 deployable_cash_krw에 합산하지 않는다. 계획 단계(planned)와
확정 단계(confirmed)를 분리해 "이전될 돈을 이미 쓸 수 있는 돈"으로 취급하는 오류를 막는다.
(governance/todo/v8_9_p3_adoption_plan.yaml P3-E,
source: suggest/quant_investment_engine_v8_9_portfolio_optimizer_canonical_refactored.yaml:implementation_todo_v8_9.P3_sell_and_rebalance,
portfolio_policy_v8_9.operator_cashflow_config)
applicable: CASH_RATIOS_V1·DEPLOYABLE_CASH_KRW_V1 계산 직전. weekly_legacy_to_cma_transfer_plan_krw가 0보다 클 때.
inputs:
- field: weekly_legacy_to_cma_transfer_plan_krw
unit: KRW
default: 4000000
note: spec/risk/portfolio_exposure.yaml의 operator_cashflow_config 고정 계획값(월별 갱신).
- field: transfer_confirmed
unit: boolean
note: 실제 계좌 입금 확인 여부. 계획만으로는 false.
- field: transfer_confirmed_amount_krw
unit: KRW_or_null
note: 확인된 입금액. transfer_confirmed=false면 null.
rule: >
transfer_confirmed=false인 동안 weekly_legacy_to_cma_transfer_plan_krw는 deployable_cash_krw
계산에 포함되지 않는다(plan_status=PLANNED_NOT_DEPLOYABLE). transfer_confirmed=true가 되면
transfer_confirmed_amount_krw만 deployable_cash_krw에 합산한다(plan_status=CONFIRMED_DEPLOYABLE).
계획액과 확정액이 다르면 확정액을 우선한다(계획액으로 추정 보완 금지).
output:
field: deployable_cash_contribution_krw
unit: KRW
additional_outputs:
- plan_status
missing_policy: transfer_confirmed가 null이면 false로 간주(보수적 — 입금 미확인 상태와 동일 처리).
canonical_ref: spec/risk/portfolio_exposure.yaml:cash_floor
implementation: tools/build_weekly_legacy_transfer_plan_v1.py
owner: quant_team
lifecycle_state: shadow
input_fields:
- weekly_legacy_to_cma_transfer_plan_krw
- transfer_confirmed
- transfer_confirmed_amount_krw
output_fields:
- deployable_cash_contribution_krw
- plan_status
golden_cases:
- V89_005_deployable_cash_negative
activation_threshold:
min_t20_sample: 30
retirement_condition: performance_degradation