> For the complete documentation index, see [llms.txt](https://docs.keystonefi.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keystonefi.xyz/keystone-finance/check-position.md).

# Check Position & NAV

Query your `ksUSD` balance, the current share price, and the vault's NAV.

***

## Your position

```ts
import { PublicKey } from "@solana/web3.js";
import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token";

const [vaultPda] = PublicKey.findProgramAddressSync(
  [Buffer.from("vault")],
  PROGRAM_ID
);

const vault = await program.account.vault.fetch(vaultPda);
const userKsusdAta = getAssociatedTokenAddressSync(vault.ksusdMint, user.publicKey);
const ksusdAccount = await getAccount(connection, userKsusdAta);

const shares = BigInt(ksusdAccount.amount.toString());
console.log("Your ksUSD:", Number(shares) / 1e6);   // 6 decimals
```

***

## Current share price

```ts
// Mirrors the on-chain Vault::share_price_1e9() helper.
const cachedNav = BigInt(vault.cachedNavUsdc.toString());
const queuePending = BigInt(vault.queuePendingUsdc.toString());
const reserveFund = BigInt(vault.reserveFundUsdc.toString());
const totalShares = BigInt(vault.totalShares.toString());

const effectiveNav = cachedNav - queuePending - reserveFund;       // share-price basis
const sharePrice1e9 = totalShares === 0n
  ? 1_000_000_000n
  : (effectiveNav * 1_000_000n) / totalShares;                     // 1e9-scaled

const sharePriceUsdc = Number(sharePrice1e9) / 1e9;                // dollars per ksUSD
console.log("Share price:", sharePriceUsdc.toFixed(6));
```

* Initial share price: **`1.000000`**
* Drifts up monotonically as carry accrues (drawdowns excepted)
* Performance fees charged only on net-new gains above the prior high-water mark (`hwm_share_price_1e9` on the vault)

***

## Your USDC-equivalent value

```ts
const yourUsdc = (shares * BigInt(Math.round(sharePrice1e9))) / 1_000_000_000n;
console.log("Withdrawable USDC:", Number(yourUsdc) / 1e6);
```

***

## Vault-level NAV

```ts
console.log("Cached NAV (USDC):       ", Number(vault.cachedNavUsdc.toString()) / 1e6);
console.log("Effective NAV (USDC):    ", Number(effectiveNav) / 1e6);
console.log("Queue pending (USDC):    ", Number(vault.queuePendingUsdc.toString()) / 1e6);
console.log("Reserve fund (USDC):     ", Number(vault.reserveFundUsdc.toString()) / 1e6);
console.log("Total shares (ksUSD):    ", Number(vault.totalShares.toString()) / 1e6);
console.log("Position mode:           ", vault.positionMode);   // Idle / Normal / Reverse / WindDown
console.log("Liquidity buffer bps:    ", vault.liquidityBufferBps);
console.log("Last settle ts:          ", new Date(Number(vault.lastSettleTs) * 1000));
console.log("Last NAV attest ts:      ", new Date(Number(vault.lastNavAttestTs) * 1000));
console.log("Funding EMA (bps):       ", vault.fundingAprSmoothedBps);
console.log("Peak share price 1e9:    ", vault.peakSharePrice1e9.toString());
console.log("HWM share price 1e9:     ", vault.hwmSharePrice1e9.toString());
console.log("Paused:                  ", vault.paused);
```

* `cached_nav_usdc` refreshes on every: deposit · withdrawal · fee collection · `settle` / `attest_nav` crank
* Between cranks → reflects the last on-chain snapshot
* Live unrealized P\&L on Drift accrues into the next refresh

***

## Pending queued withdrawal (if any)

```ts
// Derive your most recent withdrawal request PDA.
const [requestPda] = PublicKey.findProgramAddressSync(
  [
    Buffer.from("withdrawal_request"),
    vaultPda.toBuffer(),
    new BN(myRequestId).toArrayLike(Buffer, "le", 8),  // recorded when you called request_withdrawal
  ],
  PROGRAM_ID
);

const req = await program.account.withdrawalRequest.fetchNullable(requestPda);
if (req) {
  console.log("USDC owed:    ", Number(req.usdcOwed.toString()) / 1e6);
  console.log("Requested at: ", new Date(Number(req.requestedTs) * 1000));
  console.log("Processed:    ", req.processed);
}
```

PDA closes (and rent refunds) once the keeper calls `process_withdrawal`.

***

## Related

* [Deposit](/keystone-finance/deposit.md) · [Withdraw](/keystone-finance/withdraw.md)
* [NAV & share pricing](/reference/nav-calculation.md)
* [Account structure](/for-developers/accounts.md) — full `Vault` and `WithdrawalRequest` layouts
* [Events](/for-developers/events.md) — programmatic subscription to NAV-changing events


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keystonefi.xyz/keystone-finance/check-position.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
