FinanceRustler.Solver (FinanceRustler v0.1.0)

Copy Markdown View Source

A native Finance.Solver backed by a Rust NIF — the same safeguarded Newton (rtsafe) the pure-Elixir default uses, ported to Rust.

This is an opt-in backend. Add both packages to your project and point the solver at this module:

# mix.exs
{:finance, "~> 1.5"},
{:finance_rustler, "~> 0.1"}

# config/config.exs
config :finance, solver: FinanceRustler.Solver

or per call:

Finance.CashFlow.xirr(flows, solver: FinanceRustler.Solver)

The result matches the default solver — both find the same root to the requested :precision. This backend exists for throughput: solve_many/2 runs a whole batch in one call, parallelized across a rayon thread pool, and single solves are faster on long-horizon flows. It changes no numbers.