Create a trade from unlinked executions
POST/api/v1/reconciliation/create-trade
Creates a new trade record and links the specified executions to it. All executions must be currently unlinked and must share the same symbol. Optionally assigns a strategy to the new trade. Fills follow their order (#1334) - when a selected execution carries an orderId, every one of that order's pending_review executions must be included, or the request is rejected naming the order - a trade can never be created from a strict subset of one order's fills. The order is linked to the new trade atomically with its executions.
Request
Responses
- 200
- 400
- 401
- 404
- 409
- 500
Trade created and executions linked
Validation error, executions already linked, executions span multiple symbols, or the selection omits some of an order's fills (#1334, see the endpoint description)
Authentication required
One or more executions, the strategy, or an order those executions point at is not found or not owned by the authenticated user. The whole request is refused and nothing is linked.
Conflict. code: OPPOSING_POSITION_OPEN - the new trade would be the opposing side of an existing non-terminal trade for the same (account, symbol) on a netting broker (Alpaca, TradeStation). Response details.conflictingTradeId carries the existing trade id.
Server error