const res = await fetch('https://app.trdrs.co/api/account/exit-plans/preview', {
method: 'POST',
headers: {
'content-type': 'application/json',
Authorization: `Bearer ${process.env.TRDRS_API_KEY}`,
},
body: JSON.stringify({
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"instrument": "ESU6",
"side": "buy",
"quantity": 2,
"entryType": "limit",
"entryPrice": 6480.5
}),
})
const data = await res.json()curl -X POST 'https://app.trdrs.co/api/account/exit-plans/preview' \
-H "Authorization: Bearer $TRDRS_API_KEY" \
-H 'content-type: application/json' \
-d '{"planId":"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37","instrument":"ESU6","side":"buy","quantity":2,"entryType":"limit","entryPrice":6480.5}'import requests
url = "https://app.trdrs.co/api/account/exit-plans/preview"
payload = {
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"instrument": "ESU6",
"side": "buy",
"quantity": 2,
"entryType": "limit",
"entryPrice": 6480.5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trdrs.co/api/account/exit-plans/preview",
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([
'planId' => '0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37',
'instrument' => 'ESU6',
'side' => 'buy',
'quantity' => 2,
'entryType' => 'limit',
'entryPrice' => 6480.5
]),
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://app.trdrs.co/api/account/exit-plans/preview"
payload := strings.NewReader("{\n \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\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://app.trdrs.co/api/account/exit-plans/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trdrs.co/api/account/exit-plans/preview")
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 \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\n}"
response = http.request(request)
puts response.read_body{
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"planRevision": "q2Jm4XxT0aVnR7cLp1sZfE9d",
"legs": [
{
"seq": 1,
"quantity": 1,
"stopTicks": 12,
"stopPrice": 6477.5,
"targetTicks": 20,
"targetPrice": 6485.5,
"breakevenTriggerTicks": null,
"breakevenPlusTicks": null,
"trailSteps": []
},
{
"seq": 2,
"quantity": 1,
"stopTicks": 12,
"stopPrice": 6477.5,
"targetTicks": null,
"targetPrice": null,
"breakevenTriggerTicks": 8,
"breakevenPlusTicks": 0,
"trailSteps": [
{
"stepSeq": 1,
"triggerTicks": 16,
"trailDistanceTicks": 8,
"frequencyTicks": 2
}
]
}
],
"managedQuantity": 2,
"unmanagedQuantity": 0,
"engineManaged": true,
"token": "WyI3YTFmNGM5M2IyOGQwNWU2Il0.9Qp3Vv1sKdN0yTbXmR7cLh",
"expiresAt": 1787581980000
}{
"error": "invalid_instrument"
}{
"error": "invalid_instrument"
}{
"error": "invalid_instrument"
}Preview an exit plan
Returns what the plan would place for this account and this order: every leg priced from the account’s own instrument facts, what the ladder protects, what the order carries that it does not, and the token that binds the order. Preview before placing: the placement carries this token and no levels, so the engine and the trader are agreeing on the same order rather than on a price a client computed.
const res = await fetch('https://app.trdrs.co/api/account/exit-plans/preview', {
method: 'POST',
headers: {
'content-type': 'application/json',
Authorization: `Bearer ${process.env.TRDRS_API_KEY}`,
},
body: JSON.stringify({
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"instrument": "ESU6",
"side": "buy",
"quantity": 2,
"entryType": "limit",
"entryPrice": 6480.5
}),
})
const data = await res.json()curl -X POST 'https://app.trdrs.co/api/account/exit-plans/preview' \
-H "Authorization: Bearer $TRDRS_API_KEY" \
-H 'content-type: application/json' \
-d '{"planId":"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37","instrument":"ESU6","side":"buy","quantity":2,"entryType":"limit","entryPrice":6480.5}'import requests
url = "https://app.trdrs.co/api/account/exit-plans/preview"
payload = {
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"instrument": "ESU6",
"side": "buy",
"quantity": 2,
"entryType": "limit",
"entryPrice": 6480.5
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trdrs.co/api/account/exit-plans/preview",
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([
'planId' => '0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37',
'instrument' => 'ESU6',
'side' => 'buy',
'quantity' => 2,
'entryType' => 'limit',
'entryPrice' => 6480.5
]),
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://app.trdrs.co/api/account/exit-plans/preview"
payload := strings.NewReader("{\n \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\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://app.trdrs.co/api/account/exit-plans/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trdrs.co/api/account/exit-plans/preview")
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 \"planId\": \"0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37\",\n \"instrument\": \"ESU6\",\n \"side\": \"buy\",\n \"quantity\": 2,\n \"entryType\": \"limit\",\n \"entryPrice\": 6480.5\n}"
response = http.request(request)
puts response.read_body{
"planId": "0f6c2d18-7b4a-4a3e-9d21-8c5e4b0a9f37",
"planRevision": "q2Jm4XxT0aVnR7cLp1sZfE9d",
"legs": [
{
"seq": 1,
"quantity": 1,
"stopTicks": 12,
"stopPrice": 6477.5,
"targetTicks": 20,
"targetPrice": 6485.5,
"breakevenTriggerTicks": null,
"breakevenPlusTicks": null,
"trailSteps": []
},
{
"seq": 2,
"quantity": 1,
"stopTicks": 12,
"stopPrice": 6477.5,
"targetTicks": null,
"targetPrice": null,
"breakevenTriggerTicks": 8,
"breakevenPlusTicks": 0,
"trailSteps": [
{
"stepSeq": 1,
"triggerTicks": 16,
"trailDistanceTicks": 8,
"frequencyTicks": 2
}
]
}
],
"managedQuantity": 2,
"unmanagedQuantity": 0,
"engineManaged": true,
"token": "WyI3YTFmNGM5M2IyOGQwNWU2Il0.9Qp3Vv1sKdN0yTbXmR7cLh",
"expiresAt": 1787581980000
}{
"error": "invalid_instrument"
}{
"error": "invalid_instrument"
}{
"error": "invalid_instrument"
}Authorizations
Your firm’s API key (the API calls this the tenant key; trdrs_sk_…), server-to-server only.
Body
What the plan would place for this account and this order. The engine supplies every price; the request names the order and nothing else.
The client order id the placement will ride under. The token is bound to it, so a confirmation is spent on one submission rather than good for any order until it expires.
buy, sell market, limit, stop, stop_limit The resting entry's own price. Ignored for a market entry, whose ladder is measured from the mark at placement.
Response
The resolved plan and its token
WireExitPlanPreview (@trdrs/contracts): the resolved legs plus the token that binds them. The token is a signed binding over the order — the account, the client order id, the plan and its revision, the instrument, the side, the quantity and the entry — never over the prices: placement reloads the plan at that revision and re-resolves, so a preview proves what was agreed rather than carrying a price a client could have chosen. A market entry's levels are indicative for the same reason.
Show child attributes
Show child attributes
What the order carries that the plan does not protect.
True when the engine itself will ratchet the stop, rather than the venue holding it still.
Epoch milliseconds