from fin_infra.budgets.tracker import BudgetTrackerBudget CRUD and progress tracking. Provides methods for creating, reading, updating, and deleting budgets, as well as calculating spending progress against budgeted amounts. Generic Design: - Works with any budget type (personal, household, business, project) - Integrates with svc-infra SQL for persistence - Integrates with fin-infra categorization for transaction mapping - Supports rollover budgets (unused amounts carry over) Integration: - Uses svc-infra SQL for budget storage (SqlRepository pattern) - Uses fin-infra categorization for transaction category mapping - TODO: Uses svc-infra cache for progress calculations (24h TTL) - TODO: Uses svc-infra webhooks for budget alerts
db_engine: SQLAlchemy async engine session_maker: Async session factory
>>> from sqlalchemy.ext.asyncio import create_async_engine >>> engine = create_async_engine("postgresql+asyncpg://localhost/db") >>> tracker = BudgetTracker(db_engine=engine) >>> >>> # Create monthly budget >>> budget = await tracker.create_budget( ... user_id="user123", ... name="November 2025", ... type="personal", ... period="monthly", ... categories={"Groceries": 600.00, "Dining": 200.00}, ... rollover_enabled=True ... ) >>> print(budget.id) # UUID string