feat(cli): trex-core slots 에 --symbol/--slot-id 필터 + 필터 시 상세 출력

운영자 CLI 의 slots 조회 편의: --symbol, --slot-id 클라이언트 측 필터(--status 와
조합 가능) 추가. 두 필터 중 하나라도 주면 한 줄 요약 대신 슬롯 상세 블록
(status/symbol/portfolio_id/qty/avg_price/limit/allocated_capital/strategy_id/
sell_strategy_id/forced_close_at/universe_detached, holding 이면 watchdog)으로 출력.
필터 없으면 기존 terse 테이블 유지(무회귀).

구조/계약/런타임 흐름 영향 없는 표시 기능. tests/runtime/test_cli_operator.py
필터 4건 추가(24 passed), ruff clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 16:55:24 +09:00
co-authored by Claude Opus 4.8
parent c04fd276b3
commit d334f34215
2 changed files with 88 additions and 7 deletions
+34
View File
@@ -92,6 +92,40 @@ def test_slots_status_filters_by_slot_status(capsys):
assert "count=1" in out and "S-1\tholding" in out and "S-2" not in out
def test_slots_symbol_filters_to_one_symbol(capsys):
"""`--symbol` shows only the slot(s) bound to that symbol (client-side filter)."""
rpc = _RpcRecorder(_SNAPSHOT)
cli.main(["slots", "--symbol", "005930"], rpc=rpc)
out = capsys.readouterr().out
assert "count=1" in out and "S-1" in out and "S-2" not in out
def test_slots_symbol_combines_with_status(capsys):
"""`--symbol` composes with `--status` (both must match)."""
rpc = _RpcRecorder(_SNAPSHOT)
cli.main(["slots", "--status", "holding", "--symbol", "999999"], rpc=rpc)
out = capsys.readouterr().out
assert "count=0" in out # S-1 is holding but symbol != 999999
def test_slots_slot_id_filters_to_one_slot(capsys):
"""`--slot-id` shows only the matching slot, in the detailed block."""
rpc = _RpcRecorder(_SNAPSHOT)
cli.main(["slots", "--slot-id", "S-2"], rpc=rpc)
out = capsys.readouterr().out
assert "count=1" in out and "slot S-2" in out and "S-1" not in out
# detailed block fields present
assert "portfolio_id" in out and "universe_detached" in out
def test_slots_symbol_detailed_output(capsys):
"""`--symbol` switches to the detailed per-slot block (not the terse table)."""
rpc = _RpcRecorder(_SNAPSHOT)
cli.main(["slots", "--symbol", "005930"], rpc=rpc)
out = capsys.readouterr().out
assert "slot S-1" in out and "status" in out and "avg_price" in out
def test_slots_marks_watchdog_owned(capsys):
"""dcy-017: slots flags strategy-absent (watchdog-owned) positions."""
resp = {