curl --request DELETE \
--url https://{host}/v1/orders/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/orders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v1/orders/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{host}/v1/orders/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "order",
"id": "<string>",
"state": "sending",
"account": "<string>",
"symbol": "<string>",
"side": "buy",
"quantity": 123,
"type": "limit",
"time_in_force": "day",
"price_kobo": 123,
"filled_quantity": 123,
"exchange_order_id": "<string>",
"reason": "<string>",
"reject_reason": "insufficient_funds",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}Cancel an order
Asks the exchange to cancel a pending or partially_filled limit order. The order then moves to cancelled, or to filled if it fills before the cancel takes effect.
curl --request DELETE \
--url https://{host}/v1/orders/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{host}/v1/orders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v1/orders/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{host}/v1/orders/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "order",
"id": "<string>",
"state": "sending",
"account": "<string>",
"symbol": "<string>",
"side": "buy",
"quantity": 123,
"type": "limit",
"time_in_force": "day",
"price_kobo": 123,
"filled_quantity": 123,
"exchange_order_id": "<string>",
"reason": "<string>",
"reject_reason": "insufficient_funds",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"reject_reason": "<string>"
}
}Authorizations
Authorization: Bearer <key>. Sandbox keys start with mgw_test_ and live keys start with mgw_live_. Each key works only in its own environment, and a live key works only from the IP addresses or ranges registered for it.
Path Parameters
The order's id.
Response
The exchange accepted the cancel request. The body is the order as it was before the cancel.
"order"Unique identifier for the order. Starts with ord_.
sending: stored, and the send is in progress. pending: the exchange has the order. partially_filled, filled: some or all of the order has traded. uncertain: we don't know whether the exchange received it. We don't send it again; we reconcile it against the exchange's record. rejected: the exchange rejected it; see reject_reason. refused: we refused it, and it never reached the exchange. cancelled: the exchange confirmed the cancel. expired: its time in force ran out.
sending, pending, partially_filled, filled, uncertain, rejected, refused, cancelled, expired The account code, in uppercase.
The account code, in uppercase.
buy, sell limit, market day, gtc, ioc, fok The limit price in kobo. Null for a market order.
The total number of shares traded so far.
The exchange's identifier for the order, once it has one.
A sentence explaining the order's current state. It's for people to read, so don't use it in your logic.
Why the exchange rejected the order. Set only when state is rejected.
insufficient_funds, market_closed, settlement_lockout, limit_orders_etf_only, unknown_symbol, symbol_not_tradable, account_not_at_broker, rejected_by_exchange, null In UTC, to the second.
In UTC, to the second.