> ## Documentation Index
> Fetch the complete documentation index at: https://kamino.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitor Position Health

> Monitor LTV, leverage, and liquidation risk of multiply positions

When a Multiply position is opened, Kamino's on-chain program immediately begins tracking and updating position health metrics. These metrics update with every transaction that affects the position and recalculate based on current collateral prices and debt accrual.

The protocol stores six core metrics that describe position size, leverage level, borrowing capacity, and liquidation risk.

### Position Health Metrics

| Metric              | Description                                                                                                                                                      |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Total Deposit**   | The total USD value of all collateral deposited into the position                                                                                                |
| **Total Borrow**    | The total USD value of debt owed on the position                                                                                                                 |
| **Net Value**       | Equity in the position. Calculated as Total Deposit - Total Borrow. Represents the value that would be received if all debt were repaid and collateral withdrawn |
| **Leverage**        | Capital amplification multiplier. 1x = no leverage (collateral only), 2x = borrowed amount equals deposit, 3x = borrowed twice the deposit amount                |
| **Borrow Limit**    | Maximum borrowing capacity before approaching liquidation threshold. Total Borrow must remain below this value                                                   |
| **Liquidation LTV** | The loan-to-value percentage at which the position becomes eligible for liquidation. Varies by asset pair and eMode settings                                     |

Leverage amplifies both gains and losses. When Current LTV approaches Liquidation LTV, the position risks partial liquidation. When borrow rates exceed collateral yield, Net APY turns negative and debt grows faster than earnings.

Regular monitoring enables integrations to alert users when conditions warrant position adjustment—whether through debt repayment, leverage reduction, or position closure.

***

## Get Position Health Metrics

<Tabs>
  <Tab title="SDK">
    <Steps>
      <Step>
        ### Import Dependencies

        Import the required packages for Solana RPC communication and Kamino SDK operations.

        ```typescript theme={null}
        import { createSolanaRpc, address } from '@solana/kit';
        import {
          KaminoMarket,
          parseKeypairFile,
          ObligationTypeTag,
          DEFAULT_RECENT_SLOT_DURATION_MS
        } from '@kamino-finance/klend-sdk';
        ```
      </Step>

      <Step>
        ### Load Market and Initialize RPC

        Load the keypair, initialize RPC connection, and load the xStocks market.

        ```typescript theme={null}
        const KEYPAIR_FILE = '/path/to/your/keypair.json';

        const signer = await parseKeypairFile(KEYPAIR_FILE);

        const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');

        const marketPubkey = address('5wJeMrUYECGq41fxRESKALVcHnNX26TAWy4W98yULsua'); // xStocks Market
        const market = await KaminoMarket.load(rpc, marketPubkey, DEFAULT_RECENT_SLOT_DURATION_MS);
        ```
      </Step>

      <Step>
        ### Fetch Multiply Obligations

        Retrieve all multiply obligations for the wallet address using the obligation type filter.

        ```typescript theme={null}
        const obligations = await market!.getUserObligationsByTag(
          ObligationTypeTag.Multiply,
          address(signer.address)
        );

        if (obligations.length === 0) {
          console.log('No multiply obligations found.');
        }
        ```

        <Note>
          `getUserObligationsByTag` filters obligations by type. For example, use `ObligationTypeTag.Multiply` to retrieve only multiply positions.
        </Note>

        <br />

        <div className="text-sm">
          **ObligationTypeTag Values:**

          | Type                         | Value & Description                         |
          | ---------------------------- | ------------------------------------------- |
          | `ObligationTypeTag.Vanilla`  | 0: Cross-collateral mode positions          |
          | `ObligationTypeTag.Multiply` | 1: Leveraged positions created via Multiply |
          | `ObligationTypeTag.Lending`  | 2: Lending-only positions                   |
          | `ObligationTypeTag.Leverage` | 3: Legacy leverage positions                |
        </div>
      </Step>

      <Step>
        ### Read Position Health Metrics

        Access the position health statistics from each obligation's `refreshedStats`.

        ```typescript theme={null}
        obligations.forEach((obligation) => {
          console.log(`\nObligation Address: ${obligation.obligationAddress}`);

          console.log(`Stats:`);
          console.log(`  Total Deposit: $${obligation.refreshedStats.userTotalDeposit.toFixed(2)}`);
          console.log(`  Total Borrow: $${obligation.refreshedStats.userTotalBorrow.toFixed(2)}`);
          console.log(`  Net Value: $${obligation.refreshedStats.userTotalDeposit.minus(obligation.refreshedStats.userTotalBorrow).toFixed(2)}`);
          console.log(`  Leverage: ${obligation.refreshedStats.leverage.toFixed(2)}x`);
          console.log(`  Borrow Limit: $${obligation.refreshedStats.borrowLimit.toFixed(2)}`);
          console.log(`  Liquidation LTV: ${obligation.refreshedStats.liquidationLtv.toFixed(2)}%`);
        });
        ```

        <Check>
          You now have access to all position health metrics including leverage, borrowing capacity, and liquidation thresholds.
        </Check>
      </Step>
    </Steps>
  </Tab>

  <Tab title="API">
    ```typescript theme={null}
    const walletAddress = 'your-wallet-address-here';
    const marketAddress = '5wJeMrUYECGq41fxRESKALVcHnNX26TAWy4W98yULsua'; // xStocks Market

    const response = await fetch(
      `https://api.kamino.finance/kamino-market/${marketAddress}/users/${walletAddress}/obligations`
    );

    const data = await response.json();

    if (data.length === 0) {
      console.log('No obligations found.');
    }

    data.forEach((obligation) => {
      console.log(`\nObligation Address: ${obligation.obligationAddress}`);
      console.log(`Type: ${obligation.humanTag}`);

      const stats = obligation.refreshedStats;
      console.log(`Stats:`);
      console.log(`  Total Deposit: $${parseFloat(stats.userTotalDeposit).toFixed(2)}`);
      console.log(`  Total Borrow: $${parseFloat(stats.userTotalBorrow).toFixed(2)}`);
      console.log(`  Net Value: $${(parseFloat(stats.userTotalDeposit) - parseFloat(stats.userTotalBorrow)).toFixed(2)}`);
      console.log(`  Leverage: ${parseFloat(stats.leverage).toFixed(2)}x`);
      console.log(`  Borrow Limit: $${parseFloat(stats.borrowLimit).toFixed(2)}`);
      console.log(`  Liquidation LTV: ${(parseFloat(stats.liquidationLtv) * 100).toFixed(2)}%`);
    });
    ```
  </Tab>
</Tabs>

***

## Liquidation LTV by Asset Pair

| Mode             | Asset Pair               | Liquidation LTV | Max Leverage |
| ---------------- | ------------------------ | --------------- | ------------ |
| **Standard**     | SOL / USDC               | 75%             | 4x           |
| **Standard**     | TSLAx / USDC             | 65%             | \~2.9x       |
| **eMode (Main)** | mSOL, bSOL, JupSOL / SOL | \~87%           | \~7.7x       |
| **eMode (Jito)** | JitoSOL / SOL            | 90%             | 10x          |
| **No eMode**     | JLP / USDC               | 67%             | \~3.2x       |

<Note>
  For detailed leverage calculations and eMode mechanics, see [LTV and Leverage Concepts](/docs/build/developers/multiply/data/concepts).
</Note>
