Export Trades By Filter
MngExportTradesByFilter¶
Description: Exports trades selected by the same tabular filter model as MngGetTradesByFilter into a file stored in the server storage directory.
The method does not return trade rows in JSON. Instead, it creates a file and returns only its generated name.
The export always contains the full filtered result set.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
groupFilter |
string | Yes | Group mask to filter trades |
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 trades1= open trades2= closed trades3= pending trades4= 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.
| Field | Description |
|---|---|
order |
Trade order ID |
login |
Account login |
cmd |
Trade command/type |
state |
Internal trade state |
symbol |
Symbol name |
reason |
Trade creation reason |
volume |
Trade volume |
open_time |
Open timestamp |
close_time |
Close timestamp |
open_price |
Open price |
close_price |
Close price |
sl |
Stop loss |
tp |
Take profit |
profit |
Profit value |
commission |
Commission value |
storage |
Swap/storage value |
comment |
Trade comment |
digits |
Symbol digits |
expiration |
Expiration timestamp |
Request Example¶
{
"groupFilter": "*",
"tradeType": 1,
"format": "csv",
"select": ["order", "login", "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.csv"
}
Notes¶
format = "csv"generates a.csvfileformat = "excel"currently generates an Excel-compatible.xlsfile- the response does not include a host or absolute URL, only the file name with extension
- the file can then be downloaded from the server storage route using the returned name
- if
selectis omitted or passed as an empty array, all standard trade export fields are included
Errors¶
| Code | Description |
|---|---|
| 400 | Invalid request payload or unsupported field in select |
| 500 | Export directory creation or file write failed |