Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Avhz RustQuant CEV Process

From Leeroopedia
Revision as of 14:31, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Avhz_RustQuant_CEV_Process.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Stochastic_Processes, Quantitative_Finance
Last Updated 2026-02-07 19:00 GMT

Overview

Concrete implementation of the Constant Elasticity of Variance (CEV) stochastic process provided by the RustQuant library.

Description

The Constant Elasticity of Variance model is a stochastic process defined by the SDE:

dX(t) = mu * X(t) dt + sigma * X(t)^elasticity dW(t)

where mu is the drift, sigma is the volatility, and elasticity (often denoted beta, rho, or gamma) controls how the volatility scales with the level of the process. The elasticity parameter must be in the unit interval [0, 1].

Special cases:

  • elasticity = 0 reduces to Arithmetic Brownian Motion (additive noise)
  • elasticity = 0.5 gives a CIR-like square-root diffusion
  • elasticity = 1 reduces to Geometric Brownian Motion (multiplicative noise)

Key parameters:

  • mu (ModelParameter) -- The drift rate
  • sigma (ModelParameter) -- The volatility (must be non-negative)
  • elasticity (ModelParameter) -- The elasticity parameter in [0, 1]

Usage

Use this process when modeling asset prices or rates where the volatility depends on the level of the underlying variable. The CEV model is widely used in options pricing to capture the volatility smile/skew without requiring a separate stochastic volatility component.

Code Reference

Source Location

Signature

pub struct ConstantElasticityOfVariance {
    pub mu: ModelParameter,
    pub sigma: ModelParameter,
    pub elasticity: ModelParameter,
}

impl ConstantElasticityOfVariance {
    pub fn new(
        mu: impl Into<ModelParameter>,
        sigma: impl Into<ModelParameter>,
        elasticity: impl Into<ModelParameter>,
    ) -> Self
}

impl StochasticProcess for ConstantElasticityOfVariance {
    fn drift(&self, x: f64, t: f64) -> f64
    fn diffusion(&self, x: f64, t: f64) -> f64
    fn jump(&self, _x: f64, _t: f64) -> Option<f64>
    fn parameters(&self) -> Vec<f64>
}

Import

use RustQuant::stochastics::ConstantElasticityOfVariance;

I/O Contract

Inputs

Name Type Required Description
mu impl Into<ModelParameter> Yes The drift rate (constant or time-dependent)
sigma impl Into<ModelParameter> Yes The volatility (must be non-negative)
elasticity impl Into<ModelParameter> Yes The elasticity parameter, must be in [0, 1]

Outputs

Name Type Description
drift() f64 Returns mu(t) * x -- proportional drift
diffusion() f64 Returns sigma(t) * x^elasticity(t) -- level-dependent diffusion
jump() Option<f64> Always returns None (no jump component)
parameters() Vec<f64> Returns [mu(0), sigma(0), elasticity(0)]

Usage Examples

use RustQuant::stochastics::ConstantElasticityOfVariance;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};

// Create a CEV process with mu=0.05, sigma=0.9, elasticity=0.45
let cev = ConstantElasticityOfVariance::new(0.05, 0.9, 0.45);

// Configure simulation: x0=10.0, t_start=0.0, t_end=0.5, n_steps=100, 100 paths
let config = StochasticProcessConfig::new(
    10.0, 0.0, 0.5, 100, StochasticScheme::EulerMaruyama, 100, false, None
);

let output = cev.generate(&config);

// Access simulated paths
let paths = &output.paths;

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment