{"id":23826414,"url":"https://github.com/rust-dd/stochastic-rs","last_synced_at":"2026-02-18T10:03:59.406Z","repository":{"id":168422149,"uuid":"643626037","full_name":"rust-dd/stochastic-rs","owner":"rust-dd","description":"stochastic-rs is a Rust library designed for high-performance simulation and analysis of stochastic processes and models in quant finance.","archived":false,"fork":false,"pushed_at":"2026-02-15T08:35:07.000Z","size":10604,"stargazers_count":122,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-15T14:47:09.999Z","etag":null,"topics":["ai","finance","malliavin-calculus","quant","quantitative-finance","rust","simulation","statistics","stochastic","stochastic-processes"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/stochastic-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-dd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-05-21T18:53:19.000Z","updated_at":"2026-02-15T09:52:03.000Z","dependencies_parsed_at":"2024-01-16T23:25:42.788Z","dependency_job_id":"a000b9b1-7937-4eb9-ae12-5c0d0145bccd","html_url":"https://github.com/rust-dd/stochastic-rs","commit_stats":{"total_commits":71,"total_committers":2,"mean_commits":35.5,"dds":"0.028169014084507005","last_synced_commit":"88f6f2e14748e6d6753586b34ee3211f4edec40d"},"previous_names":["dancixx/stochastic-rs","rust-dd/stochastic-rs"],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/rust-dd/stochastic-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-dd%2Fstochastic-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-dd%2Fstochastic-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-dd%2Fstochastic-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-dd%2Fstochastic-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-dd","download_url":"https://codeload.github.com/rust-dd/stochastic-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-dd%2Fstochastic-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29575343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","finance","malliavin-calculus","quant","quantitative-finance","rust","simulation","statistics","stochastic","stochastic-processes"],"created_at":"2025-01-02T12:20:03.063Z","updated_at":"2026-02-18T10:03:59.389Z","avatar_url":"https://github.com/rust-dd.png","language":"Rust","funding_links":[],"categories":["Libraries","Recently Updated"],"sub_categories":["Finance","[Who Wants to Be a Millionare](https://www.boardgamecapital.com/who-wants-to-be-a-millionaire-rules.htm)"],"readme":"![Build Workflow](https://github.com/dancixx/stochastic-rs/actions/workflows/rust.yml/badge.svg)\n[![Crates.io](https://img.shields.io/crates/v/stochastic-rs?style=flat-square)](https://crates.io/crates/stochastic-rs)\n![License](https://img.shields.io/crates/l/stochastic-rs?style=flat-square)\n[![codecov](https://codecov.io/gh/dancixx/stochastic-rs/graph/badge.svg?token=SCSp3z7BQJ)](https://codecov.io/gh/dancixx/stochastic-rs)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fdancixx%2Fstochastic-rs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fdancixx%2Fstochastic-rs?ref=badge_shield)\n\n# stochastic-rs\n\nA high-performance Rust library for simulating stochastic processes, with first-class bindings. Built for quantitative finance, statistical modeling and synthetic data generation.\n\n## Features\n\n- **85+ stochastic models** — diffusions, jump processes, stochastic volatility, interest rate models, autoregressive models, noise generators, and probability distributions\n- **Copulas** — bivariate, multivariate, and empirical copulas with correlation utilities\n- **Quant toolbox** — option pricing, bond analytics, calibration, loss models, order book, and trading strategies\n- **Statistics** — MLE, kernel density estimation, fractional OU estimation, and CIR parameter fitting\n- **SIMD-optimized** — fractional Gaussian noise, fractional Brownian motion, and all probability distributions use wide SIMD for fast sample generation\n- **Parallel sampling** — `sample_par(m)` generates `m` independent paths in parallel via rayon\n- **Generic precision** — most models support both `f32` and `f64`\n- **Bindings** — full stochastic model coverage with numpy integration; all models return numpy arrays\n\n## Installation\n\n### Rust\n\n```toml\n[dependencies]\nstochastic-rs = \"1.0.0\"\n```\n\n### Bindings\n\n```bash\npip install stochastic-rs\n```\n\nFor development builds from source (requires [maturin](https://www.maturin.rs/)):\n\n```bash\npip install maturin\nmaturin develop --release\n```\n\n## Usage\n\n### Rust\n\n```rust\nuse stochastic_rs::stochastic::process::fbm::FBM;\nuse stochastic_rs::stochastic::volatility::heston::Heston;\nuse stochastic_rs::traits::ProcessExt;\n\nfn main() {\n    // Fractional Brownian Motion\n    let fbm = FBM::new(0.7, 1000, None);\n    let path = fbm.sample();\n\n    // Parallel batch sampling\n    let paths = fbm.sample_par(1000);\n\n    // Heston stochastic volatility\n    let heston = Heston::new(0.05, 2.0, 0.04, 0.3, -0.7, 1000, Some(100.0), Some(0.04), None, None);\n    let [price, variance] = heston.sample();\n}\n```\n\n### Bindings\n\nAll models return numpy arrays. Use `dtype=\"f32\"` or `dtype=\"f64\"` (default) to control precision.\n\n```python\nimport stochastic_rs as sr\n\n# Basic processes\nfbm = sr.PyFBM(0.7, 1000)\npath = fbm.sample()           # shape (1000,)\npaths = fbm.sample_par(500)   # shape (500, 1000)\n\n# Stochastic volatility\nheston = sr.PyHeston(mu=0.05, kappa=2.0, theta=0.04, sigma=0.3, rho=-0.7, n=1000)\nprice, variance = heston.sample()\n\n# Models with callable parameters\nhw = sr.PyHullWhite(theta=lambda t: 0.04 + 0.01*t, alpha=0.1, sigma=0.02, n=1000)\nrates = hw.sample()\n\n# Jump processes with custom jump distributions\nimport numpy as np\nmerton = sr.PyMerton(\n    alpha=0.05, sigma=0.2, lambda_=3.0, theta=0.01,\n    distribution=lambda: np.random.normal(0, 0.1),\n    n=1000,\n)\nlog_prices = merton.sample()\n```\n\n## Benchmarks\n\nDistribution sampling performance: `stochastic-rs` SIMD vs `rand_distr`.\nAll distributions use an internal SIMD PRNG (xoshiro256++/xoshiro128++ on `wide` SIMD types) for maximum throughput.\nFor Normal and Exp, the const generic buffer size (N=32 / N=64) is also compared.\nMeasured with Criterion on Apple M-series, `--release`.\n\n### 1K samples (small dataset)\n\n| Distribution | Type | N | stochastic-rs (µs) | rand_distr (µs) | Speedup |\n|---|---|---|---:|---:|---:|\n| Normal | f32 | 32 | 1.98 | 8.30 | 4.19x |\n| Normal | f32 | 64 | 2.09 | 8.30 | 3.97x |\n| Normal | f64 | 32 | 2.02 | 9.72 | 4.81x |\n| Normal | f64 | 64 | 2.14 | 9.72 | 4.54x |\n| Exp | f32 | 32 | 1.80 | 9.23 | 5.13x |\n| Exp | f32 | 64 | 1.79 | 9.23 | 5.16x |\n| Exp | f64 | 32 | 1.87 | 9.26 | 4.95x |\n| Exp | f64 | 64 | 1.85 | 9.26 | 5.01x |\n| LogNormal | f32 | - | 2.90 | 7.68 | 2.65x |\n| LogNormal | f64 | - | 4.57 | 12.91 | 2.83x |\n| Cauchy | f32 | - | 2.31 | 9.98 | 4.32x |\n| Cauchy | f64 | - | 6.25 | 10.44 | 1.67x |\n| Gamma | f32 | - | 5.26 | 12.31 | 2.34x |\n| Gamma | f64 | - | 5.60 | 14.94 | 2.67x |\n| Weibull | f32 | - | 5.00 | 7.36 | 1.47x |\n| Weibull | f64 | - | 10.25 | 15.10 | 1.47x |\n| Beta | f32 | - | 10.64 | 36.43 | 3.42x |\n| Beta | f64 | - | 11.32 | 46.46 | 4.11x |\n| ChiSquared | f32 | - | 5.16 | 12.32 | 2.39x |\n| ChiSquared | f64 | - | 5.49 | 14.79 | 2.69x |\n| StudentT | f32 | - | 7.50 | 19.69 | 2.63x |\n| StudentT | f64 | - | 7.83 | 22.58 | 2.88x |\n| Poisson | u32 | - | 21.95 | 41.13 | 1.87x |\n| Pareto | f32 | - | 2.51 | 5.28 | 2.10x |\n| Pareto | f64 | - | 4.90 | 11.01 | 2.25x |\n| Uniform | f32 | - | 3.08 | 3.05 | 0.99x |\n| Uniform | f64 | - | 5.69 | 5.65 | 0.99x |\n\n### 100K samples (large dataset)\n\n| Distribution | Type | N | stochastic-rs (µs) | rand_distr (µs) | Speedup |\n|---|---|---|---:|---:|---:|\n| Normal | f32 | 32 | 196 | 830 | 4.23x |\n| Normal | f32 | 64 | 209 | 830 | 3.97x |\n| Normal | f64 | 32 | 201 | 973 | 4.84x |\n| Normal | f64 | 64 | 211 | 973 | 4.61x |\n| Exp | f32 | 32 | 180 | 934 | 5.19x |\n| Exp | f32 | 64 | 180 | 934 | 5.19x |\n| Exp | f64 | 32 | 188 | 924 | 4.91x |\n| Exp | f64 | 64 | 185 | 924 | 4.99x |\n| LogNormal | f32 | - | 291 | 763 | 2.62x |\n| LogNormal | f64 | - | 468 | 1284 | 2.74x |\n| Cauchy | f32 | - | 231 | 1010 | 4.37x |\n| Cauchy | f64 | - | 593 | 1044 | 1.76x |\n| Gamma | f32 | - | 525 | 1227 | 2.34x |\n| Gamma | f64 | - | 560 | 1490 | 2.66x |\n| Weibull | f32 | - | 502 | 733 | 1.46x |\n| Weibull | f64 | - | 1025 | 1510 | 1.47x |\n| Beta | f32 | - | 1062 | 3645 | 3.43x |\n| Beta | f64 | - | 1129 | 4652 | 4.12x |\n| ChiSquared | f32 | - | 513 | 1235 | 2.41x |\n| ChiSquared | f64 | - | 545 | 1478 | 2.71x |\n| StudentT | f32 | - | 744 | 1969 | 2.65x |\n| StudentT | f64 | - | 784 | 2332 | 2.97x |\n| Poisson | u32 | - | 2166 | 4235 | 1.96x |\n| Pareto | f32 | - | 251 | 527 | 2.10x |\n| Pareto | f64 | - | 485 | 1103 | 2.27x |\n| Uniform | f32 | - | 307 | 306 | 1.00x |\n| Uniform | f64 | - | 568 | 566 | 1.00x |\n\n## Contributing\n\nContributions are welcome — bug reports, feature suggestions, or PRs. Open an issue or start a discussion on GitHub.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-dd%2Fstochastic-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-dd%2Fstochastic-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-dd%2Fstochastic-rs/lists"}