Import a broker position as a single trade anchored on real broker orders
POST/api/v1/reconciliation/import-position-from-orders
Re-verifies the exact-match bar (see /order-import-suggestion) at
confirm time, materialises the matched broker orders as UTM Order
rows, ingests their real fills, and creates one trade anchored on
them - no synthetic entry execution. Alpaca only. Returns 409
ORDER_BACKED_IMPORT_UNAVAILABLE if the suggestion is no longer
available (the position changed since it was offered); the caller
should fall back to POST /import-position. Returns 409
ORDER_BACKED_IMPORT_RATE_LIMITED if the broker rate-limited the
order-history or real-fills fetch instead - a transient condition,
not a settled non-match, so the caller should retry rather than
fall back to the snapshot import.
Request
Responses
- 200
- 400
- 401
- 404
- 409
- 422
- 500
Position imported as a new trade anchored on real broker orders
Validation error
Authentication required
code: ORDER_BACKED_IMPORT_ACCOUNT_NOT_FOUND - the account does
not exist or is not owned by the caller.
Conflict. code: OPPOSING_POSITION_OPEN (see /import-position),
code: ORDER_BACKED_IMPORT_UNAVAILABLE when the suggestion is no
longer available, code: ORDER_BACKED_IMPORT_RATE_LIMITED
(#1588) when the broker rate-limited the order-history or
real-fills fetch - retry, do not fall back to the snapshot
import - or code: ORDER_BACKED_IMPORT_ORDER_CONFLICT (#1394)
when a matched order already belongs to a different UTM
trade - details.brokerOrderId and details.conflictingTradeId
name it. Resolve or unlink that trade first, then retry.
Import sanity check failed (code: IMPORT_SANITY_FAILED, see
/import-position), or the recalculated quantity was still zero
after linking every already-in-UTM matched order and ingesting
the matched orders' real fills (code: ORDER_BACKED_IMPORT_ZERO_QUANTITY, #1394). Either way nothing
useful was created; the caller should re-sync and retry.
Server error