Skip to content

asancdec/UnifiedVol

Repository files navigation

C++20 License: Apache 2.0 PRs welcome CI SonarQube Quality Gate CodeQL Clang-Tidy codecov

UnifiedVol

UnifiedVol is a C++20 quantitative finance library for volatility surface modelling.

This project is designed around clean architecture, modular C++20 components, optimized numerical routines, and reproducible CI. It combines calibration pipelines, explicit model validation, regression and performance guardrails, public-data fixtures, and documented model implementations.


Milestones

  • C++20 library with CMake/vcpkg presets for reproducible Linux GCC builds
  • SVI and Heston calibration pipelines with NLopt and Ceres Solver integration
  • Numerical methods including tanh-sinh integration, Thomas solver, B-splines, PCHIP/Fritsch-Carlson interpolation, non-uniform grids, and root-finding utilities
  • Core market-data objects for curves, volatility surfaces, and market states
  • Unit, integration, regression, and performance tests with CI and coverage guardrails

Architecture

In the diagram below, arrows mean "depends on, includes, or calls".

flowchart LR
    subgraph Clients["Clients"]
        direction TB
        Examples[examples]
        Tests[tests]
    end

    subgraph Public["Public API"]
        direction TB
        API[uv/UnifiedVol.hpp]
    end

    subgraph Domain["Domain Layer"]
        direction TB
        Models[uv/Models<br/>SVI, Heston]
        IO[uv/IO]
        Core[uv/Core]
    end

    subgraph Numerics["Numerical Layer"]
        direction TB
        Math[uv/Math]
        Opt[uv/Optimization]
    end

    subgraph Foundation["Foundation"]
        direction TB
        Base[uv/Base]
    end

    subgraph External["External"]
        direction TB
        ExtTest[GoogleTest]
        ExtOpt[NLopt / Ceres]
        ExtMath[Boost.Math<br/>lets_be_rational]
    end

    Examples --> API
    Tests --> API
    Tests --> ExtTest

    API --> Base
    API --> Core
    API --> IO
    API --> Models
    API --> Math
    API --> Opt

    Core --> Base

    IO --> Base
    IO --> Core
    IO --> Math

    Models --> Base
    Models --> Core
    Models --> Math
    Models --> Opt

    Math --> Base
    Math --> Core
    Math --> ExtMath

    Opt --> Base
    Opt --> ExtOpt

    Examples ~~~ Tests
    Models ~~~ IO
    Math ~~~ Opt
    Base ~~~ ExtTest
Loading

Example Usage

Below is a minimal excerpt illustrating the structure of a typical calibration pipeline.
See the examples/ directory for complete working programs.

// -------------- Market data -------------

// Build
const core::MarketState<Real> marketState{io::csv::load::marketState(path, marketData)
};

// Inspect
io::report::volatility(marketState);

// --------------  SVI calibration -------------

// Calibrate
const core::VolSurface<Real> sviVolSurface{models::svi::buildSurface(marketState)
};

// Inspect
io::report::volatility(sviVolSurface);

// --------------  Heston calibration --------------

// Calibrate
const core::VolSurface<Real> hestonVolSurface{
    models::heston::buildSurface<Real>(sviVolSurface, marketState)
};

// Inspect
io::report::volatility(hestonVolSurface);

Documentation

For model and numerical-method references, see References. Full BibTeX entries are available in citations.bib.


Disclaimer

This repository is under active development. Interfaces, APIs, and model implementations are subject to change.

This software is provided for research and educational purposes only. It is not investment advice and must not be used in trading systems.

All model implementations, numerical methods, and market data included in this repository are derived exclusively from publicly available sources. These sources are cited and documented in docs/references.md, citations.bib, and docs/DATA.md.

This project is Apache License 2.0 compliant, and all third-party dependencies are used and distributed in accordance with their respective licenses.