Positions
curl --request GET \
--url https://api.nefariouslabs.dev/api/positionsimport requests
url = "https://api.nefariouslabs.dev/api/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.nefariouslabs.dev/api/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nefariouslabs.dev/api/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nefariouslabs.dev/api/positions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nefariouslabs.dev/api/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nefariouslabs.dev/api/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fetchedAt": "2024-01-15T10:30:00.000Z",
"totalValueUsd": 15420.50,
"totalDepositedUsd": 12500.00,
"totalBorrowedUsd": 2100.00,
"totalRewardsUsd": 45.30,
"protocols": [
{
"protocol": {
"id": "marginfi",
"name": "MarginFi",
"url": "https://app.marginfi.com",
"category": "lending"
},
"totalValueUsd": 8400.00,
"totalDepositedUsd": 10000.00,
"totalBorrowedUsd": 1600.00,
"totalRewardsUsd": 0,
"positions": [
{
"id": "marginfi-deposit-abc123",
"type": "deposit",
"name": "USDC Deposit",
"valueUsd": 5000.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "5000000000",
"amountUsd": 5000.00,
"decimals": 6
}
],
"metadata": {
"apy": 0.085
}
},
{
"id": "marginfi-borrow-abc123",
"type": "borrow",
"name": "SOL Borrow",
"valueUsd": 1600.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8000000000",
"amountUsd": 1600.00,
"decimals": 9
}
],
"metadata": {
"apy": 0.045
}
}
]
},
{
"protocol": {
"id": "orca",
"name": "Orca",
"url": "https://www.orca.so",
"category": "dex"
},
"totalValueUsd": 3500.00,
"totalDepositedUsd": 3500.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 25.50,
"positions": [
{
"id": "orca-whirlpool-def456",
"type": "liquidity",
"name": "SOL/USDC LP",
"valueUsd": 3500.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8750000000",
"amountUsd": 1750.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "1750000000",
"amountUsd": 1750.00,
"decimals": 6
}
],
"metadata": {
"poolAddress": "HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ",
"tickLower": -10000,
"tickUpper": 10000,
"inRange": true,
"unclaimedFees": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"amount": "50000000",
"amountUsd": 10.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"amount": "15500000",
"amountUsd": 15.50,
"decimals": 6
}
]
}
}
]
},
{
"protocol": {
"id": "drift",
"name": "Drift",
"url": "https://app.drift.trade",
"category": "perps"
},
"totalValueUsd": 2500.00,
"totalDepositedUsd": 2000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 0,
"positions": [
{
"id": "drift-perp-btc",
"type": "perp",
"name": "BTC-PERP Long",
"valueUsd": 500.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "500000000",
"amountUsd": 500.00,
"decimals": 6
}
],
"metadata": {
"side": "long",
"leverage": 5.0,
"entryPrice": 42000.00,
"markPrice": 43500.00,
"unrealizedPnl": 500.00,
"liquidationPrice": 35000.00
}
}
]
},
{
"protocol": {
"id": "jito",
"name": "Jito",
"url": "https://www.jito.network",
"category": "lst"
},
"totalValueUsd": 1020.50,
"totalDepositedUsd": 1000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 20.50,
"positions": [
{
"id": "jito-stake",
"type": "stake",
"name": "Jito Staked SOL",
"valueUsd": 1020.50,
"tokens": [
{
"mint": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
"symbol": "JitoSOL",
"name": "Jito Staked SOL",
"amount": "5000000000",
"amountUsd": 1020.50,
"decimals": 9
}
],
"metadata": {
"exchangeRate": 1.085
}
}
]
}
]
}
Endpoints
Positions
Get DeFi positions for a Solana wallet
GET
/
api
/
positions
Positions
curl --request GET \
--url https://api.nefariouslabs.dev/api/positionsimport requests
url = "https://api.nefariouslabs.dev/api/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.nefariouslabs.dev/api/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nefariouslabs.dev/api/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nefariouslabs.dev/api/positions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.nefariouslabs.dev/api/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nefariouslabs.dev/api/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fetchedAt": "2024-01-15T10:30:00.000Z",
"totalValueUsd": 15420.50,
"totalDepositedUsd": 12500.00,
"totalBorrowedUsd": 2100.00,
"totalRewardsUsd": 45.30,
"protocols": [
{
"protocol": {
"id": "marginfi",
"name": "MarginFi",
"url": "https://app.marginfi.com",
"category": "lending"
},
"totalValueUsd": 8400.00,
"totalDepositedUsd": 10000.00,
"totalBorrowedUsd": 1600.00,
"totalRewardsUsd": 0,
"positions": [
{
"id": "marginfi-deposit-abc123",
"type": "deposit",
"name": "USDC Deposit",
"valueUsd": 5000.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "5000000000",
"amountUsd": 5000.00,
"decimals": 6
}
],
"metadata": {
"apy": 0.085
}
},
{
"id": "marginfi-borrow-abc123",
"type": "borrow",
"name": "SOL Borrow",
"valueUsd": 1600.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8000000000",
"amountUsd": 1600.00,
"decimals": 9
}
],
"metadata": {
"apy": 0.045
}
}
]
},
{
"protocol": {
"id": "orca",
"name": "Orca",
"url": "https://www.orca.so",
"category": "dex"
},
"totalValueUsd": 3500.00,
"totalDepositedUsd": 3500.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 25.50,
"positions": [
{
"id": "orca-whirlpool-def456",
"type": "liquidity",
"name": "SOL/USDC LP",
"valueUsd": 3500.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8750000000",
"amountUsd": 1750.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "1750000000",
"amountUsd": 1750.00,
"decimals": 6
}
],
"metadata": {
"poolAddress": "HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ",
"tickLower": -10000,
"tickUpper": 10000,
"inRange": true,
"unclaimedFees": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"amount": "50000000",
"amountUsd": 10.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"amount": "15500000",
"amountUsd": 15.50,
"decimals": 6
}
]
}
}
]
},
{
"protocol": {
"id": "drift",
"name": "Drift",
"url": "https://app.drift.trade",
"category": "perps"
},
"totalValueUsd": 2500.00,
"totalDepositedUsd": 2000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 0,
"positions": [
{
"id": "drift-perp-btc",
"type": "perp",
"name": "BTC-PERP Long",
"valueUsd": 500.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "500000000",
"amountUsd": 500.00,
"decimals": 6
}
],
"metadata": {
"side": "long",
"leverage": 5.0,
"entryPrice": 42000.00,
"markPrice": 43500.00,
"unrealizedPnl": 500.00,
"liquidationPrice": 35000.00
}
}
]
},
{
"protocol": {
"id": "jito",
"name": "Jito",
"url": "https://www.jito.network",
"category": "lst"
},
"totalValueUsd": 1020.50,
"totalDepositedUsd": 1000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 20.50,
"positions": [
{
"id": "jito-stake",
"type": "stake",
"name": "Jito Staked SOL",
"valueUsd": 1020.50,
"tokens": [
{
"mint": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
"symbol": "JitoSOL",
"name": "Jito Staked SOL",
"amount": "5000000000",
"amountUsd": 1020.50,
"decimals": 9
}
],
"metadata": {
"exchangeRate": 1.085
}
}
]
}
]
}
Retrieve all DeFi positions for a Solana wallet across supported protocols.
Request
string
required
Solana wallet address in base58 format (32-44 characters).
string
Comma-separated list of protocol IDs to filter results. If omitted, all protocols are queried.Available protocols:
- Lending:
marginfi,kamino,solend,defituna - DEX:
raydium,orca,meteora,hawkfi,jupiter - Perpetuals:
drift,mango - Liquid Staking:
jito,marinade,blazestake,sanctum,solayer,fragmetric,kyros - Governance:
jupiter-governance - Native:
solana-native-staking - Holdings:
wallet
Response
string
The queried wallet address.
string
ISO 8601 timestamp of when the data was fetched.
number
Net portfolio value in USD (deposits - borrows + positions).
number
Total deposited assets in USD.
number
Total borrowed assets in USD.
number
Total unclaimed rewards in USD.
array
Array of protocol position data.
Show Protocol Object
Show Protocol Object
string
Protocol identifier (e.g.,
marginfi, drift).string
Protocol display name.
string
Protocol website.
string
Category:
lending, dex, perps, lst, staking, native-staking, or holdings.number
Net value in this protocol.
number
Total deposited in this protocol.
number
Total borrowed in this protocol.
number
Unclaimed rewards in this protocol.
array
Array of positions (see Position Object below).
Position Object
string
Unique position identifier.
string
Position type:
deposit, borrow, liquidity, stake, or perp.string
Human-readable position name (e.g.,
USDC Deposit, SOL/USDC LP).number
Position value in USD.
array
object
Additional data depending on position type.
Show Metadata Fields
Show Metadata Fields
Lending positions:
DEX positions:
Perpetual positions:
Staking positions:
Native staking positions:
number
Annual percentage yield.
number
Account health factor.
number
Liquidation threshold.
string
Pool address.
number
Fee tier percentage.
boolean
Whether position is in range.
number
Lower price bound.
number
Upper price bound.
array
Unclaimed trading fees.
string
long or short.number
Position leverage.
number
Entry price.
number
Current mark price.
number
Unrealized PnL in USD.
number
Liquidation price.
number
LST to SOL exchange rate.
number
Pending unstake amount (if applicable).
string
Stake account address.
string
Validator vote account.
number
Validator commission percentage.
string
activating, active, deactivating, or inactive.number
Epoch when the stake was activated.
number
Epoch when the stake was deactivated.
number
Current Solana epoch.
Errors
| Code | Description |
|---|---|
| 400 | Invalid wallet address format |
{
"error": "Invalid wallet address"
}
Examples
curl "https://api.nefariouslabs.dev/api/positions?wallet=7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
curl "https://api.nefariouslabs.dev/api/positions?wallet=7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU&protocols=marginfi,drift,jito"
const wallet = '7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU';
// Get all positions
const response = await fetch(
`https://api.nefariouslabs.dev/api/positions?wallet=${wallet}`
);
const data = await response.json();
// Get specific protocols only
const filtered = await fetch(
`https://api.nefariouslabs.dev/api/positions?wallet=${wallet}&protocols=marginfi,drift`
);
import requests
wallet = "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
# Get all positions
response = requests.get(
f"https://api.nefariouslabs.dev/api/positions?wallet={wallet}"
)
data = response.json()
# Get specific protocols only
response = requests.get(
f"https://api.nefariouslabs.dev/api/positions?wallet={wallet}&protocols=marginfi,orca"
)
{
"wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fetchedAt": "2024-01-15T10:30:00.000Z",
"totalValueUsd": 15420.50,
"totalDepositedUsd": 12500.00,
"totalBorrowedUsd": 2100.00,
"totalRewardsUsd": 45.30,
"protocols": [
{
"protocol": {
"id": "marginfi",
"name": "MarginFi",
"url": "https://app.marginfi.com",
"category": "lending"
},
"totalValueUsd": 8400.00,
"totalDepositedUsd": 10000.00,
"totalBorrowedUsd": 1600.00,
"totalRewardsUsd": 0,
"positions": [
{
"id": "marginfi-deposit-abc123",
"type": "deposit",
"name": "USDC Deposit",
"valueUsd": 5000.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "5000000000",
"amountUsd": 5000.00,
"decimals": 6
}
],
"metadata": {
"apy": 0.085
}
},
{
"id": "marginfi-borrow-abc123",
"type": "borrow",
"name": "SOL Borrow",
"valueUsd": 1600.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8000000000",
"amountUsd": 1600.00,
"decimals": 9
}
],
"metadata": {
"apy": 0.045
}
}
]
},
{
"protocol": {
"id": "orca",
"name": "Orca",
"url": "https://www.orca.so",
"category": "dex"
},
"totalValueUsd": 3500.00,
"totalDepositedUsd": 3500.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 25.50,
"positions": [
{
"id": "orca-whirlpool-def456",
"type": "liquidity",
"name": "SOL/USDC LP",
"valueUsd": 3500.00,
"tokens": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"name": "Wrapped SOL",
"amount": "8750000000",
"amountUsd": 1750.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "1750000000",
"amountUsd": 1750.00,
"decimals": 6
}
],
"metadata": {
"poolAddress": "HJPjoWUrhoZzkNfRpHuieeFk9WcZWjwy6PBjZ81ngndJ",
"tickLower": -10000,
"tickUpper": 10000,
"inRange": true,
"unclaimedFees": [
{
"mint": "So11111111111111111111111111111111111111112",
"symbol": "SOL",
"amount": "50000000",
"amountUsd": 10.00,
"decimals": 9
},
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"amount": "15500000",
"amountUsd": 15.50,
"decimals": 6
}
]
}
}
]
},
{
"protocol": {
"id": "drift",
"name": "Drift",
"url": "https://app.drift.trade",
"category": "perps"
},
"totalValueUsd": 2500.00,
"totalDepositedUsd": 2000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 0,
"positions": [
{
"id": "drift-perp-btc",
"type": "perp",
"name": "BTC-PERP Long",
"valueUsd": 500.00,
"tokens": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"symbol": "USDC",
"name": "USD Coin",
"amount": "500000000",
"amountUsd": 500.00,
"decimals": 6
}
],
"metadata": {
"side": "long",
"leverage": 5.0,
"entryPrice": 42000.00,
"markPrice": 43500.00,
"unrealizedPnl": 500.00,
"liquidationPrice": 35000.00
}
}
]
},
{
"protocol": {
"id": "jito",
"name": "Jito",
"url": "https://www.jito.network",
"category": "lst"
},
"totalValueUsd": 1020.50,
"totalDepositedUsd": 1000.00,
"totalBorrowedUsd": 0,
"totalRewardsUsd": 20.50,
"positions": [
{
"id": "jito-stake",
"type": "stake",
"name": "Jito Staked SOL",
"valueUsd": 1020.50,
"tokens": [
{
"mint": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn",
"symbol": "JitoSOL",
"name": "Jito Staked SOL",
"amount": "5000000000",
"amountUsd": 1020.50,
"decimals": 9
}
],
"metadata": {
"exchangeRate": 1.085
}
}
]
}
]
}
⌘I