Trading
Connection handling
Send market or pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Symbol
"EURUSD"Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop
"Buy""Buy" | "Sell" | "BuyLimit" | "SellLimit" | "BuyStop" | "SellStop" | "Balance" | "Credit"Lots
0.1doublePrice. Optional, but required in case of Instant Execution.
0doubleSlippage. Optional.
0int32StopLoss. Optional.
0doubleTakeProfit. Optional.
0doubleComment. Optional.
Magic. Optional.
0int32Expiartion in format: yyyy-MM-ddTHH:mm:ss. Optional.
date-timePlaced type
"Client""Client" | "Expert" | "Dealer" | "Signal" | "Gateway" | "Mobile" | "Web" | "Api" | "Default"Response Body
curl -X GET "https://api.metatraderapi.dev/OrderSend?id=%7B%7Bid%7D%7D&symbol=EURUSD&operation=Buy&volume=0.1&price=0&slippage=0&stoploss=0&takeprofit=0&comment=string&magic=0&expiration=2019-08-24T14%3A15%3A22Z&placedType=Client"{
"ticket": 0,
"openTime": "2019-08-24T14:15:22Z",
"closeTime": "2019-08-24T14:15:22Z",
"expiration": "2019-08-24T14:15:22Z",
"type": "Buy",
"lots": 0.1,
"symbol": "string",
"openPrice": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"closePrice": 0.1,
"magicNumber": 0,
"swap": 0.1,
"commission": 0.1,
"comment": "string",
"profit": 0.1,
"rateOpen": 0.1,
"rateClose": 0.1,
"rateMargin": 0.1,
"ex": {
"order": 0,
"login": 0,
"symbol": "string",
"digits": 0,
"cmd": 0,
"volume": 0,
"open_time": 0,
"state": 0,
"open_price": 0.1,
"sl": 0.1,
"tp": 0.1,
"close_time": 0,
"value_date": 0,
"expiration": 0,
"place_type": 0,
"conv_rates": [
0.1
],
"commission": 0.1,
"commission_agent": 0.1,
"storage": 0.1,
"close_price": 0.1,
"profit": 0.1,
"taxes": 0.1,
"magic": 0,
"comment": "string",
"internal_id": 0,
"activation": 0,
"spread": 0,
"margin_rate": 0.1,
"timestamp": 0,
"reserved": [
0
],
"next": 0
},
"placedType": "Client",
"state": "OPEN_NORMAL",
"digits": 0
}{
"message": "string",
"code": "INTERNAL_ERROR",
"stackTrace": "string"
}Modify market or pending order
Returns an Order object
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int32StopLoss.
0doubleTakeProfit
0doublePrice
0doubleExpiartion in format: yyyy-MM-ddTHH:mm:ss
date-timeResponse Body
curl -X GET "https://api.metatraderapi.dev/OrderModify?id=%7B%7Bid%7D%7D&ticket=0&stoploss=0&takeprofit=0&price=0&expiration=2019-08-24T14%3A15%3A22Z"{
"ticket": 0,
"openTime": "2019-08-24T14:15:22Z",
"closeTime": "2019-08-24T14:15:22Z",
"expiration": "2019-08-24T14:15:22Z",
"type": "Buy",
"lots": 0.1,
"symbol": "string",
"openPrice": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"closePrice": 0.1,
"magicNumber": 0,
"swap": 0.1,
"commission": 0.1,
"comment": "string",
"profit": 0.1,
"rateOpen": 0.1,
"rateClose": 0.1,
"rateMargin": 0.1,
"ex": {
"order": 0,
"login": 0,
"symbol": "string",
"digits": 0,
"cmd": 0,
"volume": 0,
"open_time": 0,
"state": 0,
"open_price": 0.1,
"sl": 0.1,
"tp": 0.1,
"close_time": 0,
"value_date": 0,
"expiration": 0,
"place_type": 0,
"conv_rates": [
0.1
],
"commission": 0.1,
"commission_agent": 0.1,
"storage": 0.1,
"close_price": 0.1,
"profit": 0.1,
"taxes": 0.1,
"magic": 0,
"comment": "string",
"internal_id": 0,
"activation": 0,
"spread": 0,
"margin_rate": 0.1,
"timestamp": 0,
"reserved": [
0
],
"next": 0
},
"placedType": "Client",
"state": "OPEN_NORMAL",
"digits": 0
}{
"message": "string",
"code": "INTERNAL_ERROR",
"stackTrace": "string"
}Close market order with opposite market order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int32Order ticket
0int32Response Body
curl -X GET "https://api.metatraderapi.dev/OrderCloseBy?id=%7B%7Bid%7D%7D&ticket1=0&ticket2=0""string"{
"message": "string",
"code": "INTERNAL_ERROR",
"stackTrace": "string"
}Delete pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int32Response Body
curl -X GET "https://api.metatraderapi.dev/OrderDelete?id=%7B%7Bid%7D%7D&ticket=0""string"{
"message": "string",
"code": "INTERNAL_ERROR",
"stackTrace": "string"
}Close market or pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int32Lots
0doublePrice. Optional, but required in case of Instant Execution.
0doubleSlippage. Optional.
0int32Response Body
curl -X GET "https://api.metatraderapi.dev/OrderClose?id=%7B%7Bid%7D%7D&ticket=0&lots=0&price=0&slippage=0"{
"ticket": 0,
"openTime": "2019-08-24T14:15:22Z",
"closeTime": "2019-08-24T14:15:22Z",
"expiration": "2019-08-24T14:15:22Z",
"type": "Buy",
"lots": 0.1,
"symbol": "string",
"openPrice": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"closePrice": 0.1,
"magicNumber": 0,
"swap": 0.1,
"commission": 0.1,
"comment": "string",
"profit": 0.1,
"rateOpen": 0.1,
"rateClose": 0.1,
"rateMargin": 0.1,
"ex": {
"order": 0,
"login": 0,
"symbol": "string",
"digits": 0,
"cmd": 0,
"volume": 0,
"open_time": 0,
"state": 0,
"open_price": 0.1,
"sl": 0.1,
"tp": 0.1,
"close_time": 0,
"value_date": 0,
"expiration": 0,
"place_type": 0,
"conv_rates": [
0.1
],
"commission": 0.1,
"commission_agent": 0.1,
"storage": 0.1,
"close_price": 0.1,
"profit": 0.1,
"taxes": 0.1,
"magic": 0,
"comment": "string",
"internal_id": 0,
"activation": 0,
"spread": 0,
"margin_rate": 0.1,
"timestamp": 0,
"reserved": [
0
],
"next": 0
},
"placedType": "Client",
"state": "OPEN_NORMAL",
"digits": 0
}{
"message": "string",
"code": "INTERNAL_ERROR",
"stackTrace": "string"
}