Skip to main content

Before submitting

Check availability, permissions, active verification, and that the provider has enabled trading. Query existing positions and orders, and retrieve a tick for the symbol. Confirm volume units and restrictions with the provider.

Sequence

  1. Define the intent: account, symbol, direction, and volume.
  2. For market orders, omit price and digits to resolve them automatically. For pending orders, provide the target price.
  3. Store the exact body and an idempotency key before submission.
  4. Submit the opening order and keep answer.id or answer.ID.
  5. Query the result with the same token and reconcile the account.
  6. Identify the actual ticket of the position you want to close.
  7. Submit the closing order in the opposite direction with a new key.
  8. Confirm the closing result and the reduction or disappearance of the position.
  9. Revoke verification when authorization ends and you no longer need access.

Distinguish these identifiers

An intent may require several HTTP queries, each with its own X-Request-ID. None of these tracking identifiers replaces the position ticket. For netting accounts or concurrent trades, do not associate a position with your request solely because it has the same symbol. Reconcile the broker result, available identifiers, and the account’s state before and after the trade. Pending orders: limit, stop, and stop-limit.