Skip IBKR fractional orders below API minimum - #62
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 345fb93182
ℹ️ 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".
| execution_summary["orders_skipped"].append( | ||
| { | ||
| "symbol": symbol, | ||
| "side": "buy", | ||
| "reason": "fractional_quantity_too_small", |
There was a problem hiding this comment.
Defer fractional-skip logging until execution phase
Logging orders_skipped in the planning pass causes duplicate skip records whenever at least one other symbol makes the rebalance executable. In that case this symbol is appended here, then appended again in the later buy/sell execution loops when it is re-evaluated and skipped for the same reason, which inflates skip counts and can mislead downstream monitoring/reporting that treats each entry as a distinct skipped order.
Useful? React with 👍 / 👎.
Prevent IBKR API rejections for tiny fractional orders by skipping orders that floor below roughly 0.01 shares. This keeps TQQQ-sized fractional orders working while avoiding 10243 on very small QQQ-like residuals.\n\nValidation:\n- ./.venv/bin/python -m pytest tests/test_execution_service.py -q -k 'fractional_buy or fractional_orders_below_ibkr_minimum_quantity'\n- ./.venv/bin/python -m py_compile application/execution_service.py tests/test_execution_service.py application/ibkr_order_execution.py