Skip to content

Get Trades By Group

GetTradesByGroup

Description:
Returns a list of trades filtered by a group_mask. You can choose to return only open trades or include closed trades as well. The response uses a structure + rows format where each row is an array aligned to structure.

Access Control

🛡️ Access Level Required: SESSION_USER, SESSION_MANAGER, SESSION_ADMIN, SESSION_DEALER


Endpoint

GET /trades/group/


Request Parameters

Name Type Required Description
group_mask string Yes Group mask to filter trades (e.g., "IB-*" or "*").
open_only int Yes 1 = return only open trades, 0 = return all trades.

Request Example

{
  "group_mask": "IB-*",
  "open_only": 1
}

Response

The response contains:

  • structure: array of column names
  • rows: array of trade rows (arrays)

Structure Fields

Field Description
order Trade order ID
login Account login
cmd Trade command
state Trade state
symbol Symbol name
reason Reason code
volume Volume in minimal lots
open_time Open timestamp
close_time Close timestamp
open_price Open price
close_price Close price
sl Stop Loss
tp Take Profit
profit Profit
commission Commission
storage Swap/Storage
comment Comment
digits Price digits
expiration Expiration timestamp

Example Response

{
  "structure": [
    "order","login","cmd","state","symbol","reason","volume","open_time","close_time",
    "open_price","close_price","sl","tp","profit","commission","storage","comment",
    "digits","expiration"
  ],
  "rows": [
    [1001234,123456,0,1,"EURUSD",2,1000,1712000000,0,1.1010,0,1.0900,1.1200,0,-2.5,-1.2,"test",5,0]
  ]
}

Error Responses

Validation Error

{
  "error": "INVALID_DATA",
  "message": "open_only is required"
}

Internal Error

{
  "error": "TRADE_ERROR",
  "message": "Unable to fetch trades"
}