DerivaSharp.Gpu.Linux 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DerivaSharp.Gpu.Linux --version 1.0.0
                    
NuGet\Install-Package DerivaSharp.Gpu.Linux -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DerivaSharp.Gpu.Linux" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DerivaSharp.Gpu.Linux" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DerivaSharp.Gpu.Linux" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DerivaSharp.Gpu.Linux --version 1.0.0
                    
#r "nuget: DerivaSharp.Gpu.Linux, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DerivaSharp.Gpu.Linux@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DerivaSharp.Gpu.Linux&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DerivaSharp.Gpu.Linux&version=1.0.0
                    
Install as a Cake Tool

DerivaSharp

CI .NET 10 License: MIT

DerivaSharp is a .NET 10 library for pricing single-asset derivatives under the Black-Scholes-Merton model. It provides a consistent, strongly typed API across closed-form, numerical integration, finite-difference, binomial-tree, and Monte Carlo engines.

The library is intended for quantitative research, model validation, prototyping, and integration into .NET pricing services.

Capabilities

Product Supported methods
European vanilla options Closed form, numerical integration, finite difference, binomial tree, Monte Carlo
American vanilla options Bjerksund-Stensland 2002, finite difference, binomial tree, Longstaff-Schwartz Monte Carlo
Barrier options Closed form with discrete-barrier adjustment, finite difference
Digital options Closed form, numerical integration, finite difference
Binary-barrier options Closed form with discrete-barrier adjustment
Asian options Closed-form geometric average, Turnbull-Wakeman arithmetic average
Accumulators Finite difference, Monte Carlo
Autocallables Finite difference and Monte Carlo for snowball, binary snowball, ternary snowball, and Phoenix structures

Additional functionality includes:

  • Price and risk measures through a common engine API: delta, gamma, speed, theta, charm, color, vega, vanna, zomma, and rho.
  • Implied-volatility and implied-coupon solvers.
  • Vectorized price, delta, and gamma calculations over spot grids.
  • CPU execution by default, with optional CUDA acceleration for Monte Carlo engines.
  • Actual/365 Fixed day counts, a null calendar, and an SSE trading calendar.
  • Numerical utilities for quadrature, root finding, interpolation, distributions, and tridiagonal systems.

The current model scope assumes constant volatility, risk-free rate, and dividend yield. Validate model choice, numerical resolution, calibration inputs, and product conventions before using results in a production valuation or risk process.

Requirements

  • .NET 10 SDK
  • Windows x64 or Linux x64 when using an optional GPU runtime package
  • For GPU execution, a CUDA-capable NVIDIA GPU and compatible driver

Installation

Release packages use the following NuGet IDs:

dotnet add package DerivaSharp

For CUDA 12.8 support, add the platform-specific companion package:

dotnet add package DerivaSharp.Gpu.Windows
# or
dotnet add package DerivaSharp.Gpu.Linux

Public packages are published from GitHub releases. If no release is available on NuGet, clone the repository and reference src/DerivaSharp.csproj directly.

Quick Start

The following example prices a one-year European call and calculates its analytic Greeks:

using DerivaSharp.Instruments;
using DerivaSharp.Models;
using DerivaSharp.PricingEngines;
using DerivaSharp.Time;

DateOnly valuationDate = new(2025, 1, 6);
DateOnly expirationDate = valuationDate.AddYears(1);

EuropeanOption option = new(
    OptionType.Call,
    strikePrice: 100.0,
    effectiveDate: valuationDate,
    expirationDate);

BsmModelParameters model = new(
    volatility: 0.30,
    riskFreeRate: 0.04,
    dividendYield: 0.01);

PricingContext<BsmModelParameters> context = new(
    model,
    AssetPrice: 100.0,
    ValuationDate: valuationDate,
    Calendar: NullCalendar.Shared);

AnalyticEuropeanEngine engine = new();
PricingResult result = engine.ValueAndGreeks(option, context);

Console.WriteLine($"PV:    {result.Value:F6}"); // 13.151137
Console.WriteLine($"Delta: {result.Delta:F6}"); // 0.592749
Console.WriteLine($"Gamma: {result.Gamma:F6}"); // 0.012761

Engines are interchangeable where the instrument type permits it:

FdEuropeanEngine engine = new(
    FiniteDifferenceScheme.CrankNicolson,
    priceStepCount: 1_000,
    timeStepCount: 1_000);

double presentValue = engine.Value(option, context);
double impliedVolatility = engine.ImpliedVolatility(option, context, optionPrice: 13.151137);

Monte Carlo engines accept a deterministic seed and can opt into CUDA:

McEuropeanEngine engine = new(
    pathCount: 500_000,
    stepCount: 2,
    useCuda: true,
    seed: 42);

Conventions

Quantity Convention
Volatility and rates Annualized decimals; for example, 0.20 means 20%
Day count Actual/365 Fixed for calendar-time year fractions
Theta, charm, color Change per calendar day
Vega, vanna, zomma, rho Change per one percentage-point move
Valuation date Must fall between the instrument's effective and expiration dates, inclusive
Monte Carlo reproducibility Supply seed; convergence remains dependent on path and step counts

Build and Validate

dotnet restore DerivaSharp.slnx
dotnet build DerivaSharp.slnx --no-restore
dotnet test DerivaSharp.slnx --no-build --verbosity normal

Run the BenchmarkDotNet suite in Release mode:

dotnet run --project benchmarks/DerivaSharp.Benchmarks.csproj --configuration Release

Interactive examples are available in notebooks/, including European-option, accumulator, and snowball workflows.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 42 8/29/2026
1.0.0 64 8/26/2026