Skip to content

Export Trades By Login

ExportTradesByLogin

Description: Exports the full filtered trade list for the authenticated account into a file stored in the server storage directory.

The account login is resolved from the authenticated session. The method does not return trade rows in JSON.

Request Parameters

Name Type Required Description
tradeType int Yes Trade type filter in range 0..4
format string Yes Output format: csv or excel
where array No Additional conditions for filtering trades
whereNot array No Exclusion conditions for filtering trades
orderBy array No Sort instructions
select array No List of fields to export. If omitted or empty, all default trade fields are exported

Trade Types

  • 0 = all trades
  • 1 = open trades
  • 2 = closed trades
  • 3 = pending trades
  • 4 = finance trades

Supported select Fields

If select is passed, every item must be one of the fields below. Any unknown field causes 400 INVALID_DATA.

  • order
  • login
  • cmd
  • state
  • symbol
  • reason
  • volume
  • open_time
  • close_time
  • open_price
  • close_price
  • sl
  • tp
  • profit
  • commission
  • storage
  • comment
  • digits
  • expiration

Request Example

{
  "tradeType": 1,
  "format": "excel",
  "select": ["order", "symbol", "open_time", "profit"],
  "where": [],
  "whereNot": [],
  "orderBy": [["open_time", "DESC"]]
}

Response Parameters

Name Type Description
file_name string Generated file name stored in storage/

Successful Response Example

{
  "file_name": "550e8400-e29b-41d4-a716-446655440000.xls"
}

Notes

  • format = "csv" generates a .csv file
  • format = "excel" currently generates an Excel-compatible .xls file
  • the response contains only the generated file name with extension
  • the export always contains the full filtered result set
  • limit and offset are not supported by this method

Errors

Code Description
400 Invalid request payload or unsupported field in select
400 Authenticated account is not available
500 Export directory creation or file write failed