af1236202d
- F14: late_chase_risk_score 검증 * GAS가 유일한 생산처 (Python canonical 없음) * migration_action: KEEP_IN_GAS로 정정, status: DONE - F02/F03/F04/F06: priceBasis 로직 포팅 * formulas/price_basis_v1.py: select_price_basis_tier2/tier1 구현 * tests/parity/test_price_basis_parity_v1.py: 8 parity 테스트 (모두 PASS) * GAS Number.isFinite() 의미론 정확히 재현 (math.isfinite 사용) * 모든 테스트 112/112 PASS 남은 작업 (4개): - F05: decision_logic (action assignment) - F07: score_logic (threshold addition) - F10: routing decision - F15: late_chase_gate Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""WBS-7.3 부속(2026-06-22) — classifyOrderType_ GAS→Python 포팅.
|
|
|
|
원본: src/gas_adapter_parts/gdf_03_portfolio_gates.gs:classifyOrderType_
|
|
(F11, governance/gas_logic_migration_ledger_v1.yaml — "critical path: must
|
|
match validate_stop_loss_policy_v1 spec"). 보유종목의 손절(stop_breach)
|
|
신호가 다른 모든 매매신호보다 우선한다는 결정 로직.
|
|
|
|
이 함수는 GAS 원본을 line-by-line 그대로 옮긴 것이며, 동작이 다르면
|
|
tests/parity/test_classify_order_type_parity_v1.py가 즉시 GAS 원본과
|
|
대조해 잡아낸다(Node로 GAS 소스를 직접 실행해 비교 — 추정 포팅 아님).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def classify_order_type(signal_code: str, holding: dict[str, Any] | None) -> str:
|
|
if holding and holding.get("stopBreach"):
|
|
return "STOP_LOSS"
|
|
if "BUY" in signal_code:
|
|
return "BUY"
|
|
if any(token in signal_code for token in ("EXIT", "SELL", "TRIM", "ROTATE")):
|
|
return "SELL"
|
|
if signal_code == "HOLD":
|
|
return "HOLD"
|
|
return "WATCH"
|