estimate_max_withdrawal_commission

Documentation for eth_defi.hyperliquid.vault.estimate_max_withdrawal_commission function.

estimate_max_withdrawal_commission(withdrawal_amount, commission_rate)

Estimate the worst-case vault leader commission for a withdrawal.

Hyperliquid vault leaders earn a performance fee (typically 10%) on depositor profits. The fee is deducted at withdrawal time from the portion of the withdrawal that represents profit.

In the worst case — when the entire withdrawal consists of profit — the commission equals commission_rate * withdrawal_amount. In practice the commission is lower because only the profit portion is taxed.

Protocol vaults (HLP and children) have no commission, so commission_rate is None or zero for those.

The withdrawal_amount is always treated as a positive quantity. Hyperliquid withdrawal events store outflows as negative values (see VaultDepositEvent), so callers may pass a negative amount — abs() is applied internally.

Parameters
  • withdrawal_amount (decimal.Decimal) – USDC amount being withdrawn. Negative values are accepted and treated as their absolute value.

  • commission_rate (Optional[Union[decimal.Decimal, float]]) – Leader commission rate as a fraction (e.g. 0.1 or Decimal("0.1") for 10%). Accepts both float (as stored in VaultInfo.commission_rate from the Hyperliquid leaderCommission API field) and Decimal. None for protocol vaults with no fee.

Returns

Worst-case commission in USDC (always non-negative). Returns Decimal(0) when commission_rate is None or zero.

Return type

decimal.Decimal

See https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/vaults