Skip to content

Scope proposal: attribute OKX native-protection child fills to their owning strategy #369

Closed

Description

@AmazingZ-sys

Problem

Exchange-native stop-loss/take-profit orders may produce a filled child order with an exchange order ID different from the original strategy entry order. If no binding exists for the child ID, the execution processor retains the account event but cannot attribute the trade to its strategy. Current binding discovery checks regular pending-order identifiers and does not use the parent protection response's algoId.

PR #365 fixes protection placement precision and quantity checks; it does not implement this attribution path.

Proposed scope for maintainer agreement

  • Discover ownership only from an exact protection identifier and a unique parent, with matching tenant, credential, instrument, direction and reduction semantics.
  • Treat the child fill as an observed exchange event. Discovery must not submit a new order.
  • Preserve idempotency, immutable strategy-run provenance and existing ledger projection.
  • Use exchange occurrence time for the associated trade when appropriate, including events received on a later day.
  • Leave ambiguous, manual or cross-account events unattributed.

Required regression coverage

  • Correct stop-loss and take-profit association with synthetic events.
  • Wrong account, tenant, instrument, side, ambiguous parent and absent identifier are rejected.
  • Duplicate delivery projects one fill and never dispatches an exchange order.
  • Late delivery preserves actual execution time and does not corrupt an existing trade aggregate.
  • Partial fills and legacy credential metadata are covered or explicitly excluded.

Please confirm this scope before an execution-critical implementation PR, as required by CONTRIBUTING.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions