Skip to content

Fix backtest modify order quantity#317

Open
rikkaka wants to merge 1 commit into
nkaz001:masterfrom
rikkaka:fix-backtest-modify-qty
Open

Fix backtest modify order quantity#317
rikkaka wants to merge 1 commit into
nkaz001:masterfrom
rikkaka:fix-backtest-modify-qty

Conversation

@rikkaka

@rikkaka rikkaka commented Jun 15, 2026

Copy link
Copy Markdown

Summary

  • Keep modified backtest orders leaves_qty in sync with the requested qty.
  • Restore leaves_qty if a local modify request is rejected before reaching the exchange.
  • Add a regression test for a requeued modify that increases order quantity and then fills.

Root Cause

Local::modify and L3Local::modify updated qty but left leaves_qty unchanged. When L2 exchange processors handled a modify by canceling and re-adding the order, ack_new reused the stale leaves_qty, so the order could still execute with the old remaining quantity.

Validation

  • cargo test -p hftbacktest modifies_order_leaves_qty_when_requeued
  • cargo test -p hftbacktest --lib

Note: cargo test -p hftbacktest still fails on existing example compile errors unrelated to this change.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@rikkaka
rikkaka marked this pull request as ready for review June 15, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant