KhizarImran
4972863b5f
perf: replace O(n^2) data slice with a windowed view (~2.6x faster py-next)
2026-07-22 22:37:26 +01:00
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
4fcadca02e
test: cover Python backtest integration
2026-07-17 14:28:24 +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
cdab6ebb58
chore: remove stale python/ dir and __pycache__ from tracking
...
python/backtest.py and python/simple_strategy.py were leftover
duplicates from before the PyO3 restructure; nothing referenced them.
__pycache__ was never gitignored.
2026-07-12 21:02:58 +01:00
KhizarImran
2f726b73ab
chore: bump version to 0.1.1
2026-07-05 16:37:12 +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
e88dc28b2f
docs: add PyPI badge to README
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-21 19:00:52 +01:00
KhizarImran
684800bd30
chore: remove .so binary from tracking, add to .gitignore
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-06-21 18:55:13 +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
2252b4cd8c
publised to pypi
2026-06-21 18:14:03 +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
6e0b63cb3e
testing out python library integration
2026-06-14 17:48:44 +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
516f6029ac
13/06
2026-06-13 10:08:33 +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
e5c82056bc
new: README file
2026-06-04 00:33:30 +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
a1f7540353
Merge branch 'main' of https://github.com/KhizarImran/backtestingfx
2026-06-03 23:40:35 +01:00
Khizar Imran
48586de436
Initial commit: project strcture & initialisation
2026-06-03 23:39:39 +01:00
Khizar Imran
1d6512f781
Initial commit
2026-06-03 23:38:12 +01:00