meta:
  title: NF1~NF5 Python-harness 보조 공식 명세 golden cases
  note: 'GAS_REFERENCE_ONLY: Python 미러 없음. behavioral_coverage 체크 대상 외.'
  source_registry: spec/13_formula_registry.yaml:NF1~NF5
golden_cases_nf:
- formula_id: REGIME_CONDITIONAL_MACRO_FACTOR_V1
  gas_function: GAS_REFERENCE_ONLY
  python_function: GAS_REFERENCE_ONLY
  decision_critical: false
  cases:
  - id: nf1_export_fx_scale_up
    description: 수출주(삼성전자) — usd_krw_weak 1.2 배율
    inputs:
      base_macro_score: 10.0
      ticker: 005930
      ticker_type: export
    expected:
      macro_factor_applied: 12.0
    tolerance:
      macro_factor_applied: 0.01
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REGIME_CONDITIONAL_MACRO_FACTOR_V1
    note: 10.0 x 1.2 = 12.0
  - id: nf1_domestic_fx_scale_down
    description: 내수주 — usd_krw_weak 0.7 배율 축소
    inputs:
      base_macro_score: 10.0
      ticker: '010120'
      ticker_type: domestic
    expected:
      macro_factor_applied: 7.0
    tolerance:
      macro_factor_applied: 0.01
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REGIME_CONDITIONAL_MACRO_FACTOR_V1
    note: 10.0 x 0.7 = 7.0
  - id: nf1_neutral_no_change
    description: 중립 종목 — FX 배율 1.0
    inputs:
      base_macro_score: 15.0
      ticker: OTHER
      ticker_type: neutral
    expected:
      macro_factor_applied: 15.0
    tolerance:
      macro_factor_applied: 0.01
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REGIME_CONDITIONAL_MACRO_FACTOR_V1
    note: 15.0 x 1.0 = 15.0
  coverage_note: Python 미러 구현 없음 — spec 문서 목적 golden case
- formula_id: REBOUND_CAPTURE_THESIS_FACTOR_V1
  gas_function: GAS_REFERENCE_ONLY
  python_function: GAS_REFERENCE_ONLY
  decision_critical: false
  cases:
  - id: nf2_all_conditions_hit
    description: 4조건 모두 충족 — thesis_bonus=15.0
    inputs:
      rsi14: 32
      current_price: 95000
      ma20: 95000
      flow_credit: 0.65
      down_streak: 3
    expected:
      rebound_capture_hit: true
      thesis_bonus: 15.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REBOUND_CAPTURE_THESIS_FACTOR_V1
    note: rsi=32 IN[25,40], price<=ma20*1.03, flow=0.65>=0.5, streak=3>=2 -> bonus=15
  - id: nf2_rsi_too_high
    description: RSI > 40 — bonus=0
    inputs:
      rsi14: 55
      current_price: 95000
      ma20: 95000
      flow_credit: 0.65
      down_streak: 3
    expected:
      rebound_capture_hit: false
      thesis_bonus: 0.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REBOUND_CAPTURE_THESIS_FACTOR_V1
    note: rsi=55 > 40 -> 조건 불충족
  - id: nf2_price_above_ma20
    description: 가격 MA20+3% 초과 — bonus=0
    inputs:
      rsi14: 30
      current_price: 100000
      ma20: 90000
      flow_credit: 0.65
      down_streak: 3
    expected:
      rebound_capture_hit: false
      thesis_bonus: 0.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REBOUND_CAPTURE_THESIS_FACTOR_V1
    note: price=100000 > ma20*1.03=92700 -> 눌림목 미충족
  - id: nf2_flow_credit_low
    description: flow_credit 0.5 미만 — bonus=0
    inputs:
      rsi14: 30
      current_price: 92000
      ma20: 95000
      flow_credit: 0.3
      down_streak: 2
    expected:
      rebound_capture_hit: false
      thesis_bonus: 0.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:REBOUND_CAPTURE_THESIS_FACTOR_V1
    note: flow_credit=0.3 < 0.5 -> 설거지 위험
  coverage_note: Python 미러 구현 없음 — spec 문서 목적 golden case
- formula_id: ENTRY_TIMING_DECILE_FACTOR_V1
  gas_function: GAS_REFERENCE_ONLY
  python_function: GAS_REFERENCE_ONLY
  decision_critical: false
  cases:
  - id: nf3_insufficient_sample
    description: 표본 30 미만 — WATCH_PENDING_SAMPLE
    inputs:
      buy_timing_score: 50.0
      sample_n: 15
    expected:
      calibration_status: WATCH_PENDING_SAMPLE
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:ENTRY_TIMING_DECILE_FACTOR_V1
    note: sample_n=15 < 30 -> 실측 분위 캘리브레이션 불가
  - id: nf3_calibrated_status
    description: 표본 30 이상 — CALIBRATED_FROM_LEDGER
    inputs:
      buy_timing_score: 50.0
      sample_n: 100
    expected:
      calibration_status: CALIBRATED_FROM_LEDGER
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:ENTRY_TIMING_DECILE_FACTOR_V1
    note: sample_n=100 >= 30 -> 실측 분위 사용
  coverage_note: Python 미러 구현 없음 — spec 문서 목적 golden case
- formula_id: SELL_SLIPPAGE_BUDGET_FACTOR_V1
  gas_function: GAS_REFERENCE_ONLY
  python_function: GAS_REFERENCE_ONLY
  decision_critical: false
  cases:
  - id: nf4_twap_required
    description: ADV 5% 초과 — TWAP 분할 2회
    inputs:
      adv20: 5000000000
      current_price: 100000
      sell_qty: 3000
    expected:
      max_child_qty: 2500
      n_slices: 2
      participation_rate: 0.06
      twap_required: true
    tolerance:
      participation_rate: 0.001
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:SELL_SLIPPAGE_BUDGET_FACTOR_V1
    note: max_child=floor(5e9*0.05/100000)=2500; slices=ceil(3000/2500)=2; rate=0.06>0.05
  - id: nf4_single_order_ok
    description: ADV 5% 이하 — 단일 주문
    inputs:
      adv20: 10000000000
      current_price: 50000
      sell_qty: 500
    expected:
      max_child_qty: 10000
      n_slices: 1
      participation_rate: 0.0025
      twap_required: false
    tolerance:
      participation_rate: 0.0001
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:SELL_SLIPPAGE_BUDGET_FACTOR_V1
    note: max_child=10000; slices=ceil(500/10000)=1; rate=0.0025<=0.05
  coverage_note: Python 미러 구현 없음 — spec 문서 목적 golden case
- formula_id: PROFIT_GIVEBACK_RATCHET_FACTOR_V1
  gas_function: GAS_REFERENCE_ONLY
  python_function: GAS_REFERENCE_ONLY
  decision_critical: false
  cases:
  - id: nf5_apex_super_k1
    description: APEX_SUPER — k=1.0 타이트닝
    inputs:
      prev_trail_stop: 130000
      high_since_entry: 160000
      atr20: 5000
      profit_pct: 55.0
      market_regime: APEX_SUPER
    expected:
      trail_stop: 155000
      k_used: 1.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:PROFIT_GIVEBACK_RATCHET_FACTOR_V1
    note: candidate=160000-1.0*5000=155000; trail=max(130000,155000)=155000
  - id: nf5_profit_lock10_k25
    description: PROFIT_LOCK_10 — k=2.5
    inputs:
      prev_trail_stop: 95000
      high_since_entry: 115000
      atr20: 4000
      profit_pct: 15.0
      market_regime: PROFIT_LOCK_10
    expected:
      trail_stop: 105000
      k_used: 2.5
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:PROFIT_GIVEBACK_RATCHET_FACTOR_V1
    note: candidate=115000-2.5*4000=105000; trail=max(95000,105000)=105000
  - id: nf5_prev_trail_dominates
    description: prev_trail 우세 — 래칫 단방향 상승 원칙
    inputs:
      prev_trail_stop: 120000
      high_since_entry: 115000
      atr20: 3000
      profit_pct: 25.0
      market_regime: PROFIT_LOCK_20
    expected:
      trail_stop: 120000
      k_used: 2.0
    tolerance: {}
    provenance: HAND_COMPUTED
    spec_correct_src: spec/13_formula_registry.yaml:PROFIT_GIVEBACK_RATCHET_FACTOR_V1
    note: candidate=115000-2.0*3000=109000; trail=max(120000,109000)=120000(prev 유지)
  coverage_note: Python 미러 구현 없음 — spec 문서 목적 golden case
