UserVaultEquity

Documentation for eth_defi.hyperliquid.api.UserVaultEquity Python class.

class UserVaultEquity

Bases: object

A user’s equity position in a single Hypercore vault.

Returned by fetch_user_vault_equities().

Example — check whether a vault deposit can be withdrawn:

from eth_defi.hyperliquid.api import fetch_user_vault_equity
from eth_defi.hyperliquid.session import create_hyperliquid_session

session = create_hyperliquid_session()
eq = fetch_user_vault_equity(session, user="0xAbc...", vault_address="0xDef...")
if eq is not None:
    if eq.is_lockup_expired:
        print(f"Withdrawal ready — {eq.equity} USDC available")
    else:
        print(f"Locked for another {eq.lockup_remaining}")

Attributes summary

vault_address

Hypercore vault address

equity

USDC equity in the vault

locked_until

UTC datetime until which withdrawals are locked.

is_lockup_expired

Whether the lock-up period has passed and withdrawal is allowed.

lockup_remaining

Time remaining until the lock-up expires.

Methods summary

__init__(vault_address, equity, locked_until)

vault_address: eth_typing.evm.HexAddress

Hypercore vault address

equity: decimal.Decimal

USDC equity in the vault

locked_until: datetime.datetime

UTC datetime until which withdrawals are locked.

User-created vaults have a 1 day lock-up, protocol vaults (HLP) have 4 days.

property is_lockup_expired: bool

Whether the lock-up period has passed and withdrawal is allowed.

Compares locked_until against the current UTC time.

Returns

True if the current time is at or past the lock-up deadline.

property lockup_remaining: datetime.timedelta

Time remaining until the lock-up expires.

Returns timedelta(0) if the lock-up has already expired.

Returns

Remaining lock-up duration (never negative).

__init__(vault_address, equity, locked_until)
Parameters
Return type

None