Skip to content

MngOpenTradeSync

Description: Opens a new market trade and returns the applied result of this specific operation in the same TCP request.

MngOpenTradeSync is useful for CRM, backoffice, dealing, and integration flows that need the final opened trade payload in the command response instead of receiving only an accepted order acknowledgment.

SEO

MngOpenTradeSync is the synchronous TCP market order method for ScaleTrade manager API integrations. Use this endpoint when a CRM, dealer plugin, backoffice tool, or trading connector must open a market trade and receive the resulting trade event payload by order.

Access Control

Requires dealer_trades for manager/dealer sessions. The target account must also match the manager groups and brand scope loaded from the cached manager record. Token payload is used only for manager id and session type.

Copy-Follower Manual-Write Checks

For SESSION_USER or SESSION_CUSTOMER requests, this mutation applies the copy-follower manual_trading_mode after the usual account/order ownership checks. The check applies only when the target account has an enabled follower profile. Mode 0 rejects all manual writes; mode 1 permits new or non-copied orders but rejects changes to linked copied orders; mode 2 permits both. Manager/admin/dealer staff sessions bypass this follower policy.

HTTP Error Message
403 COPY_MANUAL_TRADING_DISABLED Manual trading is disabled for this copy follower
403 COPY_COPIED_ORDER_MANUAL_FORBIDDEN Manual changes to copied orders are disabled for this copy follower

The command returns the denial for its target login or order without accepting that mutation.

Request Parameters

Name Type Required Description
login int Yes Account login ID
cmd int Yes Market command only: OP_BUY=0 or OP_SELL=1
volume int Yes Trade volume in minimal lots
symbol string Yes Trading instrument
sl double Yes Stop Loss value
tp double Yes Take Profit value
open_price double No Optional requested open price
open_time int64 No Optional requested open timestamp
comment string No Optional trade comment
__access object Yes Manager/session access object

Request Example

{
  "command": "MngOpenTradeSync",
  "extID": "open-sync-1",
  "data": {
    "login": 123456,
    "cmd": 0,
    "volume": 1000,
    "symbol": "EURUSD",
    "sl": 1.1,
    "tp": 1.2,
    "__access": {
      "type": 1
    }
  }
}

Runtime Flow

  1. TCP creates a request-local completion latch before dispatch.
  2. The authenticated handler validates access and admits the operation.
  3. The runtime retains the initiating operation context through execution.
  4. The applied result or a known execution error completes only this request. Early completion is retained until response delivery.

Success Response

The response uses the existing trade-event data schema, but contains the snapshot applied by this operation, not a later quote or another request. See Sync completion and response fields for every response field and error format.

{
  "extID": "sync-1",
  "status": 200,
  "data": {
    "order": 1001234,
    "login": 123456,
    "cmd": 0,
    "state": 0,
    "symbol": "EURUSD",
    "reason": 3,
    "cashier_transaction_id": 0,
    "volume": 1000,
    "parent_order": 0,
    "closed_volume": 0,
    "partial_close_volume": 0,
    "open_time": 1790950014,
    "close_time": 0,
    "open_price": 1.1002,
    "close_price": 1.1,
    "sl": 1.1,
    "tp": 1.2,
    "profit": -200,
    "commission": 0,
    "storage": 0,
    "comment": "",
    "digits": 5,
    "expiration": 0,
    "update_time": 1790950014
  }
}

Operation Correlation

The result is correlated to the internal operation context and this request's completion latch. Matching an order number or receiving an ordinary quote update cannot complete the request. No broadcast subscription is required. Command access checks and broadcast recipient filtering remain unchanged.

Timeout

The default completion deadline is 5000 ms, measured from TCP worker dispatch. Known execution failures return their mapped error without waiting for that deadline. If no result completes within the deadline, TCP returns 504 SYNC_TIMEOUT. A timeout does not cancel execution or prove that no mutation occurred; inspect the trade and traces before retrying. See Sync completion for complete error examples.

Notes

  • MngOpenTradeSync is market-only.
  • For pending orders use MngOpenPendingTrade.
  • Use MngOpenTrade when an immediate accepted-command response is enough.