---
title: getAccountContext
description: Load a trade context plus the account's SV3 position, free collateral, and borrow capacity.
---

> **For AI agents:** the complete documentation index is at [llms.txt](/llms.txt). Append `.md` to any page URL for its markdown version.

Same block-pinned multicall as [getTradeContext](/developers/get-trade-context), plus the personal position used by borrow, expand, shrink, and surrender quotes.

## Import

```ts
import { createSv3Client } from "@repo/contract-client";
```

## Usage

```ts
import { quoteBorrow, getMaxActions } from "@repo/contract-client/math";
import { parseUsdc } from "@repo/contract-client";

const account = await sv3.market.getAccountContext(market, owner);

account.position.collateralAvm;
account.position.debtRaw;
account.freeCollateral;
account.borrowCapacity;

const max = getMaxActions(account.snapshot, account.position, account.reserveBalance);
const quote = quoteBorrow(account.snapshot, account.position, parseUsdc("10"));
```

`sv3.position.get(market, owner)` returns only the position. `sv3.position.getMaxActions(market, owner)` loads this context and runs `getMaxActions` for you.

## Return Value

`Promise<AccountContext>` — a `TradeContext` plus:

| Field            | Meaning                                                |
| ---------------- | ------------------------------------------------------ |
| `position`       | `{ owner, collateralAvm, debtRaw }`                    |
| `freeCollateral` | AVM that is not locking debt                           |
| `borrowCapacity` | Additional USDC that can be drawn at the current floor |

## Parameters

### market

- **Type:** `Address`

```ts
const account = await sv3.market.getAccountContext(market, owner);
```

### owner

- **Type:** `Address`

Position owner. Usually the connected wallet.

```ts
const account = await sv3.market.getAccountContext(market, "0x…");
```

## Tips

- An empty position is still a valid object (`collateralAvm = 0n`, `debtRaw = 0n`). You do not need a null check before `quoteBorrow`.
- Size tickets with [getMaxActions](/developers/math/get-max-actions) so the slider cannot exceed capacity, pause, or min settlement.
