getPortfolioSummary(params: WalletPortfolioQuery)
getPortfolioSummary(params: WalletPortfolioQuery)
Description
This method returns summarized financial metrics across both your token holdings and DeFi activities, including Total Current Value, Unrealized P&L, Realized P&L, Cost Basis, Claimed Rewards, Claimable Rewards, and DeFi Accruals.
Note that responses are normalized to the currency you selected (default is USD).
- Portfolio Summary Metrics - total_value and total_unrealized_pnl are across total token and DeFi positions.
- Token Summary Metrics - total_realized_pnl and cost_method (refers to cost accounting method used to calculated Realized PnL) pertain to token holdings activity.
- DeFi Position Metrics - total_claimed_rewards, total_principal, total_accrual, total_claimable_rewards, total_borrowing_interest, and total_lending_interest pertain to DeFi positions.
- Total Principal - DeFi principal investment expressed in the reference currency selected. Default is USD.
- Total Accrual - Calculated as Total Borrowing interest + Total Lending interest + Total Staking interest. If Total Accrual is negative, this indicates that on a net basis, interest owed on borrowing positions exceeds interest earned on lending and staking positions. Expressed in the reference currency selected. Default is USD.
- Borrow - Represents total interest owed on all borrow positions (detractor from P&L). Expressed in the reference currency selected. Default is USD.
- Lend - Represents total interest earned on all lending positions (additive to P&L). Expressed in the reference currency selected. Default is USD.
- Stake - Represents total interest earned on all staking positions (additive to P&L). Expressed in the reference currency selected. Default is USD.
OpenPool API Endpoint: GET:/wallet/portfolio_summary/
Parameters
Name | Type | Description | Optional |
---|---|---|---|
params | WalletPortfolioQuery | Query parameters | No |
interface WalletPortfolioQuery {
cost_method?: "FIFO" | "LIFO" | "WAC";
currency?: "AVAX" | "ETH" | "MATIC" | "USD" | "XDAI";
wallet: string;
}
Response
Interface: CurrentPortfolioSummary[]
[
{
wallet: 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;
}
]