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>
37 lines
1007 B
Rust
37 lines
1007 B
Rust
/*!
|
|
ferro_ta_core — Pure Rust indicator library.
|
|
|
|
This crate contains all indicator implementations as pure functions operating
|
|
on `&[f64]` slices and returning `Vec<f64>`. It has **no dependency on PyO3
|
|
or numpy** so it can be used from any Rust project, or compiled to WASM /
|
|
Node.js via napi-rs without dragging in Python bindings.
|
|
|
|
The Python wheel (`ferro_ta` PyPI package) is built from a thin binding crate
|
|
that calls into this core and converts NumPy arrays to/from Rust slices.
|
|
|
|
# Two-layer architecture
|
|
|
|
The root crate (`ferro_ta`) contains PyO3 `#[pyfunction]` wrappers that convert
|
|
numpy arrays to `&[f64]` and delegate to this core crate.
|
|
|
|
# Usage (Rust)
|
|
|
|
```rust
|
|
use ferro_ta_core::overlap;
|
|
|
|
let close = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0];
|
|
let sma = overlap::sma(&close, 3);
|
|
assert!(sma[0].is_nan());
|
|
assert!((sma[2] - 2.0).abs() < 1e-10);
|
|
```
|
|
*/
|
|
|
|
pub mod futures;
|
|
pub mod math;
|
|
pub mod momentum;
|
|
pub mod options;
|
|
pub mod overlap;
|
|
pub mod statistic;
|
|
pub mod volatility;
|
|
pub mod volume;
|