Skip to content

Export Trades By Login

Exports the full filtered trade list for the authenticated account into a file stored on the server.

POST

https://{some_domain}/trades/export

Authorization

All requests must include a JWT token:

Authorization: <JWT_TOKEN>

The account login is resolved from the authenticated session.

Request

Content-Type: application/json

Body Parameters

Field 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 filter rules
whereNot array No Negated filter rules
orderBy array No Sort instructions
select array No List of fields to export. If omitted or empty, all default trade fields are exported

tradeType Values

  • 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": "csv",
  "select": ["order", "symbol", "open_time", "profit"],
  "where": [],
  "whereNot": [],
  "orderBy": [["open_time", "DESC"]]
}

Response

Success (200)

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

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

Error Responses

Code Error Description
400 INVALID_DATA Validation failed or select contains an unsupported field
400 INVALID_USER Authenticated account is not available
401 PERMISSION_DENIED Missing or invalid authenticated session
500 EXPORT_CREATE_DIR_ERROR Failed to create the storage directory
500 EXPORT_OPEN_FILE_ERROR Failed to open the export file
500 EXPORT_WRITE_FILE_ERROR Failed to write the export file