Commit fa44442
committed
fix: correct short position return calculation, bump to v0.1.6
Short trades were incorrectly using long formula (exit/entry - 1).
Now correctly uses (2 - exit/entry - 1) for short positions based
on position_weight sign.
- Modified WideTradeRecord::calculate_return()
- Modified TradeRecord::calculate_return()
- Added unit tests for long/short return calculations1 parent 9ee1e08 commit fa44442
6 files changed
Lines changed: 338 additions & 178 deletions
File tree
- .claude-plugin
- btcore/src
- polars_backtest
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments