Expand description
Standalone risk analytics.
Requires the risk feature flag (which implies indicators).
Provides Value at Risk, Sharpe/Sortino/Calmar ratios, beta, and max drawdown as standalone metrics — independent of the backtesting engine.
§Quick Start
use finance_query::{Ticker, Interval, TimeRange};
let ticker = Ticker::new("AAPL").await?;
let summary = ticker.risk(Interval::OneDay, TimeRange::OneYear, None).await?;
println!("VaR (95%): {:.2}%", summary.var_95 * 100.0);
println!("Max drawdown: {:.2}%", summary.max_drawdown * 100.0);
if let Some(sharpe) = summary.sharpe {
println!("Sharpe ratio: {sharpe:.2}");
}Structs§
- Risk
Summary - Comprehensive risk summary for a symbol.
Functions§
- beta
- Compute the beta of an asset relative to a benchmark.
- calmar_
ratio - Compute the Calmar Ratio: annualised return divided by maximum drawdown.
- historical_
var - Compute historical VaR at the given confidence level.
- max_
drawdown - Compute the maximum drawdown from a return series.
- parametric_
var - Compute parametric (variance-covariance) VaR assuming normally distributed returns.
- sharpe_
ratio - Compute the annualised Sharpe Ratio.
- sortino_
ratio - Compute the annualised Sortino Ratio (penalises only downside volatility).