order management
Articles about order management.
Articles
- 8 min read
Stop loss not covering your position after a partial fill
After a partial entry, a canceled remainder, a rejected child or a partial exit, the position can have no working stop, or one too large, and no venue message says so. After every event, compare armed stop quantity with the open position, and check separately that no exit can open the opposite position.
- 10 min read
Multiple trading bots on one account: sharing buying power
Two bots that check a shared balance and then send both pass when each check reads a balance that does not yet show the other's order. Check and reserve atomically at one admission point, persist the reservation before sending, and release it only on a terminal report, never on a cancel acknowledgment or a timeout.
- 9 min read
Trading bot duplicate orders after a timeout: did it fill?
A timeout after the send, an unknown-status error, an HTTP server error or an empty body leaves the outcome unknown. Keep its full size reserved until the order stream or a lookup by its ID finds it, or a person confirms it is absent. Never resend blindly: Binance accepts the same client order ID again after a fill.
- 10 min read
Why your trading bot's position drifts from the broker's
A trading bot's position is the confirmed filled quantity plus the open quantity of every order without a final outcome. Track cumulative fills per order, rebuild after a reconnect by buffering the stream before the snapshot, and check new orders against the worst side of that range.