Skip to content

Add helper for computing total portfolio value from a holdings array #430

Description

@Chucks1093

Summary

The wallet holdings response needs a total_portfolio_value field that sums key_balance × current_price across all entries. This calculation should live in a shared helper so it can be reused across the holdings endpoint and any future summary endpoints.

Scope

  • Add a pure helper function that accepts an array of holding entries and returns the summed total value
  • Use the helper in the holdings endpoint response serializer
  • Add unit tests for the helper covering: single entry, multiple entries, all zero prices

Acceptance Criteria

  • Helper returns correct sum for multiple holdings
  • Helper returns zero when all prices are zero
  • Holdings endpoint response includes correct total_portfolio_value field

Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions