Open source
V-STAR
A fast, readable actuarial engine in Go. Valuation, annuities, reserves, Monte Carlo and risk measures, with zero dependencies.
Why I built it
Ask anyone who has valued a large policy census in a spreadsheet. Excel freezes or crashes, VBA macros that nobody fully understands hold the process together, and proprietary tools hide the maths. I wanted the opposite: an engine where the formulas are right there in the source, that processes a large census in seconds, and that anyone can run.
V-STAR is that engine. It brings actuarial operations that are usually prototyped in spreadsheets or scripts into a codebase that can be inspected, tested and run as software.
Where the name comes from
It started as a joke in class. If premiums compound at a rate j but you discount at i, the new discount factor is v* = (1 + j) × v. The star marks the difference, and it stuck.
What it covers
| Area | What it does |
|---|---|
| Present value | Standard and v* discount factors, the base of everything else. |
| Annuities | Whole life, term and deferred, using real mortality tables. |
| Reserves | Net and gross premium, prospective and retrospective. |
| Monte Carlo | Geometric Brownian motion and Vasicek mean-reverting rate models. |
| Risk measures | VaR, CTE and expected shortfall, with confidence intervals. |
| Multiple decrements | Death, lapse and disability combined into one table. |
| CSV streaming | Process millions of policy rows without loading the file into memory. |
| HTTP API | The same calculations as REST endpoints, usable from any language. |
Design choices
- Zero dependencies. Standard library only, so there is no package manager, no version conflicts and nothing to audit beyond the project itself.
- Readable on purpose. Every formula is visible in the source. For actuarial work, being able to audit the calculation matters as much as getting the answer.
- Concurrency where it helps. Go makes parallelism straightforward. Valuation and Monte Carlo both run in parallel, and a generic worker pool supports context cancellation.
- Small, composable interfaces. Stochastic generators, contingency calculators and record writers are defined as interfaces, so concrete types plug in without ceremony. Census data can be streamed from any
io.Reader, including a file, standard input or an HTTP body. - One binary. The command line tool and the HTTP server ship as a single executable that runs anywhere Go does.
Performance
These figures come from the project's own benchmark suite, run on an Intel i5-8250U laptop with an NVMe drive, plugged in. They show what this engine does on this machine, not a universal ranking, and each tool was measured on one observed run.
Reading a 10 million row CSV (288 MB)
| Tool | Time | Memory |
|---|---|---|
| V-STAR (memory-mapped) | 0.80 s | 1.3 GB, as OS page cache |
| V-STAR (streaming) | 1.12 s | About 0.2 MB, constant |
| Polars | About 535 ms | About 500 MB |
| Pandas | About 30 s | Over 2 GB |
Read that table honestly. Polars parses the file faster than V-STAR does. What V-STAR offers is a streaming mode that keeps memory flat at a fraction of a megabyte however large the file gets, plus a memory-mapped mode that reads in under a second with no copying. Which one wins depends on whether time or memory is the constraint.
Monte Carlo, 100,000 paths
| Tool | Time |
|---|---|
| V-STAR | 27 ms |
| Python with NumPy | About 2 s |
| R | About 5 s |
Individual operations
| Operation | Time |
|---|---|
| Present value (single call, direct) | 2.6 ns |
| Whole life annuity (90 terms) | 512 ns |
| Monte Carlo (100k paths, 10 steps) | 27 ms |
| VaR and CTE report (100k losses) | 0.42 ms |
| Valuation (10M policies, parallel) | 37 ms |
Timings vary with hardware and comparison setup. Run ./v-star bench and --benchmark locally to compare on your own machine.
Using it
V-STAR works as a Go library, a command line tool and an HTTP service.
# install the library
go get github.com/lubasinkal/v-star
# process a policy CSV and time it
./v-star read policies.csv --benchmark
# run a Monte Carlo simulation
./v-star montecarlo --paths=100000 --steps=10 --seed=42
# start the HTTP server
./v-star serve --port=8080The HTTP API exposes the same engine at /health, /value, /simulate, /annuity and /reserve, returning JSON. That makes it usable from Python, R, JavaScript or even Excel VBA. The repository has client examples in several languages, and it is the source of truth for current APIs and setup.
Where it is used
Actuworry, my live life insurance calculator, uses V-STAR for its Monte Carlo, risk, rate conversion and retrospective reserve endpoints.
What is next
The roadmap points at a v0.8.0 release with more reserve methods, a census source interface, profit testing and a Dockerfile, followed by v1.0.0 with a stable API and broader test coverage. The full plan lives in the repository's roadmap.