Positions
Set TP/SL at the position level for one (account, contract) pair.
Use this instead of attach-bracket whenever the bracket should cover
the entire open position (e.g., the user dragged the TP line on the
chart). For multi-fill positions this attaches one bracket per parent
entry order so the total bracket quantity equals the position quantity.
POST
/
trade
/
position
/
set-bracket
Set TP/SL at the position level for one (account, contract) pair.
curl --request POST \
--url https://api.hyperprop.com/trade/position/set-bracket \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "MNQM6",
"stop_loss": 30050,
"take_profit": 30150
}
'import requests
url = "https://api.hyperprop.com/trade/position/set-bracket"
payload = {
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "MNQM6",
"stop_loss": 30050,
"take_profit": 30150
}
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({
account_id: '550e8400-e29b-41d4-a716-446655440000',
contract: 'MNQM6',
stop_loss: 30050,
take_profit: 30150
})
};
fetch('https://api.hyperprop.com/trade/position/set-bracket', 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.hyperprop.com/trade/position/set-bracket",
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([
'account_id' => '550e8400-e29b-41d4-a716-446655440000',
'contract' => 'MNQM6',
'stop_loss' => 30050,
'take_profit' => 30150
]),
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.hyperprop.com/trade/position/set-bracket"
payload := strings.NewReader("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\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.hyperprop.com/trade/position/set-bracket")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/trade/position/set-bracket")
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 \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\n}"
response = http.request(request)
puts response.read_body{
"code": null,
"data": {
"cancelled_orders": [],
"stop_loss_orders": [
{
"bracket_type": "stop_loss",
"contract": "MNQU6",
"id": "8a4b3c2d-0e5f-4a7b-9c3d-2f6e8b0d4c71",
"order_type": "stop",
"quantity": 2,
"side": "sell",
"status": "working",
"stop_price": 29488
}
],
"take_profit_orders": [
{
"bracket_type": "take_profit",
"contract": "MNQU6",
"id": "9b5c4d3e-1f6a-4b8c-0d4e-3a7f9c1e5d82",
"limit_price": 29562.25,
"order_type": "limit",
"quantity": 2,
"side": "sell",
"status": "working"
}
]
},
"error": null,
"success": true
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "RATE_LIMITED",
"data": null,
"error": "Rate limit exceeded for order submissions. Max 10 requests per second per account. Retry after 100 ms.",
"rate_limit": {
"limit": 10,
"remaining": 0,
"reset": 1711800125,
"retry_after": 0.1
},
"success": false
}Authorizations
Body
application/json
Set TP/SL at the position level for a given (account, contract).
Covers the full open position, however many fills built it up.
take_profit: Some(price)replaces any existing TP children for this position with fresh ones atprice.take_profit: Noneclears all existing TP children for this position.- Same for
stop_loss. - Both
Noneclears all bracket children for this position.
New take-profit price for the entire position. Omit or send null
to keep the existing take-profit orders; omitting both legs clears
both. When several take-profit orders work at different prices and a
stop-loss is sent too, a price one of them already holds keeps them all.
Example:
30150
Response
Position bracket set
⌘I
Set TP/SL at the position level for one (account, contract) pair.
curl --request POST \
--url https://api.hyperprop.com/trade/position/set-bracket \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "MNQM6",
"stop_loss": 30050,
"take_profit": 30150
}
'import requests
url = "https://api.hyperprop.com/trade/position/set-bracket"
payload = {
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "MNQM6",
"stop_loss": 30050,
"take_profit": 30150
}
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({
account_id: '550e8400-e29b-41d4-a716-446655440000',
contract: 'MNQM6',
stop_loss: 30050,
take_profit: 30150
})
};
fetch('https://api.hyperprop.com/trade/position/set-bracket', 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.hyperprop.com/trade/position/set-bracket",
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([
'account_id' => '550e8400-e29b-41d4-a716-446655440000',
'contract' => 'MNQM6',
'stop_loss' => 30050,
'take_profit' => 30150
]),
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.hyperprop.com/trade/position/set-bracket"
payload := strings.NewReader("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\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.hyperprop.com/trade/position/set-bracket")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/trade/position/set-bracket")
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 \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"MNQM6\",\n \"stop_loss\": 30050,\n \"take_profit\": 30150\n}"
response = http.request(request)
puts response.read_body{
"code": null,
"data": {
"cancelled_orders": [],
"stop_loss_orders": [
{
"bracket_type": "stop_loss",
"contract": "MNQU6",
"id": "8a4b3c2d-0e5f-4a7b-9c3d-2f6e8b0d4c71",
"order_type": "stop",
"quantity": 2,
"side": "sell",
"status": "working",
"stop_price": 29488
}
],
"take_profit_orders": [
{
"bracket_type": "take_profit",
"contract": "MNQU6",
"id": "9b5c4d3e-1f6a-4b8c-0d4e-3a7f9c1e5d82",
"limit_price": 29562.25,
"order_type": "limit",
"quantity": 2,
"side": "sell",
"status": "working"
}
]
},
"error": null,
"success": true
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "RATE_LIMITED",
"data": null,
"error": "Rate limit exceeded for order submissions. Max 10 requests per second per account. Retry after 100 ms.",
"rate_limit": {
"limit": 10,
"remaining": 0,
"reset": 1711800125,
"retry_after": 0.1
},
"success": false
}