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 | NoneExample
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
user — Addr. 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
user_state_extended— same plus computed equity / PnL / liquidation priceorders_by_user— open orders for the user