Rust edition: this page follows the live DeepWiki structure but treats the current Rust crates as implementation authority. Non-Rust surfaces are identified at their boundary and are not presented as Rust APIs.
Technical Indicators and Options Analytics
Relevant Rust source files
crates/indicators/src/lib.rscrates/common/src/actor/data_actor.rscrates/model/src/data/greeks.rscrates/model/src/data/black_scholes.rscrates/common/examples/greeks_actor_example.rs
Purpose and Scope
This document provides a technical overview of the indicator system and options analytics framework in NautilusTrader. It covers the registration and automatic updating of built-in technical indicators, the use of the GreeksCalculator for derivatives risk management, and the integration of option greeks from both venue-provided streams and local Black-Scholes calculations.
Technical Indicators
Technical indicators in NautilusTrader are Rust components that process market-data streams and expose typed state to actors and strategies.
Indicator Architecture and Data Flow
The indicator system integrates with the Actor base class. When a strategy registers an indicator, the actor logic routes incoming data to the indicator's update methods. Indicators typically implement a specific trait or base class that defines how they handle Bar or QuoteTick data. For example, the SpreadAnalyzer specifically handles QuoteTick objects to calculate real-time and average bid-ask spreads.
Sources: crates/indicators/src/lib.rs, crates/common/src/actor/data_actor.rs
Built-in Indicators
The platform includes a comprehensive library of indicators categorized by their analytical purpose:
| Category | Indicators |
|---|---|
| Moving Averages | SMA, EMA, DEMA, HMA, WMA, RMA, VIDYA |
| Momentum | RSI, MACD, ROC, OBV, VHF, AMAT |
| Volatility | ATR, Bollinger Bands, Donchian Channels, Keltner Channels |
| Oscillators | Stochastics |
| Execution/Microstructure | VWAP, SpreadAnalyzer |
Options Analytics and Greeks
NautilusTrader provides first-class support for options trading, including venue-provided Greeks streaming, option chain aggregation, and a local Black-Scholes Greeks calculator
Venue-Provided Greeks
When a selected provider supplies real-time sensitivities, the adapter can normalize them into OptionGreeks and publish them through the standard data subscription system.
- OptionGreeks: A Rust model type containing
delta,gamma,vega,theta,rho, andmark_iv. - Persistence:
OptionGreeksis a native member of theDataenum and persists to the data catalog for backtesting
GreeksCalculator
The GreeksCalculator is the primary interface for calculating sensitivities locally. It is accessible from any class inheriting from Actor, including strategies It requires a CacheFacade and a Clock to access market data and current time for time-to-expiry calculations
Key Sensitivities Calculated:
- Delta: First derivative of price with respect to spot move
- Gamma: Second derivative of price with respect to spot move
- Vega: Sensitivity to a 1% change in implied volatility (scaled by 0.01)
- Theta: Daily time decay (dV/dt / 365.25)
- Rho: Sensitivity to a change in interest rate
Black-Scholes Implementation
The platform uses an optimized Rust Black-Scholes implementation for implied volatility and Greek calculations.
- black_scholes_greeks_exact: Precise generalized Black-Scholes calculations
- imply_vol: Back-calculates implied volatility from market price
- Optimization: The core engine uses minimax polynomial approximations for performance
GreeksCalculator combines option and underlying state with Black-Scholes functions, yield-curve inputs and cache lookups to emit canonical Greeks data; indicators consume market values without changing provider or execution ownership.
Option Chain Aggregation
The OptionChainManager aggregates quotes and Greeks across all strikes in an option series into OptionChainSlice snapshots
- StrikeRange: Controls which strikes are active (Fixed, AtmRelative, AtmPercent, or Delta-based)
- Modes: Supports Snapshot mode (timer-based accumulation) and Raw mode (immediate publish per update)
- Backtesting: Replays
QuoteTickandOptionGreeksfrom the catalog to assemble slices identically to live trading.
Portfolio Greeks and Risk Management
The system can aggregate Greeks across an entire portfolio using PortfolioGreeks, which sums sensitivities of individual positions
| Feature | Description | Function/Class |
|---|---|---|
| Instrument Greeks | Calculates Greeks for a single option or underlying. | instrument_greeks |
| Portfolio Greeks | Aggregates Greeks across multiple positions. | portfolio_greeks |
| Beta Weighting | Computes beta-weighted Delta/Gamma relative to an index. | beta_weights parameter |
| Yield Curves | Manages interest rate curves for discounting. | YieldCurveData |
The YieldCurveData class supports quadratic interpolation for zero-rates across different tenors
Portfolio Analyzer and Statistics
The Rust PortfolioAnalyzer tracks account balances, positions, and realized PnLs to provide performance analysis.
- Statistics: Built-in statistics include Sharpe Ratio, Sortino Ratio, Win Rate, Max Drawdown, CAGR, and Profit Factor
- Returns: Tracks both per-position returns and portfolio-wide returns derived from account balances
Implementation Example: Greeks Actor
The following demonstrates how a DataActor utilizes the GreeksCalculator in Rust.
// crates/common/examples/greeks_actor_example.rs
impl DataActor for GreeksActor {
fn on_start(&mut self) -> anyhow::Result<()> {
// Subscribe to Greeks data for a specific underlying
self.calculator()?.subscribe_greeks("SPY", Some(Self::handle_greeks as fn(&GreeksData)));
Ok(())
}
pub(crate) fn calculate_portfolio_greeks(&self) -> anyhow::Result<PortfolioGreeks> {
PortfolioGreeksParams::builder()
.side(PositionSide::NoPositionSide)
.cache_greeks(true)
.publish_greeks(true)
.build()
.calculate(self.calculator()?)
}
}