Access market state, reserve metrics, and historical data via the REST API and TypeScript SDK. Use these endpoints to build dashboards, monitoring tools, and analysis pipelines.
List All Markets
Fetch all Kamino lending markets.
// Use the API for listing all markets (SDK loads individual markets on-chain)
const response = await fetch('https://api.kamino.finance/v2/kamino-market');
const markets = await response.json();
Market TVL
Get real-time market-wide metrics including total deposits and borrows TVL across all reserves.
import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const marketPubkey = address('<MARKET_ADDRESS>');
const market = await KaminoMarket.load(rpc, marketPubkey, slotDuration);
console.log({
depositTVL: market!.getTotalDepositTVL().toString(),
borrowTVL: market!.getTotalBorrowTVL().toString(),
});
Reserve Metrics
Query detailed information for all reserves in the market including deposit/borrow TVL, APY rates, and utilization ratios.
import { createSolanaRpc, address } from '@solana/kit';
import { KaminoMarket, getMedianSlotDurationInMsFromLastEpochs } from '@kamino-finance/klend-sdk';
const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
const slotDuration = await getMedianSlotDurationInMsFromLastEpochs();
const marketPubkey = address('<MARKET_ADDRESS>');
const market = await KaminoMarket.load(rpc, marketPubkey, slotDuration);
const slot = await rpc.getSlot().send();
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()}%`);
}
Historical Reserve Metrics
Fetch historical supply APY, borrow APY, and TVL data for a specific reserve over time.
Historical data is only available via the API.
const marketPubkey = '<MARKET_ADDRESS>';
const reservePubkey = '<RESERVE_ADDRESS>';
const url = `https://api.kamino.finance/kamino-market/${marketPubkey}/reserves/${reservePubkey}/metrics/history`;
const response = await fetch(url);
const { history } = await response.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,
});
}
Additional Resources