Skip to main content

Portfolio Charts

Get historical portfolio performance data to build beautiful charts and analytics. The historicalPortfolio query provides time-series data showing how portfolio values change over time across different timeframes.

note

Portfolio Charts are currently in beta. We're actively improving the feature and adding support for additional networks.

Overview

The historicalPortfolio query returns time-series data points showing portfolio value changes over time. Perfect for:

Key Features

  • Multiple Timeframes: Choose from HOUR, DAY, WEEK, MONTH, or YEAR intervals
  • Flexible Token Filtering: Include or exclude specific tokens to customize views
  • Real-time Data: Get up-to-date portfolio values for accurate charting
  • Easy Integration: Simple query structure perfect for frontend chart libraries
Try it nowArrow pointing right

Example Variables

{
"address": "0x849151d7d0bf1f34b70d5cad5149d28cc2308bf1",
"chainId": 480,
"timeFrame": "WEEK"
}

Example Query

query HistoricalPortfolio($address: Address!, $chainId: Int!, $timeFrame: TimeFrame!) {
historicalPortfolio(address: $address, chainId: $chainId, timeFrame: $timeFrame) {
timestamp
value
}
}

Example Response

{
"data": {
"historicalPortfolio": [
{
"timestamp": 1734566400000,
"value": 285430.75
},
{
"timestamp": 1734652800000,
"value": 292820.3
},
{
"timestamp": 1734739200000,
"value": 298450.85
},
{
"timestamp": 1734825600000,
"value": 305720.4
},
{
"timestamp": 1734912000000,
"value": 301890.2
}
]
}
}

Optional Parameters

Token Filtering

Control which tokens are included in the portfolio calculation:

includeTokens (Optional)

Specify an array of token addresses to only include in the calculation. When provided, the portfolio value will only consider these tokens.

includeTokens: ["0x4200000000000000000000000000000000000006", "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"]

excludeTokens (Optional)

Specify an array of token addresses to exclude from the calculation. Useful for removing specific tokens while keeping everything else.

excludeTokens: ["0x4200000000000000000000000000000000000006"]

Response Fields

FieldDescriptionType
timestampUnix timestamp in millisecondsTimestamp!
valuePortfolio value in USD at that timeFloat!

Arguments

ArgumentDescriptionTypeRequired
addressWallet address to analyzeAddress!Yes
chainIdChain ID for the network to queryInt!Yes
timeFrameTime interval for data pointsTimeFrame!Yes
excludeTokensToken addresses to exclude from calculation[Address!]No
includeTokensToken addresses to include in calculation[Address!]No
currencyCurrency for values (default: USD)CurrencyNo

Best Practices

1. Choose the Right Timeframe

  • HOUR: For detailed intraday analysis
  • DAY: For short-term trend analysis (weeks to months)
  • WEEK: For medium-term performance tracking
  • MONTH: For long-term portfolio analysis
  • YEAR: For multi-year investment tracking

2. Token Filtering Strategies

  • Focus Analysis: Use includeTokens to analyze specific assets
  • Remove Noise: Use excludeTokens to filter out dust, spam, or temporary holdings
  • Stablecoin Exclusion: Exclude stablecoins to focus on volatile assets
  • Major Holdings: Include only top holdings for simplified analysis

3. Handling Data

  • Timestamps: Always convert from milliseconds to your preferred date format
  • Missing Data: Handle potential gaps in historical data gracefully
  • Caching: Cache responses appropriately based on timeframe (longer timeframes change less frequently)

4. Chart Integration

Popular JavaScript charting libraries work well with this data structure:

// Example with Chart.js
const chartData = {
labels: data.map((point) => new Date(point.timestamp)),
datasets: [
{
label: 'Portfolio Value',
data: data.map((point) => point.value),
borderColor: '#784ffe',
backgroundColor: 'rgba(120, 79, 254, 0.1)',
},
],
};