# Accounts

To get a list of Notional users, one can use this [subgraph query](https://docs.notional.finance/v3-technical-docs/subgraph-guides/notional-v3-subgraphs/fetch-notional-accounts) or use this [Dune query](https://dune.com/queries/2759293). &#x20;

## Get an account's balances

```
account = notional.getAccount(accountAddress)
```

## Fetch an account's positions in readable format

The following function can be used to make an account's balances more readable. This is especially useful when comparing an account's state before and after trading.

<pre><code>from datetime import datetime
<strong>
</strong><strong># CurrencyId to Symbol Mapping
</strong>CURRENCY_ID_TO_SYMBOL = {
    1: "ETH",
    2: "DAI",
    3: "USDC",
    4: "WBTC",
    5: "wstETH",
    6: "FRAX",
    7: "rETH",
    8: "USDT",
}

# This function can be used to make an account's positions readable.
def getAccountPositions(address):
        account = notional.getAccount(address)
        dict = {}
        dict['Account Address'] = address
        dict['Free collateral (ETH)'] = notional.getFreeCollateral(address)[0] / 1e8

        for i in account[1]:
            if i[0] != 0:
                symbol = CURRENCY_ID_TO_SYMBOL[i[0]]
                dict[symbol] = {
                    'p{} Balance'.format(symbol): i[1]/1e8,
                    'n{} Balance'.format(symbol): i[2]/1e8} 

        for j in account[2]:
            symbol = CURRENCY_ID_TO_SYMBOL[j[0]]
            if j[2] == 1:
                dict[symbol].update({'f{} {} {}'.format(symbol, j[1], datetime.fromtimestamp(j[1]).date()): j[3] / 1e8})
        return dict
</code></pre>

## Get an account's free collateral

If a user's free collateral is negative, then the user is eligible to get liquidated. If the user's free collateral figure is positive the account is sufficiently collateralized.

```
notional.getFreeCollateral(accountAddress)
```

## Get an account's Leveraged Vaults positions

Users can use the `getVaultAccount` methord to fetch an account's leveraged vault positions: &#x20;

<pre><code><strong>leveragedVaultAccount = notional.getVaultAccount(accountAddress, vaultAdderes)
</strong>accountVaultShares = leveragedVaultAccount["vaultShares"]/1e8
accountDebtInUnderlying = leveragedVaultAccount["accountDebtUnderlying"]/1e8
</code></pre>
