DerivaSharp.Gpu.Linux
1.0.0
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
<PackageReference Include="DerivaSharp.Gpu.Linux" Version="1.0.0" />
<PackageVersion Include="DerivaSharp.Gpu.Linux" Version="1.0.0" />
<PackageReference Include="DerivaSharp.Gpu.Linux" />
paket add DerivaSharp.Gpu.Linux --version 1.0.0
#r "nuget: DerivaSharp.Gpu.Linux, 1.0.0"
#:package DerivaSharp.Gpu.Linux@1.0.0
#addin nuget:?package=DerivaSharp.Gpu.Linux&version=1.0.0
#tool nuget:?package=DerivaSharp.Gpu.Linux&version=1.0.0
DerivaSharp
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.
Learn more about Target Frameworks and .NET Standard.
-
- DerivaSharp (= 1.0.0)
- libtorch-cuda-12.8-linux-x64 (= 2.10.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.