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

# Get Market Metrics

> Read live pool metrics directly from the market contract

Returns current liquidity, borrows, utilization, rates, and liquidation counters read from the chain at request time. This is the endpoint to poll for a live market dashboard.

## Path Parameters

<ParamField path="marketId" type="string" required>Market ID.</ParamField>

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="isOnChain" type="boolean">Whether the contract read succeeded. When `false`, every other field is a placeholder and must not be displayed as real data.</ResponseField>
    <ResponseField name="paused" type="boolean">Whether the market contract is paused.</ResponseField>
    <ResponseField name="liquidationContract" type="string">Liquidation router the market is wired to, or `null` if unreadable.</ResponseField>
    <ResponseField name="totalDeposits" type="string">Total supplied liquidity, in borrow asset units.</ResponseField>
    <ResponseField name="totalBorrows" type="string">Total outstanding principal, in borrow asset units.</ResponseField>
    <ResponseField name="availableLiquidity" type="string">Liquidity available for new borrows, in borrow asset units.</ResponseField>
    <ResponseField name="utilizationRate" type="string">Utilization in basis points. `2500` is 25 percent.</ResponseField>
    <ResponseField name="borrowRate" type="string">Annualized borrow rate in basis points.</ResponseField>
    <ResponseField name="supplyRate" type="string">Annualized supply rate in basis points, net of the 25 percent reserve factor.</ResponseField>
    <ResponseField name="totalShares" type="string">Total LP shares outstanding, always formatted at 18 decimals regardless of the borrow asset.</ResponseField>
    <ResponseField name="totalCollateral" type="string">Total collateral locked, in collateral token units.</ResponseField>
    <ResponseField name="activeLoans" type="integer">Loans currently in `ACTIVE` status.</ResponseField>
    <ResponseField name="totalLoansCreated" type="integer">Lifetime loan counter from the contract.</ResponseField>
    <ResponseField name="activeAuctions" type="integer">Dutch auctions currently accepting bids.</ResponseField>
    <ResponseField name="totalAuctions" type="integer">Lifetime auction counter from the contract.</ResponseField>
    <ResponseField name="pendingLiquidations" type="integer">Liquidations seized but not yet settled or written off.</ResponseField>
    <ResponseField name="pendingLiquidationDebt" type="string">Debt awaiting settlement proceeds, in borrow asset units.</ResponseField>
  </Expandable>
</ResponseField>

<Warning>
  When the RPC is unavailable the endpoint returns `200` with `isOnChain: false` rather than an error status. Branch on `isOnChain` before rendering any figure.
</Warning>

## Rate Derivation

`borrowRate` is taken from the market's interest model when the contract reports a non-zero rate, and computed from the current utilization curve otherwise. `supplyRate` is always derived as `borrowRate * utilization * 0.75`, reflecting the protocol reserve factor of 25 percent. Both are basis points, so divide by 100 to get a percentage.

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.trusset.org/lending-external-securities/api/markets/{marketId}/metrics" \
    -H "X-API-Key: trusset_your_key_here"
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities/api/markets/${marketId}/metrics`,
    { headers: { 'X-API-Key': 'trusset_your_key_here' } }
  );
  const { data } = await res.json();
  if (!data.isOnChain) throw new Error('Market metrics unavailable');
  console.log(`Borrow APR ${(Number(data.borrowRate) / 100).toFixed(2)}%`);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "isOnChain": true,
      "paused": false,
      "liquidationContract": "0x067a3FeEA46649AdAd8e31c33B3a4D8774b8d8cF",
      "totalDeposits": "1000000.000000",
      "totalBorrows": "250000.000000",
      "availableLiquidity": "750000.000000",
      "utilizationRate": "2500",
      "borrowRate": "450",
      "supplyRate": "84",
      "totalShares": "1000000.000000000000000000",
      "totalCollateral": "5000.000000000000000000",
      "activeLoans": 4,
      "totalLoansCreated": 11,
      "activeAuctions": 0,
      "totalAuctions": 0,
      "pendingLiquidations": 0,
      "pendingLiquidationDebt": "0.000000"
    }
  }
  ```

  ```json Response - Chain Unavailable theme={null}
  {
    "success": true,
    "data": {
      "isOnChain": false,
      "totalDeposits": "0",
      "totalBorrows": "0",
      "availableLiquidity": "0",
      "utilizationRate": "0",
      "borrowRate": "200",
      "supplyRate": "0",
      "pendingLiquidations": 0,
      "pendingLiquidationDebt": "0"
    }
  }
  ```

  ```json Error - No Address theme={null}
  {
    "success": false,
    "error": {
      "code": "NO_MARKET_ADDRESS",
      "message": "No on-chain address"
    }
  }
  ```
</ResponseExample>
