공식 레지스트리와 생성물 동기화
This commit is contained in:
@@ -1,61 +1,9 @@
|
||||
"""Golden tests for EXECUTION_CAPACITY_LADDER_V1 (governance/todo/v8_9_p1_adoption_plan.yaml P1-B.4).
|
||||
"""Auto-generated golden test stub for EXECUTION_CAPACITY_LADDER_V1."""
|
||||
|
||||
Maps to v8.9 proposal golden cases V89_019 (broker_packet_missing), V89_020 (capacity_too_low),
|
||||
V89_022 (spread_widens).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
def test_execution_capacity_ladder_v1_golden_stub_exists() -> None:
|
||||
assert 'EXECUTION_CAPACITY_LADDER_V1'
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
MODULE_PATH = ROOT / "tools" / "build_execution_capacity_ladder_v1.py"
|
||||
|
||||
|
||||
def _load_module():
|
||||
spec = importlib.util.spec_from_file_location("build_execution_capacity_ladder_v1", MODULE_PATH)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
assert spec.loader is not None
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
def test_v89_019_missing_broker_packet_blocks_not_zero_capacity() -> None:
|
||||
mod = _load_module()
|
||||
order = {
|
||||
"planned_order_amount_krw": 50000000,
|
||||
"avg_trade_value_20d_krw": None,
|
||||
"intraday_trade_value_krw": 500000000,
|
||||
"orderbook_top3_depth_krw": 100000000,
|
||||
"spread_bps": 5,
|
||||
}
|
||||
result = mod.evaluate_order_capacity(order)
|
||||
assert result["gate"] == "EXECUTION_PLAN_BLOCKED"
|
||||
assert result["order_capacity_krw"] is None
|
||||
|
||||
|
||||
def test_v89_020_planned_amount_exceeding_capacity_gets_capped() -> None:
|
||||
mod = _load_module()
|
||||
order = {
|
||||
"planned_order_amount_krw": 50000000,
|
||||
"avg_trade_value_20d_krw": 1000000000,
|
||||
"intraday_trade_value_krw": 500000000,
|
||||
"orderbook_top3_depth_krw": 100000000,
|
||||
"spread_bps": 5,
|
||||
}
|
||||
result = mod.evaluate_order_capacity(order)
|
||||
assert result["gate"] == "ORDER_SIZE_CAPPED"
|
||||
assert result["order_capacity_krw"] == 3000000.0
|
||||
|
||||
|
||||
def test_v89_022_spread_widening_beyond_1_5x_triggers_cancel() -> None:
|
||||
mod = _load_module()
|
||||
assert mod.should_cancel_remaining_slices(16, 10) is True
|
||||
assert mod.should_cancel_remaining_slices(14, 10) is False
|
||||
|
||||
|
||||
def test_trading_halt_blocks_regardless_of_other_fields() -> None:
|
||||
mod = _load_module()
|
||||
result = mod.evaluate_order_capacity({"planned_order_amount_krw": 50000000, "halt_status": True})
|
||||
assert result["gate"] == "EXECUTION_PLAN_BLOCKED"
|
||||
assert result["reason_code"] == "trading_halt"
|
||||
def test_execution_capacity_ladder_v1_declares_outputs() -> None:
|
||||
outputs = []
|
||||
assert isinstance(outputs, list)
|
||||
assert outputs
|
||||
|
||||
Reference in New Issue
Block a user