Skip to content

orders: a PendingSubmit that is never acked has no deadline and sits forever #385

Description

@userFRM

Problem

A PendingSubmit order that is never acknowledged has no deadline. It sits in that status indefinitely with no ack and no error.

The submit goes out and the order is inserted as PendingSubmit; the gateway's exec report is what moves it on. If that report never comes — the submit was TCP-buffered and never reached the server, or the session dropped between the write and the ack — nothing times it out. req_open_orders reports it as working, and a caller waiting on its status waits forever.

Historical requests already have the shape this needs: pending_historical carries Instant::now() + HISTORICAL_IDLE_TIMEOUT, and sweep_pending_historical reports an error to the caller when the deadline passes (#227). Matching-symbols requests were given the same treatment in #369.

Impact

A submit that never lands is indistinguishable from one that is simply slow, for the life of the process. A strategy waiting on the ack blocks; one that re-submits creates a duplicate if the original did arrive after all.

Solution

Give PendingSubmit a deadline and report the expiry to the caller, as historical requests do. The value wants to be generous — an ack normally arrives in well under a second, but a busy open is not the moment to give up on a live order — and the expiry has to state that the order's fate is unknown rather than that it was rejected, since a submit that reached the gateway may still be working.

Notes

Read from v0.7.1 (9367845). Split from #251, which bundled it with three unrelated items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions