You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A long-to-short flip is charged as two orders, so a per-order commission applies twice #105
A single order that takes a position from long 100 to short 100 is split into a closing leg and an opening leg, and each leg is passed to the commission model separately. With a model that charges a flat amount per call (the shape of a per-order minimum or a per-ticket fee), one order is charged twice.
Repro: a commission model that records calls and returns 1.0; submit +100, later -200, constant prices, short selling allowed.
The flip is charged 1.0 + 1.0 for one order. Brokers that charge per order (fixed fee or minimum) charge one ticket for a flip.
The model is called once more than it is charged (the 200 call), apparently for a pre-trade estimate. That is fine, but it is undocumented, and a stateful model (counting orders, tiered pricing by monthly volume) will be wrong.
Expected: a flip that is one order is charged as one order, or the split is documented and configurable; and the commission-model docs say when calculate is called and which calls are charged.
Activity
fix(execution): charge one commission for a flip fill
fix(execution): isolate commission estimates from model state
stefan-jansen commentedon Sep 24, 2026
Verified on PR #119 at commit 8343029. The focused tests in tests/test_commission_flip.py passed locally (2 passed); the remote coverage job passed. A long-to-short flip produces one commission-bearing fill, including stateful commission models.
Fix Backtest correctness issues and build guided documentation