Skip to content

Metatrader deal#

About#

Сontains a history deal

Fields#

Name Type Required Description
id string Yes history deal id (ticket)
type string Yes deal type, enum: DEAL_TYPE_BUY, DEAL_TYPE_SELL, DEAL_TYPE_BALANCE, DEAL_TYPE_CREDIT, DEAL_TYPE_CHARGE, DEAL_TYPE_CORRECTION, DEAL_TYPE_BONUS, DEAL_TYPE_COMMISSION, DEAL_TYPE_COMMISSION_DAILY, DEAL_TYPE_COMMISSION_MONTHLY, DEAL_TYPE_COMMISSION_AGENT_DAILY, DEAL_TYPE_COMMISSION_AGENT_MONTHLY, DEAL_TYPE_INTEREST, DEAL_TYPE_BUY_CANCELED, DEAL_TYPE_SELL_CANCELED, DEAL_DIVIDEND, DEAL_DIVIDEND_FRANKED, DEAL_TAX. See deal types
entryType string deal entry type, enum: DEAL_ENTRY_IN, DEAL_ENTRY_OUT, DEAL_ENTRY_INOUT, DEAL_ENTRY_OUT_BY. See deal entries
symbol string symbol deal relates to
magic number deal magic number, identifies the EA which initiated the deal
time string(datetime) Yes time the deal was conducted at, in ISO format
brokerTime string Yes time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format
volume number deal volume
price number the price the deal was conducted at
commission number deal commission
swap number deal swap
profit number Yes deal profit
positionId string id of position the deal relates to
orderId string id of order the deal relates to
comment string deal comment. The sum of the line lengths of the comment and the clientId must be less than or equal to 26. For more information see clientId usage
brokerComment string current comment value on broker side (possibly overriden by the broker)
clientId string client-assigned id. The id value can be assigned when submitting a trade and will be present on position, history orders and history deals related to the trade. You can use this field to bind your trades to objects in your application and then track trade progress. The sum of the line lengths of the comment and the clientId must be less than or equal to 26. For more information see clientId usage
platform string Yes platform id, enum: mt4, mt5
reason string deal execution reason. See https://www.mql5.com/en/docs/constants/tradingconstants/dealproperties#enum_deal_reason. enum: DEAL_REASON_CLIENT, DEAL_REASON_MOBILE, DEAL_REASON_WEB, DEAL_REASON_EXPERT, DEAL_REASON_SL, DEAL_REASON_TP, DEAL_REASON_SO, DEAL_REASON_ROLLOVER, DEAL_REASON_VMARGIN, DEAL_REASON_SPLIT, DEAL_REASON_UNKNOWN
accountCurrencyExchangeRate number current exchange rate of account currency into account base currency (USD if you did not override it)
stopLoss number deal stop loss. For MT5 opening deal this is the SL of the order opening the position. For MT4 deals or MT5 closing deal this is the last known position SL.
takeProfit number deal take profit. For MT5 opening deal this is the TP of the order opening the position. For MT4 deals or MT5 closing deal this is the last known position TP.

Example#

{
  "clientId": "AS_AUDNZD_3zfxXl3RvJ",
  "commission": -0.42,
  "entryType": "DEAL_ENTRY_IN",
  "id": "33582357",
  "magic": 1000,
  "platform": "mt5",
  "orderId": "46648037",
  "positionId": "46648037",
  "price": 1.05782,
  "profit": 0,
  "swap": 0,
  "symbol": "AUDNZD",
  "time": "2020-04-17T04:30:03.223Z",
  "brokerTime": "2020-04-17 07:30:03.223",
  "type": "DEAL_TYPE_BUY",
  "volume": 0.12
}

Usages#