Add automated tests and CI workflow#20
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| prev_pos = pos.shift(1).fillna(0.0) | ||
| entries = (pos != 0.0) & (pos != prev_pos) | ||
| # shift trade ids so the flip bar's return stays with the trade that held it | ||
| trade_ids = entries.shift(1).cumsum() | ||
| trade_ids = trade_ids.where(pos != 0.0) |
There was a problem hiding this comment.
Avoid splitting a single position into multiple trades
Trade IDs are generated from entries.shift(1).cumsum() so the cumulative counter increments on the bar after every entry. When a trade starts after a flat period (e.g., signals [0, 1, 1, 0]), the entry bar and the following bars receive different trade_ids, producing two trades (one with a zero return) instead of one. This inflates Trades count and dilutes Avg trade return/Win rate for any strategy that opens after the first bar, contradicting expected trade accounting.
Useful? React with 👍 / 👎.
…dex/resolve-merge-conflicts-and-update-files-0yrkro
0389c66
into
codex/clean-repo-and-fix-keyerror-close-kyrlso
Summary
Testing
Codex Task