스냅샷 어드민 웹 UI + WBS-7.10 Tabler 테이블 그리드 조회
settings/account_snapshot SQLite를 직접 편집하는 잠금/승인/변경이력 기반 웹 에디터를 추가하고, 2026-06-21 비판적 리뷰에서 요청된 테이블별 그리드 조회 기능(Tabler CDN)을 /tables 경로로 덧붙인다. - 잠금(lock)·승인(approval)·undo·변경로그 전체 감사 추적 - KIS Collection 대시보드 통합(별도 SQLite, 워크스페이스 DB와 분리) - WBS-7.10: 워크스페이스/KIS수집/정성매도전략 3개 SQLite, 11개 테이블을 Tabler 그리드로 조회 — 테이블명은 고정 화이트리스트와 정확히 일치할 때만 SQL에 사용(SQL 인젝션 방지, 단위테스트로 검증)
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
from src.quant_engine.snapshot_admin_store_v1 import (
|
||||
DEFAULT_DB,
|
||||
DEFAULT_SEED_JSON,
|
||||
import_seed_json,
|
||||
load_account_snapshot_rows,
|
||||
load_settings_rows,
|
||||
parse_account_snapshot_tsv,
|
||||
validate_account_snapshot_rows,
|
||||
validate_settings_rows,
|
||||
write_export_json,
|
||||
)
|
||||
|
||||
OUT = ROOT / "Temp" / "snapshot_admin_workflow_v1.json"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
db_path = DEFAULT_DB
|
||||
seed_path = DEFAULT_SEED_JSON
|
||||
summary = import_seed_json(db_path, seed_path)
|
||||
settings_rows = load_settings_rows(db_path)
|
||||
snapshot_rows = load_account_snapshot_rows(db_path)
|
||||
settings_errors = validate_settings_rows(settings_rows)
|
||||
snapshot_errors = validate_account_snapshot_rows(snapshot_rows)
|
||||
exported = write_export_json(db_path, ROOT / "Temp" / "snapshot_admin_export_v1.json")
|
||||
tsv_rows = parse_account_snapshot_tsv(
|
||||
"\n".join(
|
||||
[
|
||||
"captured_at\taccount\taccount_type\tticker\tname\tholding_quantity\tavailable_quantity\taverage_cost\ttotal_cost\tcurrent_price\tmarket_value\tprofit_loss\treturn_pct\timmediate_cash\tsettlement_cash_d2\tavailable_cash\topen_order_amount\tmonthly_contribution_limit\tmonthly_contribution_used\tparse_status\tuser_confirmed\tstop_price\thighest_price_since_entry\tentry_date\tentry_stage\tposition_type\tlast_updated",
|
||||
"2026-06-21T09:00:00+09:00\treal\t일반계좌\t005930\t삼성전자\t10\t10\t70000\t700000\t71000\t710000\t10000\t1.43\t1000000\t1000000\t1000000\t0\t\t\tCAPTURE_READ_OK\tY\t65000\t72000\t2026-06-01\tstage_1\tcore\t2026-06-21T09:05:00+09:00",
|
||||
]
|
||||
)
|
||||
)
|
||||
payload = {
|
||||
"status": "PASS",
|
||||
"db_path": str(db_path),
|
||||
"seed_path": str(seed_path),
|
||||
"summary": summary,
|
||||
"settings_rows": len(settings_rows),
|
||||
"account_snapshot_rows": len(snapshot_rows),
|
||||
"settings_errors": settings_errors,
|
||||
"snapshot_errors": snapshot_errors,
|
||||
"export_path": str(exported),
|
||||
"tsv_parse_rows": len(tsv_rows),
|
||||
}
|
||||
OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
OUT.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
||||
if settings_errors or snapshot_errors:
|
||||
print("FAIL")
|
||||
return 1
|
||||
print("PASS")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user