Skip to content
Dio Stania Adinata, home
Back to projects

Quantitative Finance · /actura

Actura

Quantitative Risk & Valuation Platform

Role:
Solo developer: FastAPI engine, Vue 3 / Vue Flow workbench, ECharts, Docker
Team:
Solo Project

An open-source actuarial valuation platform that evaluates life-insurance cash flows as a Directed Acyclic Graph (DAG), with deterministic Best Estimate Liability (BEL) projections and Monte Carlo risk metrics.

Actura

Overview

Actura is a solo open-source project for valuing life-insurance liabilities. A FastAPI backend evaluates cash-flow blueprints as a DAG. The deterministic run projects BEL under fixed best-estimate mortality, interest, and lapse assumptions; the stochastic run simulates interest-rate scenarios with a Vasicek economic scenario generator (with optional dynamic lapse) and reports the resulting liability distribution, including the scenario mean BEL, VaR 95%, and CVaR / CTE 95. A Vue 3 frontend provides a node-based logic workbench built with Vue Flow, plus ECharts visualizations, and the stack runs with Docker Compose alongside PostgreSQL.

Problem

Actuarial valuation tools are often spreadsheets or closed systems that are hard to inspect. The goal was a platform where cash-flow structures (mortality decrements, premium schedules, and benefit payments) are designed in a visual editor, while the numbers stay verifiable against analytical results.

Solution

A drag-and-drop DAG editor for designing cash-flow blueprints without hand-coding formulas. Each node represents a cash-flow component; edges represent dependencies and sequencing. The engine evaluates the DAG deterministically for a BEL point estimate, and stochastically via Monte Carlo for the liability distribution.

Architecture & Core Systems

Decoupled architecture: a Vue 3 SPA for graph interactions and charting, backed by a FastAPI REST API for the valuation engine. PostgreSQL via SQLAlchemy for persistence and Nginx as a reverse proxy. All services run with Docker Compose for a consistent local setup.

Technical Implementation

Cash-flow evaluation as a topologically sorted DAG: nodes are typed (premium, benefit, decrement) and evaluated in dependency order using Kahn's algorithm, and cyclic graphs are rejected before evaluation. Monte Carlo paths are generated from a seeded Vasicek interest-rate model with configurable parameters, and risk metrics are computed across the simulated BEL distribution.

Quantitative Methodology

Deterministic run: projects cash flows under fixed best-estimate mortality, interest, and lapse assumptions and discounts them to a single BEL point estimate. Stochastic run: simulates N interest-rate paths with a Vasicek economic scenario generator, optionally with dynamic lapse that responds to market rates. Each path yields its own BEL, so the output is a liability distribution summarised by the scenario mean BEL and tail metrics. Mortality comes from life tables in both runs. Risk Metrics: VaR 95% (the 95th percentile of the simulated BEL distribution) and CVaR / CTE 95 (the expected BEL given that it exceeds VaR 95%).

Challenges

  • Deterministic vs. stochastic consistency: with interest-rate volatility set to zero, the mean BEL over 10,000 scenarios must match the analytical deterministic value within 2% for three different seeds, and a fixed seed must reproduce the BEL and the full path array exactly.
  • Deterministic accuracy: whole-life and term expected present values are checked against analytical benchmarks to a relative tolerance of 1e-12.
  • DAG evaluation order: nodes are ordered with Kahn's algorithm and graphs containing a cycle are rejected before evaluation; a separate depth-first validator reports the offending cycle path in the editor.

Results

  • Performance (AMD Ryzen 7 7735HS, 16 GB RAM): 10,000 Monte Carlo paths in 0.07 s and 100,000 paths in 0.80 s (median of 3 runs); a deterministic valuation of a 10,000-policy synthetic portfolio in 0.12 s.
  • Validation: deterministic values match analytical benchmarks to 1e-12; the 10,000-scenario mean BEL stays within the 2% convergence tolerance for three seeds; seeded runs are exactly reproducible.
  • Delivery: open-source on GitHub with a Docker Compose setup (FastAPI, Vue 3 behind Nginx, PostgreSQL).

Lessons Learned

Visual, node-based editors are a natural fit for mapping insurance cash-flow logic. Separating the DAG data model from its evaluation engine makes the system easier to test and extend.

Screenshots & Preview

Visual assets and captures from Actura. Click any image to open the full-resolution preview.