Inspiration

Personal finance apps benchmark investments against generic market indexes, ignoring a family's true financial liability: the future cost of their actual consumption basket. A household spending heavily on food and transit faces a much higher, more volatile personal inflation rate than headline CPI figures suggest. Inspired by the Liability-Driven Investment (LDI) strategies used by major pension funds, we built pLDI (Personal LDI) to help Mexican families build an institutional-grade portfolio that directly hedges their real cost of living.

What it does

LifeHedge parses bank statement PDFs securely in memory to categorize household spending into six official categories and calculate the Divergence Delta between personal inflation and headline CPI. It then solves a convex quadratic programming (QP) problem across eight assets in Mexican Pesos to construct an optimal hedge portfolio that significantly outperforms standard Cetes holdings. The platform also runs a Merton jump-diffusion Monte Carlo simulation to project downside tail risks (95% VaR and CVaR), provides drift alerts, and exports a print-ready executive PDF report.

How we built it

We built the backend with FastAPI, cvxpy (Clarabel solver), NumPy, and Pandas for convex portfolio optimization and stochastic jump calibration, using pdfplumber for statement parsing. Financial data is pulled from INEGI (CPI sub-indices), Banxico (UDI and Cetes series), and Yahoo Finance, backed by a disk-caching layer with offline fallback snapshots to guarantee zero downtime. The frontend was built with React 19, Vite, and Recharts, featuring pre-bundled demo data to ensure instant load times and eliminate server cold starts.

Challenges we ran into

We replaced broken third-party scraping libraries by writing a custom HTTP client for Yahoo Finance, and integrated Banco de México's official SIE API to resolve missing historical data for local fixed-income assets. We also eliminated false-positive merchant matches in bank statements using strict regex word boundaries. Finally, we engineered an offline-first fallback architecture with local snapshots so the live app remains completely immune to server cold starts or external API outages.

Accomplishments that we're proud of

We translated complex institutional mathematics—convex QP optimization and Merton jump-diffusion processes—into an intuitive, interactive tool accessible to everyday households. We achieved 100% test coverage with 66 hermetic offline tests, designed a zero-persistence privacy architecture for bank statements, and ensured sub-second page rendering without broken views.

What we learned

Real household inflation in Mexico diverges substantially from official headline CPI, especially for families with high essential expenses like food and transit. We also confirmed that converting global assets into Mexican Pesos turns currency exposure into an active hedge against imported inflation, and that graceful local fallbacks are essential for mission-critical financial applications.

What's next for LifeHedge

We plan to expand our optimizer to support multi-liability goals (such as college savings and home down payments), add OCR to process physical paper receipts, and integrate with Mexican brokerage APIs like GBM or STP for one-click rebalancing. We also aim to partner with corporate payroll programs, such as Grupo Coppel, to offer automated personal LDI accounts for employees.

Built With

Share this project:

Updates

Submission history