stochastic-rs 3.0.0-beta.3

Quantitative finance in Rust: 120+ stochastic processes, option pricing, model calibration, volatility surfaces, fixed income, risk and copulas — SIMD/GPU accelerated, with Python bindings.
Documentation
//! # Lib
//!
//! $$
//! V_0 = \mathbb{E}^{\mathbb{Q}}\!\left[e^{-\int_0^T r_t\,dt}\,\Pi(X_T)\right]
//! $$
//!
#![doc = include_str!("../README.md")]
#![allow(non_snake_case)]
#![allow(clippy::type_complexity)]
#![allow(clippy::too_many_arguments)]
//#![warn(missing_docs)]

// Mutually exclusive global allocators. If both features are enabled (e.g.
// `cargo check --all-features` for CI smoke testing), `jemalloc` wins.
#[cfg(all(feature = "mimalloc", not(feature = "jemalloc")))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(feature = "jemalloc")]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

#[cfg(feature = "ai")]
pub use stochastic_rs_ai as ai;
pub use stochastic_rs_copulas as copulas;
pub use stochastic_rs_core::simd_rng;
pub use stochastic_rs_distributions as distributions;
pub use stochastic_rs_quant as quant;
pub use stochastic_rs_stats as stats;
pub use stochastic_rs_stochastic as stochastic;
pub mod bridges;
pub mod traits;

// Python bindings will live in `stochastic-rs-py` (Phase 6 follow-up).
// The umbrella `python` feature is currently a no-op pending that migration.

/// Convenience prelude that re-exports the most commonly used types and traits.
///
/// Bring this in scope to get the canonical trait set (`ProcessExt`,
/// `FloatExt`, `ModelPricer`, `BivariateExt`, …) and the option-type enums
/// without pulling them one by one.
///
/// Currently 25 items in 6 groups — re-derive with
/// `awk '/pub mod prelude/,/^}/' src/lib.rs | grep -c "^  pub use"` — the
/// leading indentation matters, since a bare `grep -c "pub use"` also matches
/// this very comment and reports two too many — and update
/// `CLAUDE.md` and `website/content/docs/concepts/prelude.mdx` together
/// whenever a `pub use` line below is added or removed;
/// `tests/prelude_completeness.rs` catches the removal direction at
/// compile time but not additions that go undocumented.
///
/// ```
/// use stochastic_rs::prelude::*;
/// use stochastic_rs::simd_rng::Unseeded;
///
/// let bm = stochastic_rs::stochastic::process::bm::Bm::new(1000, Some(1.0), Unseeded);
/// let path = bm.sample();
/// ```
pub mod prelude {
  pub use stochastic_rs_quant::Moneyness;
  pub use stochastic_rs_quant::OptionStyle;
  pub use stochastic_rs_quant::OptionType;

  pub use crate::traits::Backend;
  pub use crate::traits::BivariateExt;
  pub use crate::traits::CalibrationResult;
  pub use crate::traits::Calibrator;
  pub use crate::traits::Cpu;
  pub use crate::traits::DiffusionModel;
  pub use crate::traits::DistributionExt;
  pub use crate::traits::DistributionSampler;
  pub use crate::traits::FloatExt;
  pub use crate::traits::FractalDimEstimator;
  pub use crate::traits::HurstEstimator;
  pub use crate::traits::HypothesisTest;
  pub use crate::traits::ModelPricer;
  pub use crate::traits::MultivariateExt;
  pub use crate::traits::PathSampler;
  pub use crate::traits::ProcessExt;
  pub use crate::traits::RealExt;
  pub use crate::traits::SimdFloatExt;
  pub use crate::traits::TailDependence;
  pub use crate::traits::TimeExt;
  pub use crate::traits::ToModel;
  pub use crate::traits::VolterraKernel;
}