Implementation:Avhz RustQuant ArithmeticBrownianMotion
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of the Arithmetic Brownian Motion (ABM) stochastic process provided by the RustQuant library.
Description
Arithmetic Brownian Motion is a continuous-time stochastic process defined by the SDE:
dX(t) = mu dt + sigma dW(t)
where mu is the constant drift and sigma is the constant volatility. Unlike Geometric Brownian Motion, ABM allows the process to take negative values. The process has a normal distribution at any time t, with mean X(0) + mu * t and variance sigma^2 * t.
Key parameters:
- mu (ModelParameter) -- The drift rate
- sigma (ModelParameter) -- The volatility (must be non-negative)
Usage
Use this process when modeling phenomena where the increments are additive (not multiplicative), such as modeling interest rate spreads or residuals in financial models. ABM is appropriate when the underlying quantity can be negative and grows linearly on average.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/arithmetic_brownian_motion.rs
- Lines: 1-91
Signature
pub struct ArithmeticBrownianMotion {
pub mu: ModelParameter,
pub sigma: ModelParameter,
}
impl ArithmeticBrownianMotion {
pub fn new(mu: impl Into<ModelParameter>, sigma: impl Into<ModelParameter>) -> Self
}
impl StochasticProcess for ArithmeticBrownianMotion {
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::ArithmeticBrownianMotion;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| mu | impl Into<ModelParameter> | Yes | The drift rate (constant or time-dependent function) |
| sigma | impl Into<ModelParameter> | Yes | The volatility (constant or time-dependent function, must be non-negative) |
Outputs
| Name | Type | Description |
|---|---|---|
| drift() | f64 | Returns mu(t) -- the drift component at time t |
| diffusion() | f64 | Returns sigma(t) -- the diffusion component at time t |
| jump() | Option<f64> | Always returns None (no jump component) |
| parameters() | Vec<f64> | Returns [mu(0), sigma(0)] |
Usage Examples
use RustQuant::stochastics::ArithmeticBrownianMotion;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create an ABM with drift 0.05 and volatility 0.9
let abm = ArithmeticBrownianMotion::new(0.05, 0.9);
// Configure simulation: x0=10.0, t_start=0.0, t_end=0.5, n_steps=125, Euler-Maruyama, 1000 paths
let config = StochasticProcessConfig::new(
10.0, 0.0, 0.5, 125, StochasticScheme::EulerMaruyama, 1000, false, None
);
let output = abm.generate(&config);
// Access simulated paths
let paths = &output.paths;