FerroRisk · guides
Getting started
Add ferro-risk to a Cargo workspace and price your first option.
This guide walks through wiring ferro-risk into a Cargo workspace and
pricing a vanilla European option end-to-end.
Add the dependency
Add ferro-risk to your crate's Cargo.toml from the approved MorphIQ package
source for your workspace:
[dependencies]
ferro-risk = { version = "0.26" }Price an option
The Black–Scholes call price for spot , strike , rate , time , and volatility is
In code:
use ferro_risk::{price, ExerciseStyle, OptionType, PricingInputs, PricingModel};
let inputs = PricingInputs {
option_type: OptionType::Call,
exercise_style: ExerciseStyle::European,
spot: 100.0,
strike: 105.0,
time_to_expiry: 0.25,
rate: 0.04,
dividend_yield: 0.0,
volatility: 0.20,
};
let premium = price(&inputs, PricingModel::BlackScholesMerton)?;
# Ok::<(), ferro_risk::FerroRiskError>(())The function is allocation-free and pure — the same inputs always produce the same output, which makes it safe to use on the hot path of a backtest.
Next steps
Read the VaR reference for portfolio-level risk measures, and the API reference for the complete generated API.