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_rateisNoneor zero for those.The
withdrawal_amountis always treated as a positive quantity. Hyperliquid withdrawal events store outflows as negative values (seeVaultDepositEvent), 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.1orDecimal("0.1")for 10%). Accepts bothfloat(as stored inVaultInfo.commission_ratefrom the HyperliquidleaderCommissionAPI field) andDecimal.Nonefor protocol vaults with no fee.
- Returns
Worst-case commission in USDC (always non-negative). Returns
Decimal(0)whencommission_rateisNoneor zero.- Return type
See https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/vaults