[][src]Function fang_oost_option::option_calibration::get_option_spline

pub fn get_option_spline<'a>(
    strikes_and_option_prices: &[OptionData],
    stock: f64,
    discount: f64,
    min_strike: f64,
    max_strike: f64
) -> impl Fn(f64) -> f64 + 'a

Returns spline function

Examples

extern crate fang_oost_option;
use fang_oost_option::option_calibration;
//vector of tuple of (strike, option)
let strikes_and_options = vec![
    option_calibration::OptionData{
        strike:30.0, price:22.0
    },
    option_calibration::OptionData{
        strike:50.0, price:4.0
    },
    option_calibration::OptionData{
        strike:60.0, price:0.5
    }
];
let stock = 50.0;
let min_strike = 0.3;
let max_strike = 3000.0;
let discount = 0.99; //discount factor
let spline = option_calibration::get_option_spline(
    &strikes_and_options,
    stock,
    discount,
    min_strike,
    max_strike
);
let estimated_transformed_strike_high = spline(1.2);
let estimated_transformed_strike_low = spline(0.8);
let estimated_transformed_strike_at_the_money = spline(1.0);