Reverse a position (close + open opposite side)
Closes the current position and opens a new position in the opposite direction with the same quantity.
Executed as two steps: (1) close the existing position, (2) open a new market order on the other side.
Protective brackets: pass take_profit_ticks / stop_loss_ticks (optional) to re-arm TP/SL on the NEW position. The engine computes the prices from the open leg’s actual fill price, same as the order ticket’s tick offsets — the reversed position is protected from the moment it opens. Omitting them opens the reversed position without brackets.
If closing the position causes the profit target to be met (account goes flat and target reached), the open leg is skipped and the account is marked as passed.
Returns a command acceptance. Requires x-idempotency-key header.
curl --request POST \
--url https://api.hyperprop.com/trade/position/reverse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "ESH6"
}
'import requests
url = "https://api.hyperprop.com/trade/position/reverse"
payload = {
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "ESH6"
}
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: 'ESH6'})
};
fetch('https://api.hyperprop.com/trade/position/reverse', 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/reverse",
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' => 'ESH6'
]),
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/reverse"
payload := strings.NewReader("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"ESH6\"\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/reverse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"ESH6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/trade/position/reverse")
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\": \"ESH6\"\n}"
response = http.request(request)
puts response.read_body{
"code": null,
"data": {
"accepted": true,
"command_id": "0d9f3c1e-7c2a-4b53-9d21-8f6a2e4b7c90",
"command_type": "ReversePosition",
"status": "queued"
},
"error": null,
"success": true
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "LOCKOUT_ACTIVE",
"data": null,
"error": "Account is locked out until 2026-03-12T16:00:00Z (mode: timed, 45 minutes remaining)",
"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
Close position request
How much to close, in the same units as order quantities. Omit to close the whole position. A partial close keeps the rest of the position and its TP/SL, which shrink to the size still open; it never opens a position in the other direction. Must be at least 1 and no more than the open quantity.
x >= 01
curl --request POST \
--url https://api.hyperprop.com/trade/position/reverse \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "ESH6"
}
'import requests
url = "https://api.hyperprop.com/trade/position/reverse"
payload = {
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"contract": "ESH6"
}
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: 'ESH6'})
};
fetch('https://api.hyperprop.com/trade/position/reverse', 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/reverse",
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' => 'ESH6'
]),
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/reverse"
payload := strings.NewReader("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"ESH6\"\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/reverse")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"contract\": \"ESH6\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hyperprop.com/trade/position/reverse")
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\": \"ESH6\"\n}"
response = http.request(request)
puts response.read_body{
"code": null,
"data": {
"accepted": true,
"command_id": "0d9f3c1e-7c2a-4b53-9d21-8f6a2e4b7c90",
"command_type": "ReversePosition",
"status": "queued"
},
"error": null,
"success": true
}{
"code": "ERROR_CODE",
"data": null,
"error": "Error message describing what went wrong",
"success": false
}{
"code": "LOCKOUT_ACTIVE",
"data": null,
"error": "Account is locked out until 2026-03-12T16:00:00Z (mode: timed, 45 minutes remaining)",
"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
}