Skip to content

Conversation

@felipeimpieri
Copy link
Owner

Summary

  • add indicator and backtest unit tests along with a helper to expose the package to pytest
  • configure GitHub Actions CI to run py_compile and pytest and surface its status via a README badge

Testing

  • python -m py_compile tests/test_indicators.py tests/test_backtest.py
  • python -m py_compile tests/conftest.py
  • pytest -q

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 109 to 113
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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@felipeimpieri felipeimpieri merged commit 0389c66 into codex/clean-repo-and-fix-keyerror-close-kyrlso Nov 18, 2025
2 checks passed
@felipeimpieri felipeimpieri deleted the codex/resolve-merge-conflicts-and-update-files-0yrkro branch November 18, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant