fix(total_asset): 총자산 3원천 불일치 수정 — GAS 2-pass 누락 및 stale 하네스 보정
1. GAS 2-pass 차등 재계산 (gdc_01_fetch_fundamentals.gs) - 구: settlementCashD2 + Naver주가 합산 → ISA·연금저축·CMA ~10.6M 누락 - 신: HTS 총액 기준으로 Naver-HTS 가격 델타만 반영해 비거래계좌 보존 - 효과: logDailyAssetHistory_ 값이 ~404.9M → ~413M으로 수정(GAS 재배포 후) 2. inject_computed_harness.py total_asset 정원(正源) 수정 - settings.total_asset_krw(HTS 캡처) 를 stale 하네스보다 우선 사용 - injected["total_asset_krw"] 추가 → 하네스 JSON 기록 396.8M→417M 수정 - 반도체 클러스터·포지션 가중치 계산 기준 일관화 3. compute_formula_outputs.py 사문(死文) 코드 정리 - holdings_value+cash_d2 계산 후 파일 미저장 문제 → settings 동기화로 대체 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -324,16 +324,13 @@ def main() -> int:
|
||||
sell_priority = raw.get("data", {}).get("sell_priority", []) or []
|
||||
core_satellite = raw.get("data", {}).get("core_satellite", []) or []
|
||||
|
||||
# ── TOTAL ASSET CALCULATION ─────────────────────────────────────────────
|
||||
# Sum market_value of all holdings + available_cash (if present in context)
|
||||
holdings_value = sum(float(r.get("market_value", 0) or 0) for r in account_snapshot if r.get("market_value"))
|
||||
|
||||
# Try to find cash in snapshot or context
|
||||
cash_d2 = float(hc.get("settlement_cash_d2_krw") or hc.get("available_cash") or 0)
|
||||
total_asset = holdings_value + cash_d2
|
||||
|
||||
hc["total_asset_krw"] = round(total_asset)
|
||||
hc["total_asset"] = round(total_asset)
|
||||
# ── TOTAL ASSET SYNC ────────────────────────────────────────────────────
|
||||
# settings.total_asset_krw (HTS 캡처)를 정원(正源)으로 동기화.
|
||||
# GAS 하네스가 stale일 때 hc 값이 낮게 유지되는 문제를 방지한다.
|
||||
_settings_total = float((raw.get("data") or {}).get("settings", {}).get("total_asset_krw") or 0)
|
||||
if _settings_total > 0:
|
||||
hc["total_asset_krw"] = round(_settings_total)
|
||||
hc["total_asset"] = round(_settings_total)
|
||||
|
||||
regime = str(hc.get("market_regime", "NEUTRAL"))
|
||||
|
||||
|
||||
@@ -855,8 +855,9 @@ def main() -> int:
|
||||
|
||||
# 공통 집계값
|
||||
total_asset = float(
|
||||
computed_harness.get("total_asset_krw") or
|
||||
hc.get("total_asset_krw") or
|
||||
computed_harness.get("total_asset_krw") or
|
||||
settings_map.get("total_asset_krw") or # HTS 캡처 기준(stale 하네스보다 최신)
|
||||
hc.get("total_asset_krw") or
|
||||
hc.get("total_asset") or 0
|
||||
)
|
||||
total_heat = float(hc.get("total_heat_pct") or 0)
|
||||
@@ -873,6 +874,10 @@ def main() -> int:
|
||||
log(SEP)
|
||||
|
||||
injected: dict[str, object] = {}
|
||||
# total_asset_krw를 정규화된 값으로 하네스에 기록 (stale GAS 값 덮어쓰기)
|
||||
if total_asset > 0:
|
||||
injected["total_asset_krw"] = round(total_asset)
|
||||
|
||||
fresh_captured_at = latest_snapshot_captured_at_iso(acct_snap)
|
||||
if fresh_captured_at:
|
||||
injected["captured_at"] = fresh_captured_at
|
||||
|
||||
Reference in New Issue
Block a user