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¶
- Handler validates the same request fields as
MngOpenTrade. - Backend reserves the
orderand queues the open trade request. - TCP stores a pending sync waiter by
order,extID, event type and active session. mainLoopprocesses the request and emitstrade:event.- TCP matches
trade:event.data.orderand returns the matched eventdata.
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¶
MngOpenTradeSyncis market-only.- For pending orders use
MngOpenPendingTrade. - Use
MngOpenTradewhen an immediate accepted-command response is enough.