Files
ferro-ta/crates/ferro_ta_core
Pratik Bhadane 602d675749 feat: add full derivatives analytics layer (options + futures)
Implements all phases of the derivatives expansion plan:

Rust core (crates/ferro_ta_core/src/options/, src/futures/):
- BSM and Black-76 pricing (scalar + vectorized batch)
- Greeks: delta, gamma, vega, theta, rho
- Implied volatility solver (Newton + bisection fallback)
- Smile/skew metrics: ATM IV, 25-delta RR/BF, skew slope, convexity
- Chain helpers: moneyness labels, strike selection by offset or delta
- Synthetic forwards, basis, annualized basis, implied carry, carry spread
- Continuous contract stitching: weighted, back-adjusted, ratio-adjusted
- Curve analytics: calendar spreads, slope, contango/backwardation summary

PyO3 bindings (src/options/, src/futures/):
- All Rust functions registered and exposed via _ferro_ta extension

Python API (python/ferro_ta/analysis/):
- options.py: pricing, greeks, IV, smile, chain, legacy iv_rank/percentile/zscore
- futures.py: basis, carry, curve, roll, synthetic, continuous contracts
- options_strategy.py: typed strategy schemas (expiry/strike selectors, leg presets, risk controls, simulation limits)
- derivatives_payoff.py: multi-leg payoff aggregation and Greeks aggregation

Bug fix: wrap _to_f64 calls in iv_rank/iv_percentile/iv_zscore to raise
FerroTAInputError (not plain ValueError) for 2D array input.

Docs: derivatives.rst, derivatives-analytics.md, options-volatility.md,
quickstart.rst, index.rst, api/analysis.rst all updated.

Tests: 2053 pass, 12 skipped. All CI checks pass locally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 02:41:50 +05:30
..
2026-03-24 02:02:10 +05:30
2026-03-24 02:02:10 +05:30

ferro_ta_core

ferro_ta_core is the pure Rust indicator engine behind ferro-ta.

It provides allocation-friendly indicator functions over &[f64] slices without any PyO3, NumPy, or Python runtime dependency, which makes it a good fit for:

  • Rust-native technical analysis workloads
  • custom services and backtesting engines
  • future non-Python bindings such as WASM and other FFI layers

Installation

[dependencies]
ferro_ta_core = "1.0.2"

Design

  • Pure functions over Rust slices
  • No Python or NumPy dependency
  • Shared core for the Python package and WASM bindings
  • Output shape matches TA-Lib-style full-length series with NaN warm-up values where applicable

Modules

  • overlap - moving averages, MACD, Bollinger Bands
  • momentum - RSI, MOM
  • volatility - ATR, TRANGE
  • volume - OBV
  • statistic - STDDEV
  • math - rolling SUM/MAX/MIN helpers

Example

use ferro_ta_core::overlap;

fn main() {
    let close = vec![1.0, 2.0, 3.0, 4.0, 5.0];
    let sma = overlap::sma(&close, 3);

    assert!(sma[0].is_nan());
    assert!(sma[1].is_nan());
    assert!((sma[2] - 2.0).abs() < 1e-10);
}

Relationship To ferro-ta

The published Python package:

  • crate: ferro_ta
  • PyPI package: ferro-ta

wraps this crate with PyO3 bindings and adds:

  • NumPy conversion
  • pandas/polars wrappers
  • streaming classes
  • batch helpers
  • higher-level Python tooling

If you only need Rust indicator functions, use ferro_ta_core directly.

Development

From the repository root:

cargo build -p ferro_ta_core
cargo test -p ferro_ta_core
cargo bench -p ferro_ta_core --no-run

License

MIT