pub fn sortino_ratio(returns: &[f64], target: f64) -> FinanceResult<f64>Expand description
Sortino ratio: (mean - target) / downside_deviation, using returns below target only.
§Examples
use finance_solution::{sortino_ratio, FinanceError};
assert!(sortino_ratio(&[0.02, -0.03, 0.01], 0.0).is_ok());
// All returns above target → no downside.
match sortino_ratio(&[0.01, 0.02, 0.03], 0.0) {
Err(FinanceError::Unsolvable { message }) => assert!(message.contains("below target")),
other => panic!("expected Unsolvable, got {other:?}"),
}