RustQuant

Rust library for quantitative finance tools.

Contact: rustquantcontact@gmail.com

Release notes:

v0.0.9

v0.0.8

Disclaimer: This is currently a free-time project and not a professional financial software library. Nothing in this library should be taken as financial advice, and I do not recommend you to use it for trading or making financial decisions.

Some references used:

Table of Contents

  1. Automatic Differentiation
  2. Option Pricers
  3. Stochastic Processes and Short Rate Models
  4. Bonds
  5. Random
  6. Mathematics
  7. Helper Functions and Macros
  8. How-tos

Automatic Differentiation

Currently only gradients can be computed. Suggestions on how to extend the functionality to Hessian matrices are definitely welcome.

Option Pricers

The stochastic process generators can be used to price path-dependent options via Monte-Carlo.

Stochastic Processes and Short Rate Models

The following is a list of stochastic processes that can be generated.

Bonds

Most will follow the notation and formulas in John C. Hull's Options, Futures, and Other Derivatives.

Random

Mathematics

Helper Functions and Macros

A collection of utility functions and macros.

How-tos

Compute gradients:

```rust use RustQuant::autodiff::*;

fn main() { // Create a new Tape. let t = Tape::new();

// Assign variables.
let x = t.var(0.5);
let y = t.var(4.2);

// Define a function.
let z = x * y + x.sin();

// Accumulate the gradient.
let grad = z.accumulate();

println!("Function = {}", z);
println!("Gradient = {:?}", grad.wrt([x, y]));

} ```

Price options:

```rust use RustQuant::options::*;

fn main() { let VanillaOption = EuropeanOption { initialprice: 100.0, strikeprice: 110.0, riskfreerate: 0.05, volatility: 0.2, dividendrate: 0.02, timeto_maturity: 0.5, };

let prices = VanillaOption.price();

println!("Call price = {}", prices.0);
println!("Put price = {}", prices.1);

} ```

Generate stochastic processes:

```rust use RustQuant::stochastics::*;

fn main() { // Create new GBM with mu and sigma. let gbm = GeometricBrownianMotion::new(0.05, 0.9);

// Generate path using Euler-Maruyama scheme.
// Parameters: x_0, t_0, t_n, n, sims, parallel.
let output = (&gbm).euler_maruyama(10.0, 0.0, 0.5, 10, 1, false);

println!("GBM = {:?}", output.trajectories);

} ```