Skip to content
Archive
← r/hyperliquid1
1
100%
u/Resident_Anteater_35 1 day ago

Reading Hyperliquid account balances starts with the account mode

Before treating a Hyperliquid balance as available collateral, check the account mode. Standard mode keeps spot and perp balances separate. Unified account combines the balance for each asset across spot and relevant cross margin positions. The current docs also say that unified account and portfolio margin show balances and holds in spot clearinghouse state, and individual perp DEX user states are not meaningful in those modes. For an API integration, I'd keep the account mode alongside the balance data rather than infer it from an empty perps response. I wrote Part 2 of my Hyperliquid series with testnet account responses and UI examples: https://andreyobruchkov1996.substack.com/… How do you handle mode changes so cached balances aren't interpreted using the previous account model? Disclosure: I'm the author. AI helped prepare this Reddit post.
1 comments held Reddit says 0 on reddit ↗
  1. u/Helpful_Move9546 1 1 day ago
    Good question about caching after mode switches. I hit a similar wall when testing unified accounts and had old balances stuck showing as separate spot/perps numbers for a while. The cleanest way I found was to pull the account mode from the info endpoint on every refresh and use it as part of your cache key. That way a mode change invalidates everything rather than trying to map old data onto a new structure. Your post is a nice walkthrough of the actual responses you get back in each mode, the UI examples help a lot since the docs can be vague on what the payload actually looks like.