30 Commits

Author SHA1 Message Date
KhizarImran 494f157c13 bench: add three-way speed benchmark (backtesting.py vs py-next vs native rust)
Adds a native-Rust SMA strategy path (Engine.run_native_sma) so we can time
the pure-Rust engine against the Python-callback path and backtesting.py.
2026-07-18 00:08:49 +01:00
Khizar c31e0088db feat: add standalone HTML reports 2026-07-17 14:54:59 +00:00
Khizar 8275c809e5 fix: include final liquidation in equity curve 2026-07-17 14:24:38 +00:00
Khizar 2c07815aba fix: reconcile trade pnl with commissions 2026-07-17 14:20:28 +00:00
KhizarImran 6aee7006a5 test: cover close_position and short-side SL/TP; add CI
Adds the two remaining broker test gaps (close_position by id,
short position stop-loss fill). CI runs cargo check + cargo test
on push/PR to main.
2026-07-12 21:22:47 +01:00
KhizarImran b8c0cd1d57 test: add unit tests for broker PnL, commission, and SL/TP fills
Covers buy/sell close PnL, commission charged on open and close,
long SL fills at the stop price (not bar.close), positions staying
open when neither SL nor TP is hit, and unrealized equity.
2026-07-12 21:20:41 +01:00
KhizarImran cefa7c8ee1 feat: Position __repr__ and DataFrame column validation 2026-07-05 14:58:58 +01:00
KhizarImran c22153f02f feat: strategy data access, sharpe ratio, and correctness fixes
- Trade.pnl now stores net pnl (after exit commission) so per-trade stats are accurate
- Position pyclass uses from_py_object to fix deprecation warning
- Removed dead AttributeError swallow in engine.rs
- Strategy gains self.data, self.index, self.cash, self.equity properties
- Broker.cash exposed to Python via pyo3(get)
- Sharpe ratio added to Stats (unannualized)
- Added examples/sma_cross.py and examples/compare_bt.py
- Logic verified against backtesting.py: 34 trades, 29.4% win rate match
2026-07-05 14:42:10 +01:00
KhizarImran 2af19afafa positions are now visible in python. can be check by if not sel.position 2026-07-02 22:12:20 +01:00
KhizarImran 53fe8e0e9d fix: commision bug fix 2026-06-25 21:48:49 +01:00
KhizarImran e79070539d feat: column-aware CSV loading and changelog
- Replaced manual CSV parsing with csv crate, columns now looked up by name
- Fixed Rust example path and contract_size
- Added CHANGELOG.md for release tracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-21 18:54:14 +01:00
KhizarImran 62131a2918 getting it ready for publishing 2026-06-21 17:56:41 +01:00
KhizarImran cb9bf41ff3 added lot size 2026-06-21 00:18:44 +01:00
KhizarImran 706be103f0 bug fixes: types.rs 2026-06-20 17:52:19 +01:00
KhizarImran 5609249180 bug: backtest.py bug fixes 2026-06-20 17:43:19 +01:00
KhizarImran b0559ecf79 core: fully restructured code to support pyo3 2026-06-14 02:13:28 +01:00
KhizarImran 322ff54d63 made pyclass work for stats 2026-06-14 01:29:20 +01:00
KhizarImran 6f39fc2d34 adding python wrapping 2026-06-14 01:21:15 +01:00
KhizarImran a039484b08 core: when backtest finishes, any open positions should now close at bar.last 2026-06-13 23:28:49 +01:00
KhizarImran 9847a99561 feat: stoploss and take profit implementation on the broker.rs 2026-06-13 12:01:44 +01:00
Khizar Imran 8da311cc3f bug fix: broker.rs (close position & close all) 2026-06-09 00:10:09 +01:00
Khizar Imran 9081e2b7ab feat: spread calculated on exit (close position & all) 2026-06-09 00:01:46 +01:00
Khizar Imran 26e625d6f8 new: better stats 2026-06-08 23:55:42 +01:00
Khizar Imran bbfe87edb7 checkpoint: spread/commisions working 2026-06-06 17:16:32 +01:00
Khizar Imran 1dc728078f new: added a working example 2026-06-06 16:18:45 +01:00
Khizar Imran 04b5f405e0 minor commenting 2026-06-04 21:34:26 +01:00
Khizar Imran 73a144c4df added engine rs & data rs 2026-06-04 21:25:52 +01:00
Khizar Imran 7d19b1d519 fn: added close_position to broker.rs 2026-06-04 00:25:08 +01:00
Khizar Imran 35a6f8dc00 build: fixed error relates to exit_price & exit_timestamp 2026-06-04 00:06:43 +01:00
Khizar Imran 48586de436 Initial commit: project strcture & initialisation 2026-06-03 23:39:39 +01:00