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

user_state

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

Returns the raw on-chain state record — deposited USD margin, vault shares, per-pair positions (size, entry price, entry funding accumulator), pending vault unlocks, reserved margin, and open-order count — without computing derived equity, PnL, or liquidation prices. Use user_state_extended for those.

Signature

def user_state(self, user: Addr) -> UserState | None

Example

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 = info.user_state(Addr("0x..."))
if state is not None:
    print(state["margin"], state["open_order_count"])
    for pair_id, position in state["positions"].items():
        print(pair_id, position["size"], position["entry_price"])

Parameters

userAddr. The user's account address.

Returns

UserState | None — TypedDict with margin, vault shares, positions (by pair), unlocks, reserved margin, open-order count. None when the user has no on-chain margin record. See UserState.

See also