Skip to main content

RequestAccountsHistory

Request trading history for the specified accounts

Request format

{
"HistoryType": "ByClosedPositions",
"TradeCommands":["Buy","BuyCanceled"]
"From": "2022-01-06",
"To": "2022-01-14",
"AccountIds": [
{
Login: 488644,
Node: "MT4dev",
Platform: "Mt4"
},
{
Login: 48864512,
Node: "MT5dev",
Platform: "Mt5"
}
],
"Agents": [
{
Agent: 1234,
Node: "MT4dev",
Platform: "Mt4"
}
],
"Emails": [
"mail@mail.net",
"mail2@mail.net",
],
"PageSize": 100,
"PageNum": 1,
"Nodes": [
"Node1"
],
"RequestId": "e10fbea8-7a2a-41c4-b2ec-90b6bdcfeb3b",
"RequestName": "RequestAccountsHistory"
}

Trade commands

public enum TradeCommand : int
{
Buy = 0,
Sell,
BuyLimit,
SellLimit,
BuyStop,
SellStop,
Balance,
Credit,
BuyCanceled,
SellCanceled,
Correction,
Bonus,
Commission,
Dividend,
Tax,
InterestRate,
Charge,
SOCompensation,
Specific,
BuyStopLimit,
SellStopLimit,
}

HistoryType

public enum OrdersHistoryTypes
{
ByClosedPositions,
ByDeals,
}

Request parameters:

NameDescription
TradeCommandsDeal type filter
HistoryTypeThe way the result is presented (only MT5)
FromHistory start date and time
ToDate and time of the end of history
AccountIdsAccounts to get comments
AgentsAgents of accounts to get comments
EmailsEmails of accounts to get comments
PageSizeNumber of entries per page
PageNumPage number (first page: 1)
NodesList of nodes that participate in the request. If the list is empty, then all available nodes are used.
RequestIdUnique request GUID
RequestNameRequest type

Response ResponseAccountsHistory

{
"Result": {
"Page": [{
"Node": "MT5dev",
"Platform": "Mt5",
"Type": "OrderRecord",
"TicketType": "ClosedPosition",
"TicketId": 6728,
"Login": 2000103,
"Group": "group1",
"Country": "NETHERLANDS",
"Currency": "USD",
"Symbol": "USDCAD",
"Digits": 5,
"Status": "Realized",
"Cmd": "Buy",
"State": "OpenNormal",
"Activation": "None",
"Reason": "Dealer",
"Volume": 0.01,
"VolumeInUsd": 1000.0,
"OpenTime": "2022-07-15 12:31:13:000",
"OpenPrice": 1.30992,
"Sl": 0.0,
"Tp": 0.0,
"CloseTime": "2022-07-15 12:31:22:826",
"MarginRate": 1.0,
"Commission": 0.0,
"CommissionInUsd": 0.0,
"CommissionAgent": 0.0,
"CommissionAgentInUsd": 0.0,
"Swaps": 0.0,
"SwapsInUsd": 0.0,
"ClosePrice": 1.3102799999999999,
"Profit": -0.27,
"ProfitWithTaxesUsd": -0.27,
"Taxes": 0.0,
"Comment": "",
"GwOrder": 0,
"GwVolume": 0.01,
"GwOpenPrice": 0.0,
"GwClosePrice": 0.0,
"Timestamp": "2022-07-15 12:31:22:000",
"OpenPriceFromMarketInPoints": 3.6,
"ABook": 0,
"IsReal": true,
"Book": "BBook",
"IsAgentCommission": false
}, {
"Node": "MT4dev",
"Platform": "Mt4",
"Type": "OrderRecord",
"TicketType": "ClosedPosition",
"TicketId": 70985,
"Login": 488649,
"Group": "groupOfGroup2",
"Country": "KAZAKHSTAN",
"Currency": "USD",
"Symbol": "EURUSD",
"Digits": 5,
"Status": "Realized",
"Cmd": "Buy",
"State": "ClosedNormal",
"Activation": "None",
"Reason": "Dealer",
"Volume": 0.5,
"VolumeInUsd": 50190.0,
"OpenTime": "2022-07-15 12:27:18:000",
"OpenPrice": 1.0037,
"CloseTime": "2022-07-15 12:27:26:000",
"MarginRate": 1.0037,
"Commission": 0.0,
"CommissionInUsd": 0.0,
"CommissionAgent": 0.0,
"CommissionAgentInUsd": 0.0,
"Swaps": 0.0,
"SwapsInUsd": 0.0,
"ClosePrice": 1.00352,
"Profit": -9.0,
"ProfitWithTaxesUsd": -9.0,
"Taxes": 0.0,
"Comment": "",
"Timestamp": "2022-07-15 12:27:26:000",
"OpenPriceFromMarketInPoints": -1.8,
"ABook": 0,
"IsReal": true,
"Book": "BBook",
"IsMini": false,
"IsAgentCommission": false
}],
"PageSize": 50,
"PageNum": 1,
"TotalRecords": 2
},
"RequestId": "e10fbea8-7a2a-41c4-b2ec-90b6bdcfeb3b",
"Errors": [],
"ResponseMaster": "ResponseAccountsHistory"
}