Tick signal generation (src/signals/tick_signals.rs):
- tick_momentum_entry: O(N) single-pass entry signal array from spread/BSI/return
gates with cooldown enforcement; replaces the Python O(N×120) entry-check loop
- tick_momentum_exit: time-based (EOD) exit bool array from tick timestamps
Tick feature extraction (src/indicators/tick_features.rs):
- tick_spread_pct: (ask-bid)/mid * 100, element-wise
- buy_sell_imbalance_delta: per-tick delta BSI from Zerodha cumulative session
totals — fixes the ~0.95 all-day artefact from raw cumulative sums
- return_window: lookback return over configurable time window, binary search
O(N log N); returns NaN where history insufficient (no silent pass-through)
- realized_vol_rolling: rolling stddev of log-returns as realized vol proxy
- oi_position_pct: OI position within day's high/low range [0, 100]
- tick_velocity: rolling ticks/min over configurable window
Python bindings: compute_tick_entry_signals, compute_tick_exit_signals,
tick_spread_pct, buy_sell_imbalance_delta, return_window, realized_vol_rolling,
oi_position_pct, tick_velocity — all with numpy array I/O and default args.
15 new Rust unit tests (7 signal, 8 feature); 153 total, 0 failed.
Co-Authored-By: porcelaincode <contact@alphabench.in>
signal_start = (slow_period-1) + (signal_period-1) = 24+8 = 32,
so signal_line[33] is the first valid value, not NaN. Test was
asserting [33].is_nan() which was always wrong.
Co-Authored-By: porcelaincode <contact@alphabench.in>
* feat: add session tracking and multi-leg spread backtesting
Add SessionTracker for trading session management: - Market hours detection (pre-open, trading, squareoff, post-close)
- Session boundary tracking with configurable timezone - Squareoff time support for intraday strategies - Session high/low/open price tracking
Add SpreadBacktest for multi-leg options strategies: - Support for straddles, strangles, vertical spreads, iron condors - Coordinated entry/exit across all legs - Net premium P&L calculation with max loss/target profit exits - Helper functions for common spread configurations
Extend StreamingMetrics for backtest integration: - Add equity and drawdown tracking (update_equity, current_drawdown_pct) - Add trade recording (record_trade, record_fees) - Add finalize() method to produce BacktestMetrics - Add with_initial_capital() constructor
Bump version to 0.2.0.
* chore: bump up version to 0.2.0
* feat: update version to 0.2.1 and add rolling min/max indicators
* fix: formatting
* Fix CI workflow: use correct rust-toolchain action
* Fix CI: resolve Rust compilation and formatting issues
- Fix rust-toolchain action name in CI workflow
- Add missing Direction import in test modules
- Add missing entry_fees argument to open_position test calls
- Comment out nightly-only rustfmt options
- Auto-format code with cargo fmt