Skip to content

feat: add AI-driven portfolio rebalancing with historical comparison …#520

Merged
Nanle-code merged 1 commit into
Nanle-code:masterfrom
d3v-active:feature/portfolio-rebalancing
Jun 30, 2026
Merged

feat: add AI-driven portfolio rebalancing with historical comparison …#520
Nanle-code merged 1 commit into
Nanle-code:masterfrom
d3v-active:feature/portfolio-rebalancing

Conversation

@d3v-active

Copy link
Copy Markdown
Contributor

this pr closes #346

Description

This PR implements a comprehensive, premium Portfolio Rebalancer in the Stellar Developer Dashboard. It enables users to analyze their current asset allocations, define target allocations using interactive inputs or AI presets, receive dynamic AI-driven insights, compare historical performance, and execute rebalancing trades with a single click.

Key Features

  1. Current Allocation Analysis

    • Renders a detailed breakdown of the user's current token holdings, prices, and values.
    • Displays a side-by-side visual comparison (Current % vs. Target %) using progress bars for each asset.
  2. Interactive Target Allocation Input

    • Replaced the simple text area with interactive sliders and number inputs for each asset.
    • Added AI Presets (Conservative, Moderate, Aggressive, Yield-Optimized) to quickly populate target allocations.
    • Included an Auto-balance button that normalizes target weights to sum to exactly 100%.
    • Allowed users to add new assets (e.g. USDC, AQUA, BTC, ETH) with pre-configured Stellar testnet issuer addresses.
  3. AI-Driven Insights & Recommendations

    • Calculates the portfolio's Herfindahl-Hirschman Index (HHI) to generate a Diversification Score (0-100).
    • Identifies concentration risks (assets representing >40% of the portfolio).
    • Generates natural language AI Reasoning explaining the benefits of the target allocation (volatility impact, risk profile, and rebalancing priorities).
  4. Historical Performance Comparison

    • Fetches historical daily prices from CoinGecko (with a robust random-walk fallback for offline/rate-limited states).
    • Simulates the growth of $10,000 invested under the Current Allocation vs. the Target Allocation over the selected timeframe (7D, 30D, 90D).
    • Displays an interactive Recharts line chart comparing the cumulative returns (ROI %) of both strategies.
  5. One-Click Execution

    • Summarizes the exact list of trades (buy/sell amounts in USD and token units) required to reach the target allocation.
    • Simulated/Mock Execution: Executes the rebalance locally and updates the Zustand store's accountData.balances so the entire dashboard instantly reflects the new portfolio balances.
    • Live Stellar Execution: Allows users to input their Secret Key (S...) to build, sign, and submit a live transaction to the Horizon network using manageSellOffer operations routed through XLM.

@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

@d3v-active is attempting to deploy a commit to the nanle-code's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@d3v-active Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Nanle-code Nanle-code merged commit c2e0e52 into Nanle-code:master Jun 30, 2026
1 check failed
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.

Add portfolio rebalancing recommendations

2 participants