Servers

localhost ws

Development server with websockets

Security:
  • HTTP API key:

    Authorization token

    In: query
https://us-east-2.queue.amazonaws.com/{accountNumber} sqs

AWS SQS server

accountNumber: AWS SQS account number

Operations

Sub request

This channel is intended for requests to Metatrader API. Depending on the type passed in the request, different operations will be performed

Executes websocket request

The application listens for the request event, waiting for a request from the user. For available requests see payload below.

Accepts the following message:

Payload
allOf
0
object

Required data for all requests

accountId
required
string

MetaTrader account id. You can retrieve account id from Web application after you add your MetaTrader account to our platform. The account id can also be obtained via Provisioning API

requestId
required
string

request id which your application must supply. Request id must be unique during an API connection

application
string

MetaApi application id. Default is MetaApi

Additional properties are NOT allowed.

1
oneOf
0
object

Returns account information for a specified MetaTrader account

type
required
string
Enum: "getAccountInformation"

Additional properties are NOT allowed.

1
object

Returns positions for a specified MetaTrader account

type
required
string
Enum: "getPositions"

Additional properties are NOT allowed.

2
object

Returns specific position for a MetaTrader account

type
required
string
Enum: "getPosition"
positionId
required
string

position id (ticket number)

Additional properties are NOT allowed.

3
object

Returns open orders for a specified MetaTrader account

type
required
string
Enum: "getOrders"

Additional properties are NOT allowed.

4
object

Returns specific open order for a MetaTrader account

type
required
string
Enum: "getOrder"
orderId
required
string

order id (ticket number)

Additional properties are NOT allowed.

5
object

Returns history deals with a specific ticket number

type
required
string
Enum: "getDealsByTicket"
ticket
required
string

ticket number (deal id for MT5 or order id for MT4)

Additional properties are NOT allowed.

6
object

Returns history deals for a specific position id

type
required
string
Enum: "getDealsByPosition"
positionId
required
string

position id

Additional properties are NOT allowed.

7
object

Returns history deals with for a specific time range

type
required
string
Enum: "getDealsByTimeRange"
startTime
required
string
datetime

start of time range, inclusive (ISO format)

endTime
required
string
datetime

end of time range, exclusive (ISO format)

offset
integer

result deals offset

limit
integer

result deals limit

Additional properties are NOT allowed.

8
object

Returns the history of completed orders for a specific ticket number

type
required
string
Enum: "getHistoryOrdersByTicket"
ticket
required
string

ticket number (order id)

Additional properties are NOT allowed.

9
object

Returns the history of completed orders for a specific position id

type
required
string
Enum: "getHistoryOrdersByPosition"
positionId
required
string

position id

Additional properties are NOT allowed.

10
object

Returns the history of completed orders for a specific time range

type
required
string
Enum: "getHistoryOrdersByTimeRange"
startTime
string
datetime

start of time range, inclusive (ISO format)

endTime
string
datetime

end of time range, exclusive (ISO format)

offset
integer

result orders offset

limit
integer

result orders limit

Additional properties are NOT allowed.

11
object

Clears the order and transaction history of a specified account

type
required
string
Enum: "removeHistory"

Additional properties are NOT allowed.

12
object

Request for reconnection to the Metatrader terminal. Returns the response on successful disconnection from the terminal.

type
required
string
Enum: "reconnect"

Additional properties are NOT allowed.

13
object

Requests the terminal to start synchronization process

type
required
string
Enum: "synchronize"
startingDealTime
string
datetime

from what date to start deal synchronization from. If not specified, then all history deals will be downloaded. Datetime in ISO format

startingHistoryOrderTime
string
datetime

from what date to start synchronizing history orders from. If not specified, the entire order history will be downloaded. Datetime in ISO format

Additional properties are allowed.

14
object

Requests the server to wait for server-side synchronization process to complete

type
required
string
Enum: "waitSynchronized"
applicationPattern
string

application regular expression pattern. Default is .*

timeoutInSeconds
number

timeout in seconds

Additional properties are allowed.

15
object

Requests subscription to the terminal events. The server will respond with authenticated once subscription is started.

type
required
string
Enum: "subscribe"

Additional properties are allowed.

16
object

Subscribe on market data of specified symbol

type
required
string
Enum: "subscribeToMarketData"
symbol
required
string

symbol (e.g. currency pair or an index)

Additional properties are NOT allowed.

17
object

Retrieve symbol specification

type
required
string
Enum: "getSymbolSpecification"
symbol
required
string

symbol (e.g. currency pair or an index)

Additional properties are NOT allowed.

18
object

Retrieve symbol price

type
required
string
Enum: "getSymbolPrice"
symbol
required
string

symbol (e.g. currency pair or an index)

Additional properties are NOT allowed.

19
object allOf

Execute a trade on a connected MetaTrader account

Additional properties are allowed.

0
object
type
string
Enum: "trade"

Additional properties are NOT allowed.

1
oneOf
0
object

Submits market order to the trading terminal

actionType
required
string
Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY"
symbol
required
string

symbol to trade

volume
required
number

order volume

stopLoss
number

optional stop loss price

takeProfit
number

optional take profit price

comment
string

optional comment

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

magic
number
integer

magic value (expert adviser id)

slippage
number
integer

slippage in points. Should be greater or equal to zero. In not set, default value specified in account entity will be used. Slippage is ignored on position modification, order modification and order cancellation calls. Slippage is also ignored if execution mode set in symbol specification is SYMBOL_TRADE_EXECUTION_MARKET

fillingModes
array<string>

allowed filling modes in the order of priority. Default is to allow all filling modes and prefer ORDER_FILLING_FOK over ORDER_FILLING_IOC. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling for extra explanation

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

expiration
object

pending order expiration settings

type
required
string

pending order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time for the list of possible options. MetaTrader4 platform supports only ORDER_TIME_SPECIFIED expiration type

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
time
string
datetime

pending order expiration time. Ignored if expiration type is not one of ORDER_TIME_DAY or ORDER_TIME_SPECIFIED

Additional properties are allowed.

Additional properties are NOT allowed.

1
object

Submits pending order to the trading terminal

actionType
required
string
Enum: "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
symbol
required
string

symbol to trade

volume
required
number

order volume

openPrice
required
number

order limit or stop price

stopLoss
number

optional stop loss price

takeProfit
number

optional take profit price

comment
string

optional comment

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

magic
number
integer

magic value (expert adviser id)

slippage
number
integer

slippage in points. Should be greater or equal to zero. In not set, default value specified in account entity will be used. Slippage is ignored on position mondification, order modification and order cancellation calls. Slippage is also ignored if execution mode set in symbol specification is SYMBOL_TRADE_EXECUTION_MARKET

Additional properties are NOT allowed.

2
object

Modifies a position TP/SL price

actionType
required
string
Enum: "POSITION_MODIFY"
positionId
required
string

position id

stopLoss
number

optional stop loss price

takeProfit
number

optional take profit price

Additional properties are NOT allowed.

3
object

Partially closes a position

actionType
required
string
Enum: "POSITION_PARTIAL"
positionId
required
string

position id

volume
required
number

order volume

comment
string

optional comment

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

magic
number
integer

magic value (expert adviser id)

slippage
number
integer

slippage in points. Should be greater or equal to zero. In not set, default value specified in account entity will be used. Slippage is ignored on position mondification, order modification and order cancellation calls. Slippage is also ignored if execution mode set in symbol specification is SYMBOL_TRADE_EXECUTION_MARKET

fillingModes
array<string>

allowed filling modes in the order of priority. Default is to allow all filling modes and prefer ORDER_FILLING_FOK over ORDER_FILLING_IOC. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling for extra explanation

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

Additional properties are NOT allowed.

4
object

Closes a position fully

actionType
required
string
Enum: "POSITION_CLOSE_ID"
positionId
required
string

position id

comment
string

optional comment

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

magic
number
integer

magic value (expert adviser id)

slippage
number
integer

slippage in points. Should be greater or equal to zero. In not set, default value specified in account entity will be used. Slippage is ignored on position mondification, order modification and order cancellation calls. Slippage is also ignored if execution mode set in symbol specification is SYMBOL_TRADE_EXECUTION_MARKET

fillingModes
array<string>

allowed filling modes in the order of priority. Default is to allow all filling modes and prefer ORDER_FILLING_FOK over ORDER_FILLING_IOC. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling for extra explanation

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

Additional properties are NOT allowed.

5
object

Close positions by symbol

actionType
required
string
Enum: "POSITIONS_CLOSE_SYMBOL"
symbol
required
string

symbol to trade

comment
string

optional comment

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

magic
number
integer

magic value (expert adviser id)

slippage
number
integer

slippage in points. Should be greater or equal to zero. In not set, default value specified in account entity will be used. Slippage is ignored on position mondification, order modification and order cancellation calls. Slippage is also ignored if execution mode set in symbol specification is SYMBOL_TRADE_EXECUTION_MARKET

fillingModes
array<string>

allowed filling modes in the order of priority. Default is to allow all filling modes and prefer ORDER_FILLING_FOK over ORDER_FILLING_IOC. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling for extra explanation

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

Additional properties are NOT allowed.

6
object

Modifies a pending order

actionType
required
string
Enum: "ORDER_MODIFY"
orderId
required
string

order id (ticket number)

openPrice
required
number

limit or stop price, required for a pending order

stopLoss
number

optional stop loss price

takeProfit
number

optional take profit price

Additional properties are NOT allowed.

7
object

Cancels an order

actionType
required
string
Enum: "ORDER_CANCEL"
orderId
required
string

order id (ticket number)

Additional properties are NOT allowed.

20
object

Removes the MetaApi application and clears history stored by the app

type
required
string
Enum: "removeApplication"

Additional properties are NOT allowed.

websocket metatrader account api

Examples

{
  "accountId": "string",
  "requestId": "string",
  "application": "string",
  "type": "getAccountInformation"
}
This example has been generated automatically.

Pub response

This channel is designed to send responses to requests to MetaApi that come through the request channel.

Sends a response to the request

The type of response varies depending on the request. In the description of each answer it will be written to which request it relates.

Accepts the following message:

Payload
allOf
0
object

Required data for all responses

type
required
string

The value of this field will be response in the response to the above request

Enum: "response"
requestId
required
string

request id the response relates to

accountId
required
string

account id specified in the request

Additional properties are NOT allowed.

1
oneOf
0
object

Response to account information request

accountInformation
required
object

account information

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
broker
required
string

broker name

currency
required
string

account base currency

server
required
string

broker server name

balance
required
number

account balance

equity
required
number

account liquidation value

margin
required
number

margin used

freeMargin
required
number

free margin

leverage
required
number

account leverage

marginLevel
number

margin level calculated as % of equity/margin

Additional properties are allowed.

Additional properties are NOT allowed.

1
object

Response to positions request

positions
required
array<object>

Items:

0
object
id
required
string

position id (ticket)

type
required
string

position type

Enum: "POSITION_TYPE_BUY" "POSITION_TYPE_SELL"
symbol
required
string

position symbol

magic
required
number
integer

position magic number, identifies the EA which opened the position

time
required
string
datetime

time position was opened at, in ISO format

brokerTime
required
string

time position was opened at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

updateTime
required
string
datetime

last position modification time, in ISO format

openPrice
required
number

position open price

currentPrice
required
number

current price

currentTickValue
number

current tick value

stopLoss
number

optional position stop loss price

takeProfit
number

optional position take profit price

volume
required
number

position volume

swap
required
number

position cumulative swap

profit
required
number

position cumulative profit

comment
string

optional position comment

clientId
string

optional client-assigned position id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

commission
required
number

position commission

reason
required
string

position opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties#enum_position_reason

Enum: "POSITION_REASON_CLIENT" "POSITION_REASON_EXPERT" "POSITION_REASON_MOBILE" "POSITION_REASON_WEB" "POSITION_REASON_UNKNOWN"
unrealizedProfit
required
number

profit of the part of the position which is not yet closed, including swap

realizedProfit
required
number

profit of the already closed part, including commissions and swap

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

originalComment
string

optional position original comment (present if possible to restore from history)

updatePending
boolean

optional flag indicating that position original comment and clientId was not identified yet and will be updated in a future packet

Additional properties are allowed.

Additional items are allowed.

Additional properties are NOT allowed.

2
object

Response to a request for a specified position

position
required
object
id
required
string

position id (ticket)

type
required
string

position type

Enum: "POSITION_TYPE_BUY" "POSITION_TYPE_SELL"
symbol
required
string

position symbol

magic
required
number
integer

position magic number, identifies the EA which opened the position

time
required
string
datetime

time position was opened at, in ISO format

brokerTime
required
string

time position was opened at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

updateTime
required
string
datetime

last position modification time, in ISO format

openPrice
required
number

position open price

currentPrice
required
number

current price

currentTickValue
number

current tick value

stopLoss
number

optional position stop loss price

takeProfit
number

optional position take profit price

volume
required
number

position volume

swap
required
number

position cumulative swap

profit
required
number

position cumulative profit

comment
string

optional position comment

clientId
string

optional client-assigned position id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

commission
required
number

position commission

reason
required
string

position opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties#enum_position_reason

Enum: "POSITION_REASON_CLIENT" "POSITION_REASON_EXPERT" "POSITION_REASON_MOBILE" "POSITION_REASON_WEB" "POSITION_REASON_UNKNOWN"
unrealizedProfit
required
number

profit of the part of the position which is not yet closed, including swap

realizedProfit
required
number

profit of the already closed part, including commissions and swap

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

originalComment
string

optional position original comment (present if possible to restore from history)

updatePending
boolean

optional flag indicating that position original comment and clientId was not identified yet and will be updated in a future packet

Additional properties are allowed.

Additional properties are NOT allowed.

3
object

Response to orders request

orders
required
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

Additional properties are NOT allowed.

4
object

Response to a request for a specified order

order
required
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional properties are NOT allowed.

5
object

Response to a request for history deals with a specified ticket

deals
required
array<object>

Items:

0
object
id
required
string

history deal id (ticket)

type
required
string

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"
entryType
string

deal entry type

Enum: "DEAL_ENTRY_IN" "DEAL_ENTRY_OUT" "DEAL_ENTRY_INOUT" "DEAL_ENTRY_OUT_BY"
symbol
string

optional symbol deal relates to

magic
number
integer

optional deal magic number, identifies the EA which initiated the deal

time
required
string
datetime

time the deal was conducted at, in ISO format

brokerTime
required
string

time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

volume
number

optional deal quantity

price
number

optional, the price the deal was conducted at

commission
number

optional deal commission

swap
number

optional deal swap

profit
required
number

deal profit

positionId
string

optional id of position the deal relates to

orderId
string

optional id of order the deal relates to

comment
string

optional deal comment

originalComment
string

optional deal original comment (present if possible to restore from history)

clientId
string

optional client-assigned deal id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that deal original comment and clientId was not identified yet and will be updated in a future packet

reason
string

optional 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 USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

6
object

Response to a request for history deals with a specified position id

deals
required
array<object>

Items:

0
object
id
required
string

history deal id (ticket)

type
required
string

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"
entryType
string

deal entry type

Enum: "DEAL_ENTRY_IN" "DEAL_ENTRY_OUT" "DEAL_ENTRY_INOUT" "DEAL_ENTRY_OUT_BY"
symbol
string

optional symbol deal relates to

magic
number
integer

optional deal magic number, identifies the EA which initiated the deal

time
required
string
datetime

time the deal was conducted at, in ISO format

brokerTime
required
string

time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

volume
number

optional deal quantity

price
number

optional, the price the deal was conducted at

commission
number

optional deal commission

swap
number

optional deal swap

profit
required
number

deal profit

positionId
string

optional id of position the deal relates to

orderId
string

optional id of order the deal relates to

comment
string

optional deal comment

originalComment
string

optional deal original comment (present if possible to restore from history)

clientId
string

optional client-assigned deal id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that deal original comment and clientId was not identified yet and will be updated in a future packet

reason
string

optional 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 USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

7
object

Response to a request for history deals with a specified time range

deals
required
array<object>

Items:

0
object
id
required
string

history deal id (ticket)

type
required
string

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"
entryType
string

deal entry type

Enum: "DEAL_ENTRY_IN" "DEAL_ENTRY_OUT" "DEAL_ENTRY_INOUT" "DEAL_ENTRY_OUT_BY"
symbol
string

optional symbol deal relates to

magic
number
integer

optional deal magic number, identifies the EA which initiated the deal

time
required
string
datetime

time the deal was conducted at, in ISO format

brokerTime
required
string

time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

volume
number

optional deal quantity

price
number

optional, the price the deal was conducted at

commission
number

optional deal commission

swap
number

optional deal swap

profit
required
number

deal profit

positionId
string

optional id of position the deal relates to

orderId
string

optional id of order the deal relates to

comment
string

optional deal comment

originalComment
string

optional deal original comment (present if possible to restore from history)

clientId
string

optional client-assigned deal id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that deal original comment and clientId was not identified yet and will be updated in a future packet

reason
string

optional 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 USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

8
object

Response to a request for history orders with a specified ticket

historyOrders
required
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

9
object

Response to a request for history orders with a specified position id

historyOrders
required
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

10
object

Response to a request for history orders with a specified time range

historyOrders
required
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

synchronizing
required
boolean

If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

Additional properties are NOT allowed.

11
object

Response to remove history request. An empty object means that only the main fields specified above will be transferred.

Additional properties are NOT allowed.

12
object

Response to connect request. After connecting to the terminal, another response will come. An empty object means that only the main fields specified above will be transferred.

Additional properties are NOT allowed.

13
object

Response to synchronize request

Additional properties are NOT allowed.

14
object

Response to waitSynchronized request

Additional properties are NOT allowed.

15
object

Response to subscribe request. The server will send authenticated once subscribed to the terminal.

Additional properties are NOT allowed.

16
object

Response to subscribe to market data request

Additional properties are NOT allowed.

17
object

Response to getSymbolSpecification request

specification
object

symbol specification

symbol
required
string

symbol (e.g. currency pair or an index)

tickSize
required
number

tick size

minVolume
required
number

minimum order volume for the symbol

maxVolume
required
number

maximum order volume for the symbol

volumeStep
required
number

order volume step for the symbol

fillingModes
required
array<string>

list of allowed order filling modes

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

executionMode
required
string

Deal execution mode

Enum: "SYMBOL_TRADE_EXECUTION_REQUEST" "SYMBOL_TRADE_EXECUTION_INSTANT" "SYMBOL_TRADE_EXECUTION_MARKET" "SYMBOL_TRADE_EXECUTION_EXCHANGE"
contractSize
required
number

trade contract size

quoteSessions
required
object

quote sessions, indexed by day of week

SUNDAY
array<object>

array of sessions for SUNDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

MONDAY
array<object>

array of sessions for MONDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

TUESDAY
array<object>

array of sessions for TUESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

WEDNESDAY
array<object>

array of sessions for WEDNESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

THURSDAY
array<object>

array of sessions for THURSDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

FRIDAY
array<object>

array of sessions for FRIDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

SATURDAY
array<object>

array of sessions for SATURDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

Additional properties are allowed.

tradeSessions
required
object

trade sessions, indexed by day of week

SUNDAY
array<object>

array of sessions for SUNDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

MONDAY
array<object>

array of sessions for MONDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

TUESDAY
array<object>

array of sessions for TUESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

WEDNESDAY
array<object>

array of sessions for WEDNESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

THURSDAY
array<object>

array of sessions for THURSDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

FRIDAY
array<object>

array of sessions for FRIDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

SATURDAY
array<object>

array of sessions for SATURDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

Additional properties are allowed.

tradeMode
string

order execution type. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_trade_mode

Enum: "SYMBOL_TRADE_MODE_DISABLED" "SYMBOL_TRADE_MODE_LONGONLY" "SYMBOL_TRADE_MODE_SHORTONLY" "SYMBOL_TRADE_MODE_CLOSEONLY" "SYMBOL_TRADE_MODE_FULL"
bondAccruedInterest
number

accrued interest – accumulated coupon interest, i.e. part of the coupon interest calculated in proportion to the number of days since the coupon bond issuance or the last coupon interest payment

bondFaceValue
number

face value – initial bond value set by the issuer

optionStrike
number

the strike price of an option. The price at which an option buyer can buy (in a Call option) or sell (in a Put option) the underlying asset, and the option seller is obliged to sell or buy the appropriate amount of the underlying asset.

optionPriceSensivity
number

option/warrant sensitivity shows by how many points the price of the option's underlying asset should change so that the price of the option changes by one point

liquidityRate
number

liquidity Rate is the share of the asset that can be used for the margin

initialMargin
required
number

initial margin means the amount in the margin currency required for opening a position with the volume of one lot. It is used for checking a client's assets when he or she enters the market

maintenanceMargin
required
number

the maintenance margin. If it is set, it sets the margin amount in the margin currency of the symbol, charged from one lot. It is used for checking a client's assets when his/her account state changes. If the maintenance margin is equal to 0, the initial margin is used

hedgedMargin
required
number

contract size or margin value per one lot of hedged positions (oppositely directed positions of one symbol). Two margin calculation methods are possible for hedged positions. The calculation method is defined by the broker

hedgedMarginUsesLargerLeg
boolean

calculating hedging margin using the larger leg (Buy or Sell)

priceCalculationMode
required
string

contract price calculation mode (see https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_calc_mode)

Enum: "SYMBOL_CALC_MODE_UNKNOWN" "SYMBOL_CALC_MODE_FOREX" "SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE" "SYMBOL_CALC_MODE_FUTURES" "SYMBOL_CALC_MODE_CFD" "SYMBOL_CALC_MODE_CFDINDEX" "SYMBOL_CALC_MODE_CFDLEVERAGE" "SYMBOL_CALC_MODE_EXCH_STOCKS" "SYMBOL_CALC_MODE_EXCH_FUTURES" "SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS" "SYMBOL_CALC_MODE_EXCH_BONDS" "SYMBOL_CALC_MODE_EXCH_STOCKS_MOEX" "SYMBOL_CALC_MODE_EXCH_BONDS_MOEX" "SYMBOL_CALC_MODE_SERV_COLLATERAL"
marginCurrency
required
string

margin currency

baseCurrency
required
string

base currency

profitCurrency
string

profit currency

swapMode
required
string

swap calculation model. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_swap_mode

Enum: "SYMBOL_SWAP_MODE_DISABLED" "SYMBOL_SWAP_MODE_POINTS" "SYMBOL_SWAP_MODE_CURRENCY_SYMBOL" "SYMBOL_SWAP_MODE_CURRENCY_MARGIN" "SYMBOL_SWAP_MODE_CURRENCY_DEPOSIT" "SYMBOL_SWAP_MODE_INTEREST_CURRENT" "SYMBOL_SWAP_MODE_INTEREST_OPEN" "SYMBOL_SWAP_MODE_REOPEN_CURRENT" "SYMBOL_SWAP_MODE_REOPEN_BID"
swapLong
number

long swap value

swapShort
number

short swap value

swapRollover3Days
string

day of week to charge 3 days swap rollover

Enum: "SUNDAY" "MONDAY" "TUESDAY" "WEDNESDAY" "THURDAY" "FRIDAY" "SATURDAY"
allowedExpirationModes
required
array<string>

allowed order expiration modes. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#symbol_expiration_mode

Items:

0
string
Enum: "SYMBOL_EXPIRATION_GTC" "SYMBOL_EXPIRATION_DAY" "SYMBOL_EXPIRATION_SPECIFIED" "SYMBOL_EXPIRATION_SPECIFIED_DAY"

Additional items are allowed.

allowedOrderTypes
required
array<string>

allowed order types. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#symbol_order_mode

Items:

0
string
Enum: "SYMBOL_ORDER_MARKET" "SYMBOL_ORDER_LIMIT" "SYMBOL_ORDER_STOP" "SYMBOL_ORDER_STOP_LIMIT" "SYMBOL_ORDER_SL" "SYMBOL_ORDER_TP" "SYMBOL_ORDER_CLOSEBY"

Additional items are allowed.

orderGTCMode
string

if the expirationMode property is set to SYMBOL_EXPIRATION_GTC (good till canceled), the expiration of pending orders, as well as of Stop Loss/Take Profit orders should be additionally set using this enumeration. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_order_gtc_mode

Enum: "SYMBOL_ORDERS_GTC" "SYMBOL_ORDERS_DAILY" "SYMBOL_ORDERS_DAILY_EXCLUDING_STOPS"
digits
required
number

digits after a decimal point

path
string

path in the symbol tree

description
required
string

symbol description

startTime
string
datetime

date of the symbol trade beginning (usually used for futures)

expirationTime
string
datetime

date of the symbol trade end (usually used for futures)

Additional properties are allowed.

Additional properties are NOT allowed.

18
object

Response to getSymbolPrice request

specification
object

symbol price

symbol
required
string

symbol (e.g. currency pair or an index)

bid
required
number

bid price

ask
required
number

ask price

profitTickValue
required
number

tick value for a profitable position

lossTickValue
required
number

tick value for a loosing position

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

time
required
string
datetime

quote time, in ISO format

brokerTime
required
string

quote time, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

Additional properties are allowed.

Additional properties are NOT allowed.

19
object

Response to trade request

response
required
object
numericCode
required
number

numeric result code, see https://www.mql5.com/en/docs/constants/errorswarnings/enum_trade_return_codes and https://book.mql4.com/appendix/errors. Response codes which indicate success are 0, 10008-10010, 10025. The rest codes are errors.

stringCode
required
string

string result code, see https://www.mql5.com/en/docs/constants/errorswarnings/enum_trade_return_codes and https://book.mql4.com/appendix/errors. Response codes which indicate success are ERR_NO_ERROR, TRADE_RETCODE_PLACED, TRADE_RETCODE_DONE, TRADE_RETCODE_DONE_PARTIAL, TRADE_RETCODE_NO_CHANGES. The rest codes are errors.

message
required
string

human-readable result text

orderId
string

optional, id of the order created or modified by the trade

positionId
string

optional, id of the position created or modified by the trade

Additional properties are allowed.

Additional properties are NOT allowed.

websocket metatrader account api

Examples

{
  "type": "response",
  "requestId": "string",
  "accountId": "string",
  "accountInformation": {
    "platform": "mt4",
    "broker": "string",
    "currency": "string",
    "server": "string",
    "balance": 0,
    "equity": 0,
    "margin": 0,
    "freeMargin": 0,
    "leverage": 0,
    "marginLevel": 0
  }
}
This example has been generated automatically.

Pub synchronization

This channel is designed to send terminal data whenever it changes.

Synchronization payload

The possible types of payload that can be sent in this channel are described below

Accepts the following message:

Payload
oneOf
0
object

Account info sync payload

synchronizationId
required
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "accountInformation"
accountInformation
required
object

account information

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
broker
required
string

broker name

currency
required
string

account base currency

server
required
string

broker server name

balance
required
number

account balance

equity
required
number

account liquidation value

margin
required
number

margin used

freeMargin
required
number

free margin

leverage
required
number

account leverage

marginLevel
number

margin level calculated as % of equity/margin

Additional properties are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

1
object

Deals sync payload

synchronizationId
required
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "deals"
deals
required
array<object>

array of history deals

Items:

0
object
id
required
string

history deal id (ticket)

type
required
string

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"
entryType
string

deal entry type

Enum: "DEAL_ENTRY_IN" "DEAL_ENTRY_OUT" "DEAL_ENTRY_INOUT" "DEAL_ENTRY_OUT_BY"
symbol
string

optional symbol deal relates to

magic
number
integer

optional deal magic number, identifies the EA which initiated the deal

time
required
string
datetime

time the deal was conducted at, in ISO format

brokerTime
required
string

time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

volume
number

optional deal quantity

price
number

optional, the price the deal was conducted at

commission
number

optional deal commission

swap
number

optional deal swap

profit
required
number

deal profit

positionId
string

optional id of position the deal relates to

orderId
string

optional id of order the deal relates to

comment
string

optional deal comment

originalComment
string

optional deal original comment (present if possible to restore from history)

clientId
string

optional client-assigned deal id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that deal original comment and clientId was not identified yet and will be updated in a future packet

reason
string

optional 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 USD

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

2
object

Orders sync payload

synchronizationId
required
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "orders"
orders
required
array<object>

array of pending orders

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

3
object

Orders history sync payload

synchronizationId
required
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "historyOrders"
historyOrders
required
array<object>

array of history orders

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

4
object

Positions sync payload

synchronizationId
required
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "positions"
positions
required
array<object>

array of open positions

Items:

0
object
id
required
string

position id (ticket)

type
required
string

position type

Enum: "POSITION_TYPE_BUY" "POSITION_TYPE_SELL"
symbol
required
string

position symbol

magic
required
number
integer

position magic number, identifies the EA which opened the position

time
required
string
datetime

time position was opened at, in ISO format

brokerTime
required
string

time position was opened at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

updateTime
required
string
datetime

last position modification time, in ISO format

openPrice
required
number

position open price

currentPrice
required
number

current price

currentTickValue
number

current tick value

stopLoss
number

optional position stop loss price

takeProfit
number

optional position take profit price

volume
required
number

position volume

swap
required
number

position cumulative swap

profit
required
number

position cumulative profit

comment
string

optional position comment

clientId
string

optional client-assigned position id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

commission
required
number

position commission

reason
required
string

position opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties#enum_position_reason

Enum: "POSITION_REASON_CLIENT" "POSITION_REASON_EXPERT" "POSITION_REASON_MOBILE" "POSITION_REASON_WEB" "POSITION_REASON_UNKNOWN"
unrealizedProfit
required
number

profit of the part of the position which is not yet closed, including swap

realizedProfit
required
number

profit of the already closed part, including commissions and swap

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

originalComment
string

optional position original comment (present if possible to restore from history)

updatePending
boolean

optional flag indicating that position original comment and clientId was not identified yet and will be updated in a future packet

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

5
object

Deals sync payload

synchronizationId
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "prices"
prices
required
array<object>

array of price quotes

Items:

0
object
symbol
required
string

symbol (e.g. currency pair or an index)

bid
required
number

bid price

ask
required
number

ask price

profitTickValue
required
number

tick value for a profitable position

lossTickValue
required
number

tick value for a loosing position

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

time
required
string
datetime

quote time, in ISO format

brokerTime
required
string

quote time, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

6
object

Specifications sync payload

synchronizationId
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "specifications"
specifications
required
array<object>

array of symbol specifications

Items:

0
object
symbol
required
string

symbol (e.g. currency pair or an index)

tickSize
required
number

tick size

minVolume
required
number

minimum order volume for the symbol

maxVolume
required
number

maximum order volume for the symbol

volumeStep
required
number

order volume step for the symbol

fillingModes
required
array<string>

list of allowed order filling modes

Items:

0
string
Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC"

Additional items are allowed.

executionMode
required
string

Deal execution mode

Enum: "SYMBOL_TRADE_EXECUTION_REQUEST" "SYMBOL_TRADE_EXECUTION_INSTANT" "SYMBOL_TRADE_EXECUTION_MARKET" "SYMBOL_TRADE_EXECUTION_EXCHANGE"
contractSize
required
number

trade contract size

quoteSessions
required
object

quote sessions, indexed by day of week

SUNDAY
array<object>

array of sessions for SUNDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

MONDAY
array<object>

array of sessions for MONDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

TUESDAY
array<object>

array of sessions for TUESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

WEDNESDAY
array<object>

array of sessions for WEDNESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

THURSDAY
array<object>

array of sessions for THURSDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

FRIDAY
array<object>

array of sessions for FRIDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

SATURDAY
array<object>

array of sessions for SATURDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

Additional properties are allowed.

tradeSessions
required
object

trade sessions, indexed by day of week

SUNDAY
array<object>

array of sessions for SUNDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

MONDAY
array<object>

array of sessions for MONDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

TUESDAY
array<object>

array of sessions for TUESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

WEDNESDAY
array<object>

array of sessions for WEDNESDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

THURSDAY
array<object>

array of sessions for THURSDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

FRIDAY
array<object>

array of sessions for FRIDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

SATURDAY
array<object>

array of sessions for SATURDAY

Items:

0
object
from
required
string

session start time, in hh.mm.ss.SSS format

to
required
string

session end time, in hh.mm.ss.SSS format

Additional properties are allowed.

Additional items are allowed.

Additional properties are allowed.

tradeMode
string

order execution type. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_trade_mode

Enum: "SYMBOL_TRADE_MODE_DISABLED" "SYMBOL_TRADE_MODE_LONGONLY" "SYMBOL_TRADE_MODE_SHORTONLY" "SYMBOL_TRADE_MODE_CLOSEONLY" "SYMBOL_TRADE_MODE_FULL"
bondAccruedInterest
number

accrued interest – accumulated coupon interest, i.e. part of the coupon interest calculated in proportion to the number of days since the coupon bond issuance or the last coupon interest payment

bondFaceValue
number

face value – initial bond value set by the issuer

optionStrike
number

the strike price of an option. The price at which an option buyer can buy (in a Call option) or sell (in a Put option) the underlying asset, and the option seller is obliged to sell or buy the appropriate amount of the underlying asset.

optionPriceSensivity
number

option/warrant sensitivity shows by how many points the price of the option's underlying asset should change so that the price of the option changes by one point

liquidityRate
number

liquidity Rate is the share of the asset that can be used for the margin

initialMargin
required
number

initial margin means the amount in the margin currency required for opening a position with the volume of one lot. It is used for checking a client's assets when he or she enters the market

maintenanceMargin
required
number

the maintenance margin. If it is set, it sets the margin amount in the margin currency of the symbol, charged from one lot. It is used for checking a client's assets when his/her account state changes. If the maintenance margin is equal to 0, the initial margin is used

hedgedMargin
required
number

contract size or margin value per one lot of hedged positions (oppositely directed positions of one symbol). Two margin calculation methods are possible for hedged positions. The calculation method is defined by the broker

hedgedMarginUsesLargerLeg
boolean

calculating hedging margin using the larger leg (Buy or Sell)

priceCalculationMode
required
string

contract price calculation mode (see https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_calc_mode)

Enum: "SYMBOL_CALC_MODE_UNKNOWN" "SYMBOL_CALC_MODE_FOREX" "SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE" "SYMBOL_CALC_MODE_FUTURES" "SYMBOL_CALC_MODE_CFD" "SYMBOL_CALC_MODE_CFDINDEX" "SYMBOL_CALC_MODE_CFDLEVERAGE" "SYMBOL_CALC_MODE_EXCH_STOCKS" "SYMBOL_CALC_MODE_EXCH_FUTURES" "SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS" "SYMBOL_CALC_MODE_EXCH_BONDS" "SYMBOL_CALC_MODE_EXCH_STOCKS_MOEX" "SYMBOL_CALC_MODE_EXCH_BONDS_MOEX" "SYMBOL_CALC_MODE_SERV_COLLATERAL"
marginCurrency
required
string

margin currency

baseCurrency
required
string

base currency

profitCurrency
string

profit currency

swapMode
required
string

swap calculation model. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_swap_mode

Enum: "SYMBOL_SWAP_MODE_DISABLED" "SYMBOL_SWAP_MODE_POINTS" "SYMBOL_SWAP_MODE_CURRENCY_SYMBOL" "SYMBOL_SWAP_MODE_CURRENCY_MARGIN" "SYMBOL_SWAP_MODE_CURRENCY_DEPOSIT" "SYMBOL_SWAP_MODE_INTEREST_CURRENT" "SYMBOL_SWAP_MODE_INTEREST_OPEN" "SYMBOL_SWAP_MODE_REOPEN_CURRENT" "SYMBOL_SWAP_MODE_REOPEN_BID"
swapLong
number

long swap value

swapShort
number

short swap value

swapRollover3Days
string

day of week to charge 3 days swap rollover

Enum: "SUNDAY" "MONDAY" "TUESDAY" "WEDNESDAY" "THURDAY" "FRIDAY" "SATURDAY"
allowedExpirationModes
required
array<string>

allowed order expiration modes. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#symbol_expiration_mode

Items:

0
string
Enum: "SYMBOL_EXPIRATION_GTC" "SYMBOL_EXPIRATION_DAY" "SYMBOL_EXPIRATION_SPECIFIED" "SYMBOL_EXPIRATION_SPECIFIED_DAY"

Additional items are allowed.

allowedOrderTypes
required
array<string>

allowed order types. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#symbol_order_mode

Items:

0
string
Enum: "SYMBOL_ORDER_MARKET" "SYMBOL_ORDER_LIMIT" "SYMBOL_ORDER_STOP" "SYMBOL_ORDER_STOP_LIMIT" "SYMBOL_ORDER_SL" "SYMBOL_ORDER_TP" "SYMBOL_ORDER_CLOSEBY"

Additional items are allowed.

orderGTCMode
string

if the expirationMode property is set to SYMBOL_EXPIRATION_GTC (good till canceled), the expiration of pending orders, as well as of Stop Loss/Take Profit orders should be additionally set using this enumeration. See https://www.mql5.com/en/docs/constants/environment_state/marketinfoconstants#enum_symbol_order_gtc_mode

Enum: "SYMBOL_ORDERS_GTC" "SYMBOL_ORDERS_DAILY" "SYMBOL_ORDERS_DAILY_EXCLUDING_STOPS"
digits
required
number

digits after a decimal point

path
string

path in the symbol tree

description
required
string

symbol description

startTime
string
datetime

date of the symbol trade beginning (usually used for futures)

expirationTime
string
datetime

date of the symbol trade end (usually used for futures)

Additional properties are allowed.

Additional items are allowed.

application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

7
object

Synchronization started sync payload

synchronizationId
string

synchronization request id

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "synchronizationStarted"
application
string

MetaApi application id the update is addressed to. Empty value means that update is intended to be processed by all applications

sequenceNumber
number

an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization

sequenceTimestamp
number

an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session

Additional properties are NOT allowed.

8
object

Status sync payload

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "status"
connected
required
boolean

Describes whether the terminal is connected to a broker

Additional properties are NOT allowed.

9
object

Update sync payload

type
required
string

The value of this field indicates what synchronization data was sent

Enum: "update"
updatedPositions
array<object>

Items:

0
object
id
required
string

position id (ticket)

type
required
string

position type

Enum: "POSITION_TYPE_BUY" "POSITION_TYPE_SELL"
symbol
required
string

position symbol

magic
required
number
integer

position magic number, identifies the EA which opened the position

time
required
string
datetime

time position was opened at, in ISO format

brokerTime
required
string

time position was opened at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

updateTime
required
string
datetime

last position modification time, in ISO format

openPrice
required
number

position open price

currentPrice
required
number

current price

currentTickValue
number

current tick value

stopLoss
number

optional position stop loss price

takeProfit
number

optional position take profit price

volume
required
number

position volume

swap
required
number

position cumulative swap

profit
required
number

position cumulative profit

comment
string

optional position comment

clientId
string

optional client-assigned position id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

commission
required
number

position commission

reason
required
string

position opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/positionproperties#enum_position_reason

Enum: "POSITION_REASON_CLIENT" "POSITION_REASON_EXPERT" "POSITION_REASON_MOBILE" "POSITION_REASON_WEB" "POSITION_REASON_UNKNOWN"
unrealizedProfit
required
number

profit of the part of the position which is not yet closed, including swap

realizedProfit
required
number

profit of the already closed part, including commissions and swap

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

originalComment
string

optional position original comment (present if possible to restore from history)

updatePending
boolean

optional flag indicating that position original comment and clientId was not identified yet and will be updated in a future packet

Additional properties are allowed.

Additional items are allowed.

removedPositionIds
array<number>

Items:

0
number

Position id

Additional items are allowed.

updatedOrders
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

completedOrderIds
array<number>

Items:

0
number

Order id (ticket number)

Additional items are allowed.

historyOrders
array<object>

Items:

0
object
id
required
string

order id (ticket)

type
required
string

order type

Enum: "ORDER_TYPE_SELL" "ORDER_TYPE_BUY" "ORDER_TYPE_BUY_LIMIT" "ORDER_TYPE_SELL_LIMIT" "ORDER_TYPE_BUY_STOP" "ORDER_TYPE_SELL_STOP"
state
required
string

order state

Enum: "ORDER_STATE_STARTED" "ORDER_STATE_PLACED" "ORDER_STATE_CANCELED" "ORDER_STATE_PARTIAL" "ORDER_STATE_FILLED" "ORDER_STATE_REJECTED" "ORDER_STATE_EXPIRED" "ORDER_STATE_REQUEST_ADD" "ORDER_STATE_REQUEST_MODIFY" "ORDER_STATE_REQUEST_CANCEL"
magic
required
number
integer

order magic number, identifies the EA which created the order

time
required
string
datetime

time order was created at, in ISO format

brokerTime
required
string

time order was created at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

doneTime
string
datetime

optional time order was executed or canceled at, in ISO format. Will be specified for completed orders only (ISO format)

doneBrokerTime
string

optional time order was executed or canceled at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format. Will be specified for completed orders only

symbol
required
string

order symbol

openPrice
required
number

order open price (market price for market orders, limit price for limit orders or stop price for stop orders)

currentPrice
required
number

current price

stopLoss
number

optional order stop loss price

takeProfit
number

optional order take profit price

volume
required
number

order requested quantity

currentVolume
required
number

order remaining quantity, i.e. requested quantity - filled quantity

positionId
required
string

order position id. Present only if the order has a position attached to it

comment
string

optional order comment

originalComment
string

optional order original comment (present if possible to restore from history)

clientId
string

optional client-assigned order id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that order client id and original comment was not identified yet and will be updated in a future packet

reason
required
string

order opening reason. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_reason

Enum: "ORDER_REASON_CLIENT" "ORDER_REASON_MOBILE" "ORDER_REASON_WEB" "ORDER_REASON_EXPERT" "ORDER_REASON_SL" "ORDER_REASON_TP" "ORDER_REASON_SO" "ORDER_REASON_UNKNOWN"
fillingMode
required
string

order filling mode. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_filling

Enum: "ORDER_FILLING_FOK" "ORDER_FILLING_IOC" "ORDER_FILLING_RETURN"
expirationType
required
string

order expiration type. See https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties#enum_order_type_time

Enum: "ORDER_TIME_GTC" "ORDER_TIME_DAY" "ORDER_TIME_SPECIFIED" "ORDER_TIME_SPECIFIED_DAY"
expirationTime
string
datetime

optional order expiration time

accountCurrencyExchangeRate
number

current exchange rate of account currency into USD

Additional properties are allowed.

Additional items are allowed.

deals
array<object>

Items:

0
object
id
required
string

history deal id (ticket)

type
required
string

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"
entryType
string

deal entry type

Enum: "DEAL_ENTRY_IN" "DEAL_ENTRY_OUT" "DEAL_ENTRY_INOUT" "DEAL_ENTRY_OUT_BY"
symbol
string

optional symbol deal relates to

magic
number
integer

optional deal magic number, identifies the EA which initiated the deal

time
required
string
datetime

time the deal was conducted at, in ISO format

brokerTime
required
string

time the deal was conducted at, in broker timezone, YYYY-MM-DD HH:mm:ss.SSS format

volume
number

optional deal quantity

price
number

optional, the price the deal was conducted at

commission
number

optional deal commission

swap
number

optional deal swap

profit
required
number

deal profit

positionId
string

optional id of position the deal relates to

orderId
string

optional id of order the deal relates to

comment
string

optional deal comment

originalComment
string

optional deal original comment (present if possible to restore from history)

clientId
string

optional client-assigned deal id. For more information see https://metaapi.cloud/docs/client/clientIdUsage/

platform
required
string

platform id (mt4 or mt5)

Enum: "mt4" "mt5"
updatePending
boolean

optional flag indicating that deal original comment and clientId was not identified yet and will be updated in a future packet

reason
string

optional 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"