spawn-stochastic 0.1.0

A Rust library for simulating multiple stochastic processes including ABM, GBM, Ornstein-Uhlenbeck, Feller Square Root, and Brownian Bridge.
Documentation
  • Coverage
  • 29.41%
    10 out of 34 items documented0 out of 9 items with examples
  • Size
  • Source code size: 12.48 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.11 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • nzengi/spawn-stochastic
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nzengi

Stochastic Processes in Rust

This Rust library provides implementations for multiple stochastic processes, including:

  • Arithmetic Brownian Motion (ABM)
  • Geometric Brownian Motion (GBM)
  • Ornstein-Uhlenbeck Process (OU)
  • Feller Square Root Process
  • Brownian Bridge Process

Each of these processes is commonly used in financial modeling, scientific simulations, and mathematical research.

Features

This library includes:

  • Multiple stochastic process models.
  • Secure random number generation using OsRng.
  • Rust idiomatic safety practices (boundary checks, secure error handling, etc.).
  • Modular structure for ease of use and extendability.

Installation

To include this library in your Rust project, add the following line to your Cargo.toml under [dependencies]:

[dependencies]
stochastic_processes = "0.1.0"

Usage

Arithmetic Brownian Motion (ABM)

use stochastic_processes::abm::ArithmeticBrownianMotion;

fn main() {
    let abm = ArithmeticBrownianMotion::new(0.05, 0.4, 50, 200, 1.0, 200.0);
    let paths = abm.simulate();
    
    for path in paths {
        println!("{:?}", path);
    }
}

Geometric Brownian Motion (GBM)

use stochastic_processes::gbm::GeometricBrownianMotion;

fn main() {
    let gbm = GeometricBrownianMotion::new(0.2, 0.4, 50, 200, 1.0, 500.0);
    let paths = gbm.simulate();
    
    for path in paths {
        println!("{:?}", path);
    }
}

Ornstein-Uhlenbeck Process (OU)

use stochastic_processes::ou::OrnsteinUhlenbeck;

fn main() {
    let ou = OrnsteinUhlenbeck::new(10.0, 0.07, 0.1, 50, 200, 1.0, 0.05);
    let paths = ou.simulate();
    
    for path in paths {
        println!("{:?}", path);
    }
}

Feller Square Root Process

use stochastic_processes::feller::FellerSquareRoot;

fn main() {
    let feller = FellerSquareRoot::new(5.0, 0.1, 0.2, 50, 200, 1.0, 0.05);
    let paths = feller.simulate();
    
    for path in paths {
        println!("{:?}", path);
    }
}

Brownian Bridge Process

use stochastic_processes::bridge::BrownianBridge;

fn main() {
    let bridge = BrownianBridge::new(0.0, 1.0, 0.2, 50, 200, 1.0);
    let paths = bridge.simulate();
    
    for path in paths {
        println!("{:?}", path);
    }
}