Portfolio Balances

getPortfolioBalances(params: WalletPortfolioQuery)

Description

This method returns portfolio-level financial metrics across both tokens held in your wallet(s) and active DeFi positions. Certain response fields will only pertain to wallet token holdings, and certain response fields will only be relevant to DeFi positions.

  • Position Type - Either โ€œwalletโ€ or โ€œdefiโ€. Wallet positions are token positions held directly in your wallet. DeFi positions are active positions helds in DeFi protocols.
  • Is_Debt - Refers to whether the token position is borrowed or not.
  • Cost Method - Refers to the cost accounting method used to calculate Realized P&L on token transaction activity.
  • DeFi Accrual - This refers to the LP token accrual, staking interest, lending interest or borrowing interest accrual (whichever is applicable to the specific DeFi position strategy)
  • OpenPool API Endpoint: GET:/wallet/protocol_balance/

Parameters

NameTypeDescriptionOptional
paramsWalletPortfolioQueryQuery parametersNo
interface WalletPortfolioQuery {
	cost_method?: "FIFO" | "LIFO" | "WAC";
	currency?: "AVAX" | "ETH" | "MATIC" | "USD" | "XDAI";
	wallet: string;
}

Response

Interface: CurrentPortfolio[]

[
   {
      wallet: string;
      type: string;
      token: Token;
      balance: string;
      price: string;
      value: string;
      average_cost: string;
      unrealized_pnl: string;
      total_realized_pnl: string;
      income: CurrentIncome;
      defi_strategy_name: string;
      defi_strategy_category: string;
      defi_strategy_address: string;
      defi_protocol: string;
      defi_principal: string;
      defi_accrual: string;
      currency: string;
      cost_method: string;
      timestamp: string;
   }
]