feat(kpi): include initial hedge capital in HODL benchmark calculation

This commit is contained in:
2025-12-21 11:36:13 +01:00
parent cc3b012087
commit e10e3062ff
2 changed files with 8 additions and 5 deletions

View File

@ -41,9 +41,9 @@ def initialize_kpi_csv():
"Fee_Coverage_Ratio"
])
def calculate_hodl_benchmark(initial_eth: Decimal, initial_usdc: Decimal, current_eth_price: Decimal) -> Decimal:
"""Calculates value if assets were just held."""
return (initial_eth * current_eth_price) + initial_usdc
def calculate_hodl_benchmark(initial_eth: Decimal, initial_usdc: Decimal, initial_hedge_usdc: Decimal, current_eth_price: Decimal) -> Decimal:
"""Calculates value if assets were just held (Wallet Assets + Hedge Account Cash)."""
return (initial_eth * current_eth_price) + initial_usdc + initial_hedge_usdc
def log_kpi_snapshot(
snapshot_data: Dict[str, float]
@ -51,7 +51,7 @@ def log_kpi_snapshot(
"""
Logs a KPI snapshot to CSV.
Expected keys in snapshot_data:
- initial_eth, initial_usdc
- initial_eth, initial_usdc, initial_hedge_usdc
- current_eth_price
- uniswap_pos_value_usd
- uniswap_fees_claimed_usd
@ -70,7 +70,8 @@ def log_kpi_snapshot(
# 1. Benchmark (HODL)
init_eth = Decimal(str(snapshot_data.get('initial_eth', 0)))
init_usdc = Decimal(str(snapshot_data.get('initial_usdc', 0)))
benchmark_val = calculate_hodl_benchmark(init_eth, init_usdc, price)
init_hedge = Decimal(str(snapshot_data.get('initial_hedge_usdc', 0)))
benchmark_val = calculate_hodl_benchmark(init_eth, init_usdc, init_hedge, price)
# 2. Strategy NAV (Net Asset Value)
# NAV = Uni Pos + Uni Fees (Claimed+Unclaimed) + Hedge Equity + (Wallet Surplus - Initial Wallet Surplus?)