mirror of
https://github.com/Zproger/Aurum.git
synced 2026-11-06 07:47:23 +07:00
Initial public release
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
This commit is contained in:
66
backend/app/schemas/net_worth.py
Normal file
66
backend/app/schemas/net_worth.py
Normal file
@@ -0,0 +1,66 @@
|
||||
from datetime import date as date_
|
||||
from decimal import Decimal
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class NetWorthPoint(BaseModel):
|
||||
date: date_
|
||||
value: Decimal
|
||||
|
||||
|
||||
class NetWorthBreakdownItem(BaseModel):
|
||||
key: str
|
||||
name: str
|
||||
color: str
|
||||
icon: str
|
||||
amount: Decimal
|
||||
percent: float
|
||||
|
||||
|
||||
class CapitalRoleSummary(BaseModel):
|
||||
"""Assets grouped by how they behave month to month (see CapitalRole) —
|
||||
a cross-cut of the asset-class breakdown, not a replacement for it."""
|
||||
|
||||
role: str
|
||||
label: str
|
||||
color: str
|
||||
total_value: Decimal
|
||||
monthly_cash_flow: Decimal
|
||||
count: int
|
||||
|
||||
|
||||
class RiskLevelItem(BaseModel):
|
||||
"""One holding within a risk tier — Cash (key="cash") or a single asset
|
||||
(key=f"asset:{id}"). This list IS the diversification view: a tier with
|
||||
one item at 100% is concentrated, several items with even shares aren't,
|
||||
no separate score needed."""
|
||||
|
||||
key: str
|
||||
name: str
|
||||
amount: Decimal
|
||||
percent: float # share of this tier, not of total capital
|
||||
|
||||
|
||||
class RiskLevelSummary(BaseModel):
|
||||
"""Cash + assets grouped by user-tagged risk of loss (see RiskLevel) —
|
||||
another cross-cut, like capital_roles, but Cash participates here since
|
||||
it's the zero-risk anchor an 80/20-style allocation rule needs."""
|
||||
|
||||
risk_level: str
|
||||
label: str
|
||||
color: str
|
||||
total_value: Decimal
|
||||
percent: float # share of total capital (cash + assets)
|
||||
items: list[RiskLevelItem]
|
||||
|
||||
|
||||
class NetWorthSummary(BaseModel):
|
||||
range: str
|
||||
current: Decimal
|
||||
change_amount: Decimal
|
||||
change_percent: float | None
|
||||
series: list[NetWorthPoint]
|
||||
breakdown: list[NetWorthBreakdownItem]
|
||||
capital_roles: list[CapitalRoleSummary]
|
||||
risk_levels: list[RiskLevelSummary]
|
||||
Reference in New Issue
Block a user