All routes require a bearer token with the
read:users scope plus the
x-user-id header so the backend can resolve the retail account.Overview
The investments screen displays portfolio performance, holdings breakdown, and interactive charts. It uses 4 endpoints to build the UI.Endpoints
1. Get User Portfolios
- Endpoint:
GET /portfolios - Purpose: Get all portfolios for the user and identify the primary portfolio
- Response: Array of portfolios with basic holdings information
2. Get Portfolio Holdings
- Endpoint:
GET /portfolios/{portfolioId} - Purpose: Get detailed portfolio holdings with asset information
- Response: Portfolio with holdings array containing ISIN and quantity
3. Prices by Tenor
- Endpoint:
GET /portfolios/{portfolioId}/prices-by-tenor - Purpose: Get historical price data for the portfolio chart
- Response: Time series data organized by tenor (
1w,1m,3m,6m,1y,max)
4. Investment Products
- Endpoint:
GET /investment-products - Purpose: Get current ticker/pricing data for all investment products
- Response: Array of investment products with current ticker data (automatically includes pricing)
Data Flow and Component Building
Phase 1: Initial Load
-
Fetch User Portfolios
- Call
GET /portfoliosto retrieve all portfolios for the user - Extract the primary portfolio ID (typically the first portfolio)
- Check if user has any portfolios; if empty, show appropriate empty state
- Call
-
Fetch Portfolio Holdings (parallel or sequential)
- Call
GET /portfolios/{portfolioId}to get detailed holdings - Extract holdings array with ISIN and quantity information
- Call
Phase 2: Main Data Fetching
Fetch these in parallel:-
Prices by Tenor
- Response includes time series data for multiple tenors:
1w,1m,3m,6m,1y,max
- Each tenor contains:
data: Array of{timestamp, value, displayIntraday}pointsvalue: Portfolio value in the investor’s base currencydisplayIntraday: Boolean indicating whether to render intraday granularity
- Response includes time series data for multiple tenors:
-
Investment Products (optional, can be lazy-loaded)
- Response: Array of investment products with current ticker data
- Used to enrich holdings with current prices and asset metadata
- Ticker data is automatically included (no query parameters needed)
Phase 3: Building UI Components
Component 1: Portfolio Value Display
Data Source: Prices by Tenor- Extract the default timeframe (e.g.,
"max") - Display:
- Current portfolio value: Use the last
valuefrom Prices by Tenor for the selected timeframe - Historical comparison: Calculate difference between first and last value in the series
- Percentage change: Calculate
((lastValue - firstValue) / firstValue) * 100
- Current portfolio value: Use the last
- Update displayed value from Prices by Tenor for that timeframe
- Update chart data from Prices by Tenor for that timeframe
- Recalculate percentage change for the selected timeframe
Component 2: Performance Chart
Data Source: Prices by Tenor- Parse the selected timeframe’s time series data
- Transform data points:
- Convert
timestamp(milliseconds) to date objects - Extract
valueas the price point - Format dates for x-axis labels
- Convert
- Render line chart with:
- X-axis: Dates
- Y-axis: Portfolio value
- Handle
displayIntradayflag for intraday vs daily data granularity
- Switch to the corresponding time series from the Prices by Tenor response
- Re-render chart with new data
Component 3: Holdings Breakdown
Data Source: Portfolio Holdings + Investment Products-
Process holdings:
- Match holdings ISINs with investment products to get current prices
- Calculate holding value:
holding.quantity * asset.currentTicker.price - Calculate total portfolio value: Sum of all holding values
- Calculate allocation percentage per holding:
(holdingValue / totalValue) * 100 - Sort holdings by value (descending) or alphabetically
-
Group holdings (optional):
- By Asset Class: Group by
asset.assetClassType(if available in investment products) - By Asset Type: Group by
asset.isStockvsasset.isETF - Ungrouped: Show flat list
- By Asset Class: Group by
-
Build components:
- Pie Chart: Aggregate allocations by asset class or type
- Asset List: Display individual holdings with:
- Asset name (from investment products)
- Allocation percentage
- Current value
- Quantity held
Component 4: Asset Class Filters
Data Source: Portfolio Holdings + Investment Products- Extract unique asset classes/types from holdings (using investment products data)
- Create filter buttons/chips for each asset class
- When filter selected:
- Filter holdings by selected asset class
- Update pie chart and asset list
- Recalculate totals
Complete Initialization Flow
Refresh Flow
When user pulls to refresh or returns to screen:- Invalidate cached data (if using caching)
- Re-fetch in parallel:
- Portfolio Holdings
- Prices by Tenor
- Investment Products (if needed)
- Update all components with new data
Error Handling
- If Portfolio Holdings fails: Show error, hide breakdown components
- If Prices by Tenor fails: Show error, hide chart, keep holdings display
- If Investment Products fails: Show holdings without enrichment (ISIN only)
Data Dependencies
- Portfolio Holdings: Required for holdings breakdown
- Prices by Tenor: Required for chart and value display
- Investment Products: Optional, enhances holdings with current prices and metadata
Performance Considerations
- Cache responses: These endpoints support caching
- Parallel fetching: Fetch Holdings, Prices, and Products simultaneously
- Lazy load Investment Products: Only fetch if needed for detailed views
- Debounce timeframe changes: Avoid rapid chart re-renders
- Pagination: If holdings list is long, implement virtual scrolling or pagination
Key Data Transformations
Prices by Tenor Response Structure
Portfolio Holdings Response Structure
Investment Products Response Structure
Each investment product contains:commonId: Internal asset identifierisin: ISIN codename: Asset namesymbol: Trading symbolcurrentTicker: Current price informationprice: Price in base currencypricePerCurrency: Prices in multiple currenciescurrency: Ticker currencyupdatedAt: Last update timestamp
isStock: Boolean indicating if it’s a stockisETF: Boolean indicating if it’s an ETFassetClassType: Asset class classification (if available)
Example: Complete Fetch Implementation
See also
- API Reference → Portfolios API →
GET /portfolios - API Reference → Portfolios API →
GET /portfolios/{id} - API Reference → Portfolios API →
GET /portfolios/{id}/prices-by-tenor - API Reference → Investment Products API →
GET /investment-products