Skip to content

Conversation

@joostsijm
Copy link

@joostsijm joostsijm commented Dec 6, 2025

This PR introduces a risk classification system for portfolio assets, enabling users to categorize holdings based on risk.
The implementation spans the full stack with database schema updates, backend models, and frontend UI components, including a new Risk Categories visualization on the Performance page.

Are you interested in including this feature in the Wealthfolio?
If you have feedback can make adjustments, let me know.

Backend

  • Migration: Added risk column to assets table (nullable TEXT)
  • Models: Extended Asset, NewAsset, UpdateAssetProfile, AssetDB, and Instrument with optional risk field
  • Repository: Updated asset repository to persist risk values during profile updates
  • Service: Modified holdings service to propagate risk data from assets to instruments

Frontend

  • Asset Profile Page: Added editable risk field with color-coded badges
    • Edit mode: text input accepting risk classification
    • View mode: color-coded badges (Low, Medium, High)
  • Risk Categories Card: New component on Performance page showing:
    • Portfolio risk distribution with visual progress bars
    • Asset counts per risk category
    • Market values and percentages
    • Interactive tooltips with detailed breakdowns
    • Empty state for portfolios without risk data

Testing

  1. Edit Asset Risk:

    • Navigate to any asset (Holdings → click asset)
    • Click "Edit" and enter a risk value (e.g., "Low", "Medium", "High")
    • Save and verify color-coded badge appears
  2. View Risk Distribution:

    • Go to Performance page
    • Scroll to "Risk Categories" card
    • Verify visualization shows correct data, percentages, and colors
    • Hover over values to see detailed tooltips

Notes

  • No breaking change, the risk field is optional throughout the stack, maintaining full backward compatibility
  • Risk field accepts free-form text; UI suggests "Low/Medium/High" but doesn't enforce strict validation
  • Color scheme uses existing theme tokens (success, warning, destructive)
  • Design patterns follow existing Performance page components
  • Migration includes both up.sql and down.sql for easy rollback
  • Not included in export functionality
  • No filtering by risk category in Holdings view

Screenshots

Performance
image
Assert view
image
Asset edit
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant