Function fang_oost_option::option_pricing::fang_oost_call_gamma[][src]

pub fn fang_oost_call_gamma<'a, S>(
    num_u: usize,
    asset: f64,
    strikes: &'a [f64],
    rate: f64,
    t_maturity: f64,
    cf: S
) -> Vec<f64> where
    S: Fn(&Complex<f64>) -> Complex<f64> + Sync + Send

Returns gamma of a call for the series of strikes

Examples

extern crate num_complex;
use num_complex::Complex;
extern crate fang_oost_option;
use fang_oost_option::option_pricing;
let num_u:usize = 256;
let asset = 50.0;
let strikes = vec![5000.0, 75.0, 50.0, 40.0, 0.03];
let rate = 0.03;
let t_maturity = 0.5;
let volatility:f64 = 0.3; 
//As an example, cf is standard diffusion
let cf = |u: &Complex<f64>| {
    ((rate-volatility*volatility*0.5)*t_maturity*u+volatility*volatility*t_maturity*u*u*0.5).exp()
};
let deltas = option_pricing::fang_oost_call_gamma(
    num_u, asset, &strikes, 
    rate, t_maturity, &cf
);