Skip to main content

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.

Reading Market Data

Retrieve market metrics, reserve information, and TVL data using the Kamino SDK and API.
Historical market data is only available via the API.
1

Get Market Info

Retrieves real-time market-wide metrics including total deposits and borrows TVL across all reserves.
Using the SDK requires a private RPC connection or the public rate-limited RPC endpoint.
getMarketInfo
import { createSolanaRpc, address } from "@solana/kit";
import { KaminoMarket } from "@kamino-finance/klend-sdk";

const slotDuration = 400; // ms
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const marketPubkey = address("7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF");

const market = await KaminoMarket.load(rpc, marketPubkey, slotDuration);

console.log({
  deposits: market!.getTotalDepositTVL(),
  borrows: market!.getTotalBorrowTVL(),
});
View Code
2

Get Reserve Info

Queries detailed information for all reserves in the market including deposit/borrow TVL, APY rates, and utilization ratios.
getReserveInfo
import { createSolanaRpc, address } from "@solana/kit";
import { KaminoMarket } from "@kamino-finance/klend-sdk";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const marketPubkey = address("DxXdAyU3kCjnyggvHmY5nAwg5cRbbmdyX3npfDMjjMek");

const slotDuration = 400; // ms
const slot = await rpc.getSlot().send();

const market = await KaminoMarket.load(rpc, marketPubkey, slotDuration);

for (const reserve of market!.getReserves()) {
  console.log(`Reserve ${reserve.symbol}:`);
  console.log(`  Deposit TVL: ${reserve.getDepositTvl().toFixed(2)}`);
  console.log(`  Borrow TVL: ${reserve.getBorrowTvl().toFixed(2)}`);
  console.log(`  Borrow APY: ${reserve.totalBorrowAPY(slot)}%`);
  console.log(`  Supply APY: ${reserve.totalSupplyAPY(slot)}%`);
  console.log(`  Utilization: ${reserve.calculateUtilizationRatio()}%`);
}
View Code
3

Get Historical Reserve APY

Fetch historical supply APY and borrow APY data for a specific reserve over time.
getHistoricalReserveAPY
const API_BASE_URL = "https://api.kamino.finance";
const marketPubkey = "7u3HeHxYDLhnCoErrtycNokbQYbWGzLs6JSDqGAv5PfF";
const reservePubkey = "d4A2prbA2whesmvHaL88BH6Ewn5N4bTSU2Ze8P6Bc4Q";

const url = `${API_BASE_URL}/kamino-market/${marketPubkey}/reserves/${reservePubkey}/metrics/history`;

const res = await fetch(url);

if (!res.ok) {
  throw new Error(`Request failed: ${res.status} ${res.statusText}`);
}

const { history } = await res.json();

for (const item of history) {
  console.log({
    timestamp: item.timestamp,
    symbol: item.metrics.symbol,
    supplyInterestAPY: item.metrics.supplyInterestAPY,
    borrowInterestAPY: item.metrics.borrowInterestAPY,
    depositTvl: item.metrics.depositTvl,
    borrowTvl: item.metrics.borrowTvl,
  });
}
View Code

Additional Resources

API Examples

SDK Examples