Close multiple orders
curl --request POST \
--url https://magicmarkets.com/v2/orders/close_many/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"order_ids": [
5001,
5002,
5003
]
}
'import requests
url = "https://magicmarkets.com/v2/orders/close_many/"
payload = { "order_ids": [5001, 5002, 5003] }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_ids: [5001, 5002, 5003]})
};
fetch('https://magicmarkets.com/v2/orders/close_many/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://magicmarkets.com/v2/orders/close_many/"
payload := strings.NewReader("{\n \"order_ids\": [\n 5001,\n 5002,\n 5003\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "ok",
"data": {
"closed": [
[
5001,
5002
]
],
"not_found": [
[
5003
]
]
}
}{
"status": "error",
"code": "auth_error",
"data": {
"detail": "Authentication credentials were not provided."
}
}{
"status": "error",
"code": "forbidden",
"data": null
}{
"status": "error",
"code": "throttled",
"data": {
"message": "Request was throttled. Expected available in 12 seconds.",
"retry_after": 12
}
}{
"status": "error",
"code": "server_error",
"data": [
"An error has occurred, token:",
"ABC123abc456DEF789gh"
]
}Close multiple orders
Close multiple orders synchronously. Maximum 500 order IDs per request.
POST
/
v2
/
orders
/
close_many
/
Close multiple orders
curl --request POST \
--url https://magicmarkets.com/v2/orders/close_many/ \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"order_ids": [
5001,
5002,
5003
]
}
'import requests
url = "https://magicmarkets.com/v2/orders/close_many/"
payload = { "order_ids": [5001, 5002, 5003] }
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({order_ids: [5001, 5002, 5003]})
};
fetch('https://magicmarkets.com/v2/orders/close_many/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://magicmarkets.com/v2/orders/close_many/"
payload := strings.NewReader("{\n \"order_ids\": [\n 5001,\n 5002,\n 5003\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"status": "ok",
"data": {
"closed": [
[
5001,
5002
]
],
"not_found": [
[
5003
]
]
}
}{
"status": "error",
"code": "auth_error",
"data": {
"detail": "Authentication credentials were not provided."
}
}{
"status": "error",
"code": "forbidden",
"data": null
}{
"status": "error",
"code": "throttled",
"data": {
"message": "Request was throttled. Expected available in 12 seconds.",
"retry_after": 12
}
}{
"status": "error",
"code": "server_error",
"data": [
"An error has occurred, token:",
"ABC123abc456DEF789gh"
]
}Authorizations
API key created from the magic-markets website
Body
application/json
Required array length:
1 - 500 elements
