Skip to content

Add calculateSIP utility for rounded month-wise SIP projections#1

Merged
Tejas164321 merged 1 commit into
mainfrom
copilot/build-investments-page
May 25, 2026
Merged

Add calculateSIP utility for rounded month-wise SIP projections#1
Tejas164321 merged 1 commit into
mainfrom
copilot/build-investments-page

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 25, 2026

This PR introduces a typed calculateSIP function in src/lib/calculators.ts to generate month-by-month SIP projections from monthly contribution, annual return rate, and tenure. It returns month, invested, returns, and gain per month, with all numeric outputs rounded via Math.round().

  • New calculator module

    • Added src/lib/calculators.ts.
    • Exported SIPProjection interface and calculateSIP(...) function.
  • SIP projection logic

    • Computes monthly projections for the full tenure (years * 12).
    • Uses standard SIP compounding (annuity-due form):
      M * (((1 + r)^n - 1) / r) * (1 + r).
  • Output contract guarantees

    • Returns an array of { month, invested, returns, gain }.
    • Applies Math.round() to every returned numeric field.
    • Handles annualReturnRate = 0 without division by zero.
export function calculateSIP(
  monthlyAmount: number,
  annualReturnRate: number,
  years: number
): SIPProjection[] {
  // month-wise rounded SIP projections
}

@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fin-pal Ready Ready Preview, Comment May 25, 2026 9:12am

@Tejas164321 Tejas164321 marked this pull request as ready for review May 25, 2026 09:12
@Tejas164321 Tejas164321 merged commit 128e430 into main May 25, 2026
3 checks passed
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.

2 participants