Skip to main content
Octav categorizes DeFi positions into specific protocol types, allowing you to understand how assets are being used across different protocols and strategies.
Protocol Positions - These types appear in the protocolPositions object within the portfolio response

Protocol Position Types

  • All Types
  • By Risk Level
  • Code Examples
WALLET - Direct wallet custody
  • Tokens held directly in wallet
  • Not deposited into any protocol
  • Fully liquid and transferable
LOCKED - Time-locked tokens
  • Tokens with transfer restrictions
  • Vesting schedules
  • Cannot be transferred until unlock date
LENDING - Supplied assets earning interest
  • Aave deposits
  • Compound supplies
  • Liquidity provided to money markets
DEPOSIT - General protocol deposits
  • Funds deposited but not specifically lending
  • May earn yield or rewards
NFTLENDING - NFT-backed lending
  • NFTs used as collateral
  • Borrowing against NFT value
NFTBORROWER - Borrowing with NFT collateral
  • Active loan against NFT
NFTLENDER - Lending to NFT borrowers
  • Providing liquidity for NFT loans
LIQUIDITYPOOL - DEX liquidity positions
  • Uniswap V2/V3 positions
  • SushiSwap pools
  • Curve pools
  • Earn trading fees
NFTLIQUIDITYPOOL - NFT liquidity pools
  • Sudoswap positions
  • NFT AMMs
FARMING - Yield farming positions
  • Staking LP tokens for rewards
  • Farm protocol tokens
  • Multiple reward streams
LEVERAGEDFARMING - Leveraged yield farming
  • Borrowed funds used for farming
  • Amplified returns (and risks)
  • Examples: Alpaca Finance, Gearbox
STAKED - Staking positions
  • Protocol staking (e.g., ETH 2.0)
  • Single-sided staking
  • Earn staking rewards
NFTSTAKED - Staked NFTs
  • NFTs staked for rewards
  • Gaming NFTs earning yield
YIELD - General yield positions
  • Auto-compounding vaults
  • Yield aggregators
VAULT - Strategy vaults
  • Yearn vaults
  • Auto-compounding strategies
  • Managed yield optimization
VAULT_PS - Vault with protocol-specific features
  • Specialized vault mechanics
  • Custom strategies
MARGIN - Margin trading positions
  • Leveraged spot trades
  • Open long/short positions
MARGIN_PS - Protocol-specific margin
  • Custom margin implementations
PERPETUALS - Perpetual futures
  • Perpetual swaps (dYdX, GMX)
  • Funding rate exposure
LEVERAGE - General leveraged positions
  • Amplified exposure
  • Borrowed capital
OPTIONSBUYER - Long options positions
  • Purchased calls or puts
  • Defined risk exposure
OPTIONSSELLER - Short options positions
  • Sold calls or puts
  • Premium collection
  • Unlimited risk potential
REWARDS - Claimable rewards
  • Unclaimed farming rewards
  • Staking rewards pending
  • Airdrop allocations
VESTING - Vesting schedules
  • Team/investor tokens vesting
  • Gradual unlock over time
GOVERNANCE - Governance positions
  • Locked governance tokens
  • Vote-escrowed positions (veTokens)
  • Protocol governance power
INVESTMENT - Strategic investments
  • Protocol treasury positions
  • Long-term holdings
SPOT - Spot trading
  • CEX-style spot positions
  • On-chain order books
INSURANCEBUYER - Insurance coverage
  • Nexus Mutual coverage
  • Protocol insurance
INSURANCESELLER - Insurance underwriter
  • Capital at risk for premiums
  • Providing insurance coverage
NFTFRACTION - Fractionalized NFTs
  • Partial NFT ownership
  • Fractional.art positions

Common Use Cases

  • Portfolio Analytics
  • Yield Tracking
  • Liquidation Risk
Track asset allocation across DeFi strategies:
function analyzeDefiAllocation(portfolio) {
  const allocation = {};

  Object.values(portfolio.assetByProtocols).forEach(protocol => {
    Object.values(protocol.chains).forEach(chain => {
      Object.entries(chain.protocolPositions).forEach(([type, position]) => {
        const value = parseFloat(position.totalValue || position.value || 0);
        allocation[type] = (allocation[type] || 0) + value;
      });
    });
  });

  // Calculate percentages
  const total = Object.values(allocation).reduce((sum, val) => sum + val, 0);
  const percentages = {};

  Object.entries(allocation).forEach(([type, value]) => {
    percentages[type] = ((value / total) * 100).toFixed(2);
  });

  return { allocation, percentages, total };
}

const analysis = analyzeDefiAllocation(portfolio);
console.log('DeFi Allocation:', analysis.percentages);

Best Practices

Always check the position type before making assumptions:
const position = chain.protocolPositions.LENDING;

if (position) {
  // This is a lending position
  const supplied = position.supplyAssets || [];
  const borrowed = position.borrowAssets || [];

  console.log(`Supplied: ${supplied.length} assets`);
  console.log(`Borrowed: ${borrowed.length} assets`);
}
Not all positions will have all asset types:
const position = chain.protocolPositions.LIQUIDITYPOOL;

// Safely access optional asset arrays
const baseAssets = position?.baseAssets || [];
const quoteAssets = position?.quoteAssets || [];
const rewardAssets = position?.rewardAssets || [];
Use totalValue when available:
function getPositionValue(position) {
  // Prefer totalValue if available
  if (position.totalValue) {
    return parseFloat(position.totalValue);
  }

  // Fall back to summing assets
  const assets = position.assets || [];
  return assets.reduce((sum, asset) =>
    sum + parseFloat(asset.value || 0), 0
  );
}