Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

UserState

A user's deposited margin, vault shares, open positions, and pending unlocks.

Definition

class UserState(TypedDict):
    margin: UsdValue
    vault_shares: Uint128
    positions: dict[PairId, Position]
    unlocks: list[Unlock]
    reserved_margin: UsdValue
    open_order_count: int

Fields

marginUsdValue. Total deposited margin in USD (6-decimal string).

vault_sharesUint128. LP shares held by this user.

positionsdict[PairId, Position]. Open positions, keyed by pair.

unlockslist[Unlock]. Pending vault withdrawals awaiting cooldown.

reserved_marginUsdValue. Margin locked behind open orders.

open_order_countint. Number of resting limit orders.

Construction

from dango.info import Info
from dango.utils.constants import MAINNET_API_URL
from dango.utils.types import Addr
 
info = Info(MAINNET_API_URL, skip_ws=True)
state: dict | None = info.user_state(Addr("0x..."))

See also