Skip to content

Financial Flows

apps/financial-flows is a standalone Python app (scaffolded via scripts/app-init.sh, not a workspace member) for modeling cash flow across accounts and optimizing repayment scheduling across multiple debt/payment obligations.

  • graph/flow_graph.py — builds a directed graph (networkx) of financial flows: accounts as nodes, cash flows (transfers, payments) as edges between them over a date range, queried from a SQL database via SQLModel/SQLAlchemy Session.
  • algorithms/RPML.py — implements a branch-and-bound algorithm for the Repayment of Multiple Loans Problem, based on Rios-Solis, Saucedo-Espinosa, and Caballero-Robledo’s “Repayment policy for multiple loans” (adapted for this company’s credit/vendor/subscription scenarios). Schedules payments across three obligation types: credits/loans (principal + underpayment penalty), vendors (accruable balance), and subscriptions (fixed, inflexible amounts).
  • models/core.py — SQLModel/Pydantic domain models (accounts, cash flows, transaction fees, etc.) backing both the graph and the algorithm.
  • exchange/rates.py — currency exchange rate handling for multi-currency flows.

Standalone Python app (pyproject.toml, requires-python = ">=3.12"), key dependencies: networkx (graph modeling), sqlmodel/SQLAlchemy (persistence), scipy (numerical optimization), numba (JIT-accelerated branch-and-bound). Has its own .envrc and uv.lock; tests live under src/financial_flows/testing/.

No direct relationship — separate domain (financial/cash-flow modeling vs. fuel volume regulatory reporting), separate stack (Python vs. Next.js), and separate deployment lifecycle. Both are apps/* because each is a standalone, non-workspace deliverable per the app vs. project vs. package distinction.