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

View File

@ -128,6 +128,7 @@ CLOSE_POSITION_ENABLED = True
OPEN_POSITION_ENABLED = True OPEN_POSITION_ENABLED = True
REBALANCE_ON_CLOSE_BELOW_RANGE = True REBALANCE_ON_CLOSE_BELOW_RANGE = True
TARGET_INVESTMENT_VALUE_USDC = 2000 TARGET_INVESTMENT_VALUE_USDC = 2000
INITIAL_HEDGE_CAPITAL_USDC = 2000 # Your starting Hyperliquid balance for Benchmark calc
RANGE_WIDTH_PCT = Decimal("0.01") # +/- 1% (2% total width) RANGE_WIDTH_PCT = Decimal("0.01") # +/- 1% (2% total width)
SLIPPAGE_TOLERANCE = Decimal("0.02") # do not change, or at least remember it ( 0.02 = 2.0% slippage tolerance) SLIPPAGE_TOLERANCE = Decimal("0.02") # do not change, or at least remember it ( 0.02 = 2.0% slippage tolerance)
TRANSACTION_TIMEOUT_SECONDS = 30 TRANSACTION_TIMEOUT_SECONDS = 30
@ -773,6 +774,7 @@ def main():
snapshot = { snapshot = {
'initial_eth': active_auto_pos.get('amount0_initial', 0), 'initial_eth': active_auto_pos.get('amount0_initial', 0),
'initial_usdc': active_auto_pos.get('amount1_initial', 0), 'initial_usdc': active_auto_pos.get('amount1_initial', 0),
'initial_hedge_usdc': INITIAL_HEDGE_CAPITAL_USDC,
'current_eth_price': float(current_price), 'current_eth_price': float(current_price),
'uniswap_pos_value_usd': float(current_pos_value_usd), 'uniswap_pos_value_usd': float(current_pos_value_usd),
'uniswap_fees_claimed_usd': 0.0, # Not tracked accumulated yet in JSON, using Unclaimed mainly 'uniswap_fees_claimed_usd': 0.0, # Not tracked accumulated yet in JSON, using Unclaimed mainly