Skip to content

Open Trade Sync

MngOpenTradeSync

Description: Opens a new market trade and keeps the TCP request open until the matching trade:event is broadcast by the trading runtime.

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.

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. Handler validates the same request fields as MngOpenTrade.
  2. Backend reserves the order and queues the open trade request.
  3. TCP stores a pending sync waiter by order, extID, event type and active session.
  4. mainLoop processes the request and emits trade:event.
  5. TCP matches trade:event.data.order and returns the matched event data.

Success Response

On success the response contains only the data object from the matching trade:event.

{
  "extID": "open-sync-1",
  "status": 200,
  "data": {
    "order": 1001234,
    "login": 123456,
    "symbol": "EURUSD",
    "cmd": 0,
    "state": 0,
    "volume": 1000
  }
}

Event Matching

TCP waits for trade:event with type = EV_RECORD_ADD and matching data.order.

Timeout

The default timeout is 5000 ms. If no matching trade event arrives before timeout, TCP returns status = 504 with SYNC_TIMEOUT.

Notes

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