Positions (Lending & LPs)
Solana API for tracking DeFi positions including LPs, lending, and staking across 50+ protocols like Raydium, Marginfi, Marinade, Kamino, Orca, and Jito.
No other Solana API provides DeFi position data. See LP tokens, lending deposits, staking positions, and yield farming across all major protocols in a single call.
The Problem We Solve
When you deposit tokens into DeFi protocols, they "disappear" from your wallet. Traditional balance APIs can't see:
- Liquidity you've added to Raydium or Meteora
- Tokens lent on Marginfi or Solend
- SOL staked through Marinade or Jito
- Yield farming positions across various protocols
This means portfolio trackers show incomplete data. A user might have $50,000 in DeFi positions but their "portfolio" shows only the $500 sitting in their wallet.
Vybe solves this. Our DeFi positions endpoint tracks assets across 50+ protocols, giving you the complete picture of any wallet's holdings.
Endpoint
GET /wallets/{ownerAddress}/defi-positions
Supported Protocols
| Protocol Type | Examples |
|---|---|
| Liquidity Pools | Raydium, Meteora, Orca, Lifinity, Phoenix |
| Lending/Borrowing | Solend, Marginfi, Kamino, Drift |
| Liquid Staking | Marinade (mSOL), Jito (jitoSOL), Sanctum, BlazeStake |
| Yield Aggregators | Various yield optimizers |
| Perpetuals | Drift, Zeta, Flash |
We're constantly adding new protocols. If a major protocol is missing, let us know.
Example Request
curl "https://api.vybenetwork.com/wallets/7Tar8QZTrRPwoGY5Ke9Vfwf6CmpBfekrNofERxgReza/defi-positions" \
-H "X-API-Key: YOUR_API_KEY"Example Response
{
"ownerAddress": "7Tar8QZTrRPwoGY5Ke9Vfwf6CmpBfekrNofERxgReza",
"totalDefiValueUsd": "8543.21",
"positions": [
{
"protocol": "Raydium",
"type": "liquidity_pool",
"poolName": "SOL-USDC",
"poolAddress": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2",
"valueUsd": "5000.00",
"tokens": [
{ "symbol": "SOL", "amount": "13.5", "valueUsd": "2500.00" },
{ "symbol": "USDC", "amount": "2500.00", "valueUsd": "2500.00" }
],
"apr": "45.2%",
"rewards": {
"pending": [
{ "symbol": "RAY", "amount": "12.5", "valueUsd": "25.00" }
]
}
},
{
"protocol": "Marinade",
"type": "staking",
"poolName": "mSOL Stake",
"valueUsd": "3543.21",
"tokens": [
{ "symbol": "mSOL", "amount": "18.9", "valueUsd": "3543.21" }
],
"apr": "7.8%"
}
]
}Response Fields Explained
| Field | Description |
|---|---|
totalDefiValueUsd | Sum of all DeFi position values |
protocol | Name of the DeFi protocol |
type | Position type: liquidity_pool, lending, staking, farming |
poolName | Human-readable position name |
valueUsd | Current USD value of the position |
tokens | Underlying tokens in the position |
apr | Current APR/APY if available |
rewards.pending | Unclaimed rewards |
Why This Matters
True Portfolio Value
Without DeFi position tracking, your app shows incomplete data:
❌ Traditional API:
Wallet Balance: $500
(User actually has $50,000 in DeFi)
✅ With Vybe DeFi Positions:
Wallet Balance: $500
DeFi Positions: $49,500
Total Net Worth: $50,000
Position Management
Users need to see their LP positions, staking rewards, and lending deposits to manage their portfolio effectively. This endpoint powers:
- LP position dashboards
- Staking reward trackers
- Lending health monitors
- Yield aggregation tools
Common Use Cases
| Use Case | Implementation |
|---|---|
| Complete Portfolio | Add DeFi to wallet balances for true net worth |
| Yield Dashboard | Display APR and pending rewards |
| LP Manager | Monitor impermanent loss and position health |
| Staking Tracker | Show staked amounts and rewards |
| Tax Reporting | Full DeFi activity for compliance |
Full Portfolio Example
Combine all wallet endpoints for complete portfolio view:
async function getCompletePortfolio(wallet) {
const headers = { "X-API-Key": API_KEY };
const [tokens, nfts, defi] = await Promise.all([
fetch(`https://api.vybenetwork.com/wallets/${wallet}/token-balance`, { headers }),
fetch(`https://api.vybenetwork.com/wallets/${wallet}/nft-balance`, { headers }),
fetch(`https://api.vybenetwork.com/wallets/${wallet}/defi-positions`, { headers })
].map(p => p.then(r => r.json())));
const tokensUsd = parseFloat(tokens.totalTokenValueUsd || 0);
const nftsUsd = parseFloat(nfts.totalNftValueUsd || 0);
const defiUsd = parseFloat(defi.totalDefiValueUsd || 0);
return {
wallet,
breakdown: {
tokens: `$${tokensUsd.toLocaleString()}`,
nfts: `$${nftsUsd.toLocaleString()}`,
defi: `$${defiUsd.toLocaleString()}`
},
totalNetWorth: `$${(tokensUsd + nftsUsd + defiUsd).toLocaleString()}`,
defiPositions: defi.positions
};
}Yield Dashboard Example
async function getYieldDashboard(wallet) {
const response = await fetch(
`https://api.vybenetwork.com/wallets/${wallet}/defi-positions`,
{ headers: { "X-API-Key": API_KEY } }
);
const { positions } = await response.json();
// Group by protocol
const byProtocol = positions.reduce((acc, pos) => {
if (!acc[pos.protocol]) acc[pos.protocol] = [];
acc[pos.protocol].push(pos);
return acc;
}, {});
// Calculate pending rewards
const pendingRewards = positions
.flatMap(p => p.rewards?.pending || [])
.reduce((sum, r) => sum + parseFloat(r.valueUsd || 0), 0);
// Weighted average APR
const totalValue = positions.reduce((sum, p) => sum + parseFloat(p.valueUsd), 0);
const weightedApr = positions.reduce((sum, p) => {
const weight = parseFloat(p.valueUsd) / totalValue;
return sum + (parseFloat(p.apr || 0) * weight);
}, 0);
return {
totalDefiValue: `$${totalValue.toLocaleString()}`,
averageApr: `${weightedApr.toFixed(2)}%`,
pendingRewards: `$${pendingRewards.toFixed(2)}`,
byProtocol
};
}Related Endpoints
- Token Balances - Wallet token holdings
- NFT Balances - NFT portfolio
- Balance History - Track value over time
Updated 10 days ago