PortOpt 1.0.0
See the version list below for details.
dotnet add package PortOpt --version 1.0.0
NuGet\Install-Package PortOpt -Version 1.0.0
<PackageReference Include="PortOpt" Version="1.0.0" />
<PackageVersion Include="PortOpt" Version="1.0.0" />
<PackageReference Include="PortOpt" />
paket add PortOpt --version 1.0.0
#r "nuget: PortOpt, 1.0.0"
#:package PortOpt@1.0.0
#addin nuget:?package=PortOpt&version=1.0.0
#tool nuget:?package=PortOpt&version=1.0.0
PortOpt
Portfolio optimization for .NET on a native C++23 engine: minimum variance, maximum return under a volatility cap, maximum Sharpe, utility, importance, Kelly, tracking error, maximum diversification and risk parity, with scalar or per-weight bounds, a gross exposure limit (leverage) and an optional risk-free asset. The package carries the native library for linux-x64, linux-arm64, linux-musl-x64, linux-musl-arm64, osx-arm64, osx-x64 and win-x64, and is trimming- and Native AOT-compatible.
using PortOpt;
double[] mu = [0.08, 0.12, 0.10];
double[,] covariance =
{
{ 0.040, 0.006, 0.010 },
{ 0.006, 0.090, 0.012 },
{ 0.010, 0.012, 0.060 },
};
using var data = new MarketData(new MarketInputs { Mu = mu, Covariance = covariance, RiskFree = 0.02 });
var result = Optimizer.Solve(new Spec { Objective = Objective.MaxSharpe, Bounds = new Bounds(0, 1) }, data);
Console.WriteLine($"{result.Status}: {string.Join(", ", result.Weights)}");
Console.WriteLine($"Sharpe {data.SharpeRatio(result.Weights)}");
Specis an immutable record: the objective and the settings it takes (TargetReturn,RiskAversion,Importance,MaxVolatility,Leverage,TargetVolatility,RiskBudget,BoundsorWeightBounds).MarketDataholds a native handle: dispose it (using). With a risk-free rate the cash weight comes last.Resultis plain values: status, weights, iterations, the multipliers and the residual.- A native failure is a
PortOptExceptionwith itsStatusand the library's message; an infeasible problem is a result withSolveStatus.Infeasible, not an exception. PORTOPT_LIBloads a local build of the native library instead of the packaged one.
The C header portopt.h is the reference for every objective, setter and multiplier:
https://github.com/GabrielMarquezMatte/PortfolioOptimization
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
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 | 41 | 11/26/2026 |
| 1.0.0 | 58 | 11/25/2026 |
| 1.0.0-rc.1 | 67 | 11/21/2026 |