Cancel prediction order
curl --request POST \
--url https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "ACCOUNT-0001"
}
'import requests
url = "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel"
payload = { "accountId": "ACCOUNT-0001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'ACCOUNT-0001'})
};
fetch('https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'ACCOUNT-0001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel"
payload := strings.NewReader("{\n \"accountId\": \"ACCOUNT-0001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"ACCOUNT-0001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"ACCOUNT-0001\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"accountId": "ACCOUNT-0001",
"avgPx": "0",
"createdAt": "2023-11-07T05:31:56Z",
"cumQty": "0",
"leavesQty": "10",
"orderId": "0b9f3c2e-5d6a-4f1b-8e7c-9a0d1e2f3a4b",
"orderType": "limit",
"outcome": "YES",
"quantity": "10",
"side": "buy",
"state": "pending_new",
"symbol": "HORC_1126_Republican",
"timeInForce": "day",
"updatedAt": "2023-11-07T05:31:56Z",
"workingQuantity": "10",
"certainty": "certain",
"certaintyReason": "<string>",
"clOrdId": "<string>",
"clientOrderRef": "7d1c8e0a-4b8f-4e3a-9f43-2a6b1d0c9e11",
"closedAt": "2023-11-07T05:31:56Z",
"expireTime": "2023-11-07T05:31:56Z",
"firstAckAt": "2023-11-07T05:31:56Z",
"pendingAction": "none",
"price": "0.54",
"rejectReason": "<string>",
"rejectText": "<string>",
"sentAt": "2023-11-07T05:31:56Z",
"stopPx": "0.50",
"venueOrderId": "<string>",
"version": 123,
"workingOrderType": "<string>",
"workingPrice": "0.54",
"placedBy": "<string>"
}
}
Orders
Cancel Prediction Order
Cancels one working prediction-market order in full and returns as soon as the cancel is on its way to the venue.
Use Case: Withdraw a resting YES or NO order before it fills.
POST
/
v1
/
predictions
/
orders
/
{orderId}
/
cancel
Cancel prediction order
curl --request POST \
--url https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"accountId": "ACCOUNT-0001"
}
'import requests
url = "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel"
payload = { "accountId": "ACCOUNT-0001" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({accountId: 'ACCOUNT-0001'})
};
fetch('https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'accountId' => 'ACCOUNT-0001'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel"
payload := strings.NewReader("{\n \"accountId\": \"ACCOUNT-0001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.post("https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"accountId\": \"ACCOUNT-0001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tradearies.dev/v1/predictions/orders/{orderId}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"accountId\": \"ACCOUNT-0001\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"accountId": "ACCOUNT-0001",
"avgPx": "0",
"createdAt": "2023-11-07T05:31:56Z",
"cumQty": "0",
"leavesQty": "10",
"orderId": "0b9f3c2e-5d6a-4f1b-8e7c-9a0d1e2f3a4b",
"orderType": "limit",
"outcome": "YES",
"quantity": "10",
"side": "buy",
"state": "pending_new",
"symbol": "HORC_1126_Republican",
"timeInForce": "day",
"updatedAt": "2023-11-07T05:31:56Z",
"workingQuantity": "10",
"certainty": "certain",
"certaintyReason": "<string>",
"clOrdId": "<string>",
"clientOrderRef": "7d1c8e0a-4b8f-4e3a-9f43-2a6b1d0c9e11",
"closedAt": "2023-11-07T05:31:56Z",
"expireTime": "2023-11-07T05:31:56Z",
"firstAckAt": "2023-11-07T05:31:56Z",
"pendingAction": "none",
"price": "0.54",
"rejectReason": "<string>",
"rejectText": "<string>",
"sentAt": "2023-11-07T05:31:56Z",
"stopPx": "0.50",
"venueOrderId": "<string>",
"version": 123,
"workingOrderType": "<string>",
"workingPrice": "0.54",
"placedBy": "<string>"
}
}
This endpoint is in closed beta. It is available only to accounts enrolled in the beta, and only on staging (
https://api.tradearies.dev). Request and response shapes may change before general availability.Overview
A cancel is asynchronous. The endpoint returns202 Accepted with the order and its cancel outstanding (pendingAction is cancel). The venue’s answer arrives afterwards:
- If the venue cancels the order, its
statebecomescanceled. - If the venue refuses, for example because the order filled first, the order is unchanged and still working, and the reason is on the order.
quantity.
Request
{
"accountId": "ACCOUNT-0001"
}
accountId must be the account the order is on. Any user acting on the account can cancel its orders, and you are recorded as the user who asked.
Example
curl -X POST "https://api.tradearies.dev/v1/predictions/orders/0192f3a4-5b6c-7d8e-9f01-23456789abcd/cancel" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"accountId":"ACCOUNT-0001"}'
Errors
| Status | code | Meaning |
|---|---|---|
400 | INVALID_ORDER | accountId is missing. |
400 | EMPTY_BODY, INVALID_JSON, UNKNOWN_FIELD | Missing body, malformed JSON, or a field the endpoint does not accept. |
401 | — | Missing or invalid credentials. |
404 | ORDER_NOT_FOUND | No such order on accountId. |
409 | ORDER_NOT_ACTIONABLE | The order is already closed, its state is unknown, or an earlier amend or cancel is still awaiting the venue. |
429 | ORDER_ENTRY_AT_CAPACITY | Order entry is at capacity. Nothing was sent; retry shortly. |
503 | ORDER_ENTRY_UNAVAILABLE | Order entry is not accepting requests. Nothing was sent. |
504 | REQUEST_OUTCOME_UNKNOWN | The cancel may have reached the venue. Check the order before sending it again. |
Authorizations
OAuth2 Bearer token: obtain an access token from the token endpoint and send it in the Authorization header.
Path Parameters
orderId returned by Place Prediction Order or List Prediction Orders.
Body
application/json
Unknown fields are rejected with 400.
The account the order is on. Requests act on the account; you are recorded as who asked.
Example:
"ACCOUNT-0001"
Response
Cancel sent. The venue has not answered yet.
Standard success envelope used by all success responses. data is endpoint-specific.
Was this page helpful?