Linking Trades to Strategies Through Order References
Summary
A trader asks how to identify the originating strategy for each trade received in a trade callback, so fills from one strategy can be grouped together. The reply suggests capturing the order’s reference field when an order arrives and using it to identify the source strategy.
To associate that information with later trades, keep a mapping between order identifiers and their references. The order and trade can be linked through their shared order identifier, allowing the stored reference to be looked up when processing a fill. The thread offers this as a practical answer but does not provide code or discuss edge cases such as partial fills, identifier reuse, or how a particular framework populates the reference field. It is a brief integration tip rather than a broader trading method.
Key ideas
- Capture an order’s reference when the order event arrives.
- Use the shared order identifier to associate a trade with its originating order.
- Store the reference so fills can be grouped by strategy.
- The discussion does not cover implementation details or edge cases.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.