Initial commit: investment dashboard with contributions panel and forecast chart
React + Vite frontend with a local-JSON-backed API (Vite middleware) for tracking portfolio holdings, contributions/withdrawals, recurring contribution plans, and a forecast chart comparing the portfolio's real value against a same-contributions S&P 500 benchmark. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
86
server/types.ts
Normal file
86
server/types.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
export type AssetClass = "Renta Variable" | "Renta Fija" | "Liquidez";
|
||||
|
||||
export interface Holding {
|
||||
name: string;
|
||||
value: number;
|
||||
changeAmount: number;
|
||||
changePercent: number;
|
||||
assetClass: AssetClass;
|
||||
region: string;
|
||||
}
|
||||
|
||||
export interface Portfolio {
|
||||
asOf: string;
|
||||
cash: number;
|
||||
invested: number;
|
||||
marketValueChange: number;
|
||||
marketValueChangePercent: number;
|
||||
assetAllocation: Record<string, number>;
|
||||
holdings: Holding[];
|
||||
}
|
||||
|
||||
export interface HistorySnapshot {
|
||||
date: string;
|
||||
marketValue: number;
|
||||
}
|
||||
|
||||
export interface History {
|
||||
snapshots: HistorySnapshot[];
|
||||
}
|
||||
|
||||
/**
|
||||
* aportacion/retirada = external cash flow (bank <-> account) and count toward TWR/baseline math.
|
||||
* suscripcion_fondo/reembolso_fondo = internal moves between cash and a fund; net-zero on total
|
||||
* account value, so they're excluded from flow math but still shown in the movements ledger.
|
||||
* apertura = informational account-opening marker.
|
||||
*/
|
||||
export type MovementKind =
|
||||
| "aportacion"
|
||||
| "retirada"
|
||||
| "suscripcion_fondo"
|
||||
| "reembolso_fondo"
|
||||
| "apertura"
|
||||
| "otro";
|
||||
|
||||
export interface Movement {
|
||||
id: string;
|
||||
date: string;
|
||||
kind: MovementKind;
|
||||
amount: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export type Frequency = "weekly" | "biweekly" | "monthly" | "quarterly" | "yearly";
|
||||
|
||||
export interface RecurringPlan {
|
||||
id: string;
|
||||
amount: number;
|
||||
frequency: Frequency;
|
||||
startDate: string;
|
||||
endDate?: string;
|
||||
active: boolean;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
export interface Contributions {
|
||||
recurringPlans: RecurringPlan[];
|
||||
movements: Movement[];
|
||||
}
|
||||
|
||||
export interface Settings {
|
||||
inceptionDate: string;
|
||||
forecastYears: number;
|
||||
returnAssumption: "historical" | "custom";
|
||||
customAnnualReturnPct?: number;
|
||||
}
|
||||
|
||||
export interface SP500Point {
|
||||
date: string;
|
||||
close: number;
|
||||
}
|
||||
|
||||
export interface SP500Data {
|
||||
source: string;
|
||||
updatedAt: string;
|
||||
series: SP500Point[];
|
||||
}
|
||||
Reference in New Issue
Block a user