Implementation:Avhz RustQuant GeometricBrownianBridge
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of the Geometric Brownian Bridge stochastic process provided by the RustQuant library.
Description
The Geometric Brownian Bridge is a modification of Geometric Brownian Motion where the end value is known (pinned). It models a path-dependent stochastic process that is conditioned to arrive at a specified terminal value. The SDE is:
dX(t) = [mu * X(t) + (ln(end_value) - ln(X(t))) / (end_time - t) * X(t)] dt + sigma * X(t) dW(t)
The drift includes an additional correction term that pulls the process toward the known end value as time approaches the terminal time. The diffusion is proportional to the current level (as in GBM).
Key parameters:
- mu (ModelParameter) -- The drift rate
- sigma (ModelParameter) -- The volatility (must be non-negative)
- end_value (f64) -- The known terminal value of the process
- end_time (f64) -- The known terminal time
Usage
Use this process when simulating paths that must arrive at a known terminal value, such as pricing path-dependent options with a known terminal condition, or modeling constrained price trajectories. Useful in bridge sampling techniques and conditional simulation.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/geometric_brownian_bridge.rs
- Lines: 1-109
Signature
pub struct GeometricBrownianBridge {
pub mu: ModelParameter,
pub sigma: ModelParameter,
pub end_value: f64,
pub end_time: f64,
}
impl GeometricBrownianBridge {
pub fn new(
mu: impl Into<ModelParameter>,
sigma: impl Into<ModelParameter>,
end_value: f64,
end_time: f64,
) -> Self
}
impl StochasticProcess for GeometricBrownianBridge {
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::GeometricBrownianBridge;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| mu | impl Into<ModelParameter> | Yes | The drift rate |
| sigma | impl Into<ModelParameter> | Yes | The volatility (must be non-negative) |
| end_value | f64 | Yes | The known terminal value of the process |
| end_time | f64 | Yes | The known terminal time |
Outputs
| Name | Type | Description |
|---|---|---|
| drift() | f64 | Returns mu(t)*x + (ln(end_value) - ln(x))/(end_time - t)*x -- bridge-corrected drift |
| diffusion() | f64 | Returns sigma(t) * x -- proportional diffusion |
| jump() | Option<f64> | Always returns None (no jump component) |
| parameters() | Vec<f64> | Returns [mu(0), sigma(0), end_value, end_time] |
Usage Examples
use RustQuant::stochastics::GeometricBrownianBridge;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create a Geometric Brownian Bridge: mu=0.05, sigma=0.9, end_value=10.0, end_time=0.5
let gbb = GeometricBrownianBridge::new(0.05, 0.9, 10.0, 0.5);
// Configure simulation: x0=10.0, t_start=0.0, t_end=0.5, n_steps=125, 10000 paths
let config = StochasticProcessConfig::new(
10.0, 0.0, 0.5, 125, StochasticScheme::EulerMaruyama, 10000, false, None
);
let output = gbb.generate(&config);
// Access simulated paths -- all paths converge to end_value at end_time
let paths = &output.paths;