in finēOpen source

InFine.QuantFinance

Open-sourcequantitative financein C#.

Pricing, risk and calibration, with code you can read and run. Developed by in finē to share quantitative methods and explore their execution on CPU and GPU.

A European call, in C#
using InFine.QuantFinance.ClosedForm;

var call = BlackScholes.Greeks(
    OptionType.Call,
    spot: 100, strike: 100,
    maturity: 1.0, rate: 0.025,
    dividendYield: 0.01,
    volatility: 0.20);

Console.WriteLine(call.Price);
// 8.586530 (rounded)

Illustrative inputs. Expected output from the repository example.

Open the example
Runtime
C# / .NET 8
Execution
CPU · NVIDIA GPU
Library licence
MIT

Why we are opening the code

Built to teach. Shared to go further.

This project started as a training resource for our quants and quant developers: a way to connect financial models, their implementation and the realities of computation.

Previously shared through a private repository with our clients, it is now used in several financial institutions. We have cleaned up the code and released it under the MIT licence so that anyone can study it, use it and contribute.

An in finē training session on CPU and GPU architectures.
Sharing computational methods with our consultants.

Start with a working example

From a model to a calculation.

The repository includes runnable .NET examples with synthetic data and expected outputs. Follow a calculation, inspect its assumptions and try it on your machine.

Explore portfolio risk

Monte Carlo · VaR / ES · CPU / GPU

Full-revaluation Monte Carlo VaR and Expected Shortfall, with risk decomposition. Compare CPU and GPU results when the GPU setup is available.

Open the example — Explore portfolio risk

Also in the library: yield curves, Hull-White, portfolio construction, backtesting and an Excel add-in.

Browse all examples

Measured, with the trade-offs

The same C# kernels. Two ways to compute.

The compute kernels run on .NET. Hybridizer can compile those same kernels to CUDA for NVIDIA GPUs. The repository checks GPU results against their CPU counterparts.

Published benchmark timings
WorkloadCPU · all coresGPU · end to end
Monte Carlo VaR20M scenarios × 100 options × 101 factors12.96 s5.73 s
Bootstrap backtest1M paths × 2,520 days × 10 assets5.27 s2.62 s
Heston COS2M options8.67 s3.88 s
Black-Scholes1M options · transfer-bound5.9 ms23.9 ms

Ryzen 9 7845HX (24 threads), RTX 4070 Laptop (8 GB), Windows. .NET 8, BenchmarkDotNet 0.15.8, double precision. GPU timings include host-device transfers.

The GPU helps on these heavy workloads. On the smaller Black-Scholes workload, data transfers make the CPU faster. Your workload and hardware determine the result.

Read the measurements and methodology

Use it, inspect it, contribute

An open starting point for your own work.

Start on CPU with the .NET 8 SDK. Follow the GPU guide for the additional NVIDIA and Hybridizer setup, or explore the Excel examples.

Install the pricing package

dotnet add package InFine.QuantFinance.ClosedForm

MIT library. Separate GPU tooling.

The library is released under MIT. Hybridizer is a separate product with its own terms; its publisher asks you to contact them for commercial use. Third-party dependencies retain their respective licences.

Licence and third-party notices

An evolving library, with a defined scope.

The project is pre-1.0 and its public API may change between minor versions. Multi-curve rates, credit and FX are outside the current scope. Review the documented limitations and validate the models for your intended use.

Status and known limitations

The people behind the code

Talk to our quant and IT-quant teams.

Adapting a model, integrating a calculation or understanding a performance bottleneck: these are the kinds of problems our consultants work on with financial institutions.