Skip to content

[Feature] User Portfolio Net-Worth Aggregation Endpoint #150

Description

@AlAfiz

Description: Create a comprehensive portfolio endpoint (/portfolio/:address) that aggregates a user's total interactions with TradeFlow. The backend must fetch the user's on-chain token balances and active LP positions, calculate their current fiat/USDC value using indexed pool ratios, and return a unified net-worth payload.
Context / Motivation: Users need a single dashboard to view their total value locked, current asset allocation, and overall profitability across the TradeFlow ecosystem.
Acceptance Criteria: - [ ] Utilize the Stellar SDK to fetch all token trustlines and balances for the requested address.

  • Query the database for the user's staked LP positions and calculate their underlying asset claims.
  • Map all assets to their current USDC equivalent price via the AMM pool ratios.
  • Return a strictly typed JSON payload combining wallet balances, staked positions, and total net worth.
    Technical Pointers: Use server.accounts().accountId(...) via the Stellar SDK to fetch raw balances. This endpoint will perform multiple async operations; optimize by using Promise.all() where dependencies allow.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions