Full-stack self-hosted finance app with FastAPI backend and React frontend. Features: - Accounts, transactions, budgets, investments with GBP base currency - CSV import with auto-detection for 10 UK bank formats - ML predictions: spending forecast, net worth projection, Monte Carlo - 7 selectable themes (Obsidian, Arctic, Midnight, Vault, Terminal, Synthwave, Ledger) - Receipt/document attachments on transactions (JPEG, PNG, WebP, PDF) - AES-256-GCM field encryption, RS256 JWT, TOTP 2FA, RLS, audit log - Encrypted nightly backups + key rotation script - Mobile-responsive layout with bottom nav Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
96 lines
1.9 KiB
Python
96 lines
1.9 KiB
Python
from datetime import date as DateType
|
|
from decimal import Decimal
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class NetWorthPoint(BaseModel):
|
|
date: DateType
|
|
total_assets: Decimal
|
|
total_liabilities: Decimal
|
|
net_worth: Decimal
|
|
base_currency: str
|
|
|
|
|
|
class NetWorthReport(BaseModel):
|
|
points: list[NetWorthPoint]
|
|
current_net_worth: Decimal
|
|
change_30d: Decimal
|
|
change_30d_pct: Decimal
|
|
base_currency: str
|
|
|
|
|
|
class IncomeExpensePoint(BaseModel):
|
|
month: str # "2024-01"
|
|
income: Decimal
|
|
expenses: Decimal
|
|
net: Decimal
|
|
|
|
|
|
class IncomeExpenseReport(BaseModel):
|
|
points: list[IncomeExpensePoint]
|
|
total_income: Decimal
|
|
total_expenses: Decimal
|
|
avg_monthly_income: Decimal
|
|
avg_monthly_expenses: Decimal
|
|
currency: str
|
|
|
|
|
|
class CashFlowPoint(BaseModel):
|
|
date: DateType
|
|
inflow: Decimal
|
|
outflow: Decimal
|
|
net: Decimal
|
|
running_balance: Decimal
|
|
|
|
|
|
class CashFlowReport(BaseModel):
|
|
points: list[CashFlowPoint]
|
|
total_inflow: Decimal
|
|
total_outflow: Decimal
|
|
currency: str
|
|
|
|
|
|
class CategoryBreakdownItem(BaseModel):
|
|
category_id: str | None
|
|
category_name: str
|
|
amount: Decimal
|
|
percent: Decimal
|
|
transaction_count: int
|
|
|
|
|
|
class CategoryBreakdownReport(BaseModel):
|
|
items: list[CategoryBreakdownItem]
|
|
total: Decimal
|
|
currency: str
|
|
date_from: DateType
|
|
date_to: DateType
|
|
|
|
|
|
class BudgetVsActualItem(BaseModel):
|
|
budget_id: str
|
|
budget_name: str
|
|
category_name: str
|
|
budgeted: Decimal
|
|
actual: Decimal
|
|
variance: Decimal
|
|
percent_used: Decimal
|
|
|
|
|
|
class BudgetVsActualReport(BaseModel):
|
|
items: list[BudgetVsActualItem]
|
|
total_budgeted: Decimal
|
|
total_actual: Decimal
|
|
currency: str
|
|
|
|
|
|
class SpendingTrendPoint(BaseModel):
|
|
month: str
|
|
category_name: str
|
|
amount: Decimal
|
|
|
|
|
|
class SpendingTrendsReport(BaseModel):
|
|
points: list[SpendingTrendPoint]
|
|
categories: list[str]
|
|
currency: str
|