curl --request POST \
--url https://api.gains.trade/v1/{chain}/orders/{id}/submit \
--header 'Content-Type: application/json' \
--header 'X-Gains-Signature: <api-key>' \
--data '
{
"txHash": "0xabc123"
}
'import requests
url = "https://api.gains.trade/v1/{chain}/orders/{id}/submit"
payload = { "txHash": "0xabc123" }
headers = {
"X-Gains-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Gains-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({txHash: '0xabc123'})
};
fetch('https://api.gains.trade/v1/{chain}/orders/{id}/submit', 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.gains.trade/v1/{chain}/orders/{id}/submit",
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([
'txHash' => '0xabc123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Gains-Signature: <api-key>"
],
]);
$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.gains.trade/v1/{chain}/orders/{id}/submit"
payload := strings.NewReader("{\n \"txHash\": \"0xabc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Gains-Signature", "<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))
}HttpResponse<String> response = Unirest.post("https://api.gains.trade/v1/{chain}/orders/{id}/submit")
.header("X-Gains-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"0xabc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gains.trade/v1/{chain}/orders/{id}/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Gains-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txHash\": \"0xabc123\"\n}"
response = http.request(request)
puts response.read_body{
"id": "5316911983139663",
"trader": "0x73b3A111C5BCCf9086c97B96e0AbAad69Dc4f523",
"market": "BTC/USD",
"side": "long",
"type": "market",
"size": "0.5",
"price": "0.5",
"leverage": "0.5",
"collateral": "<string>",
"sl": "0.5",
"tp": "0.5",
"reduceOnly": true,
"slippage": "0.5",
"clientId": "<string>",
"status": "prepared",
"txHash": "0xabc123",
"expiresAt": 123,
"fill": {
"price": "0.5",
"size": "0.5",
"collateral": "0.5",
"feeCollateral": "0.5",
"txHash": "0xabc123",
"timestamp": 123,
"positionId": "5316911983139663"
},
"reason": "NONE",
"createdAt": 123,
"updatedAt": 123
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}Report the broadcast transaction of a prepared order
Records the transaction hash the agent broadcast for a prepared order. When the receipt is already available the order moves to pending or open (and is re-keyed if the Diamond assigned another index); otherwise it stays prepared with the hash until the chain watcher sees it.
curl --request POST \
--url https://api.gains.trade/v1/{chain}/orders/{id}/submit \
--header 'Content-Type: application/json' \
--header 'X-Gains-Signature: <api-key>' \
--data '
{
"txHash": "0xabc123"
}
'import requests
url = "https://api.gains.trade/v1/{chain}/orders/{id}/submit"
payload = { "txHash": "0xabc123" }
headers = {
"X-Gains-Signature": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Gains-Signature': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({txHash: '0xabc123'})
};
fetch('https://api.gains.trade/v1/{chain}/orders/{id}/submit', 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.gains.trade/v1/{chain}/orders/{id}/submit",
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([
'txHash' => '0xabc123'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Gains-Signature: <api-key>"
],
]);
$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.gains.trade/v1/{chain}/orders/{id}/submit"
payload := strings.NewReader("{\n \"txHash\": \"0xabc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Gains-Signature", "<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))
}HttpResponse<String> response = Unirest.post("https://api.gains.trade/v1/{chain}/orders/{id}/submit")
.header("X-Gains-Signature", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"0xabc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gains.trade/v1/{chain}/orders/{id}/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Gains-Signature"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"txHash\": \"0xabc123\"\n}"
response = http.request(request)
puts response.read_body{
"id": "5316911983139663",
"trader": "0x73b3A111C5BCCf9086c97B96e0AbAad69Dc4f523",
"market": "BTC/USD",
"side": "long",
"type": "market",
"size": "0.5",
"price": "0.5",
"leverage": "0.5",
"collateral": "<string>",
"sl": "0.5",
"tp": "0.5",
"reduceOnly": true,
"slippage": "0.5",
"clientId": "<string>",
"status": "prepared",
"txHash": "0xabc123",
"expiresAt": 123,
"fill": {
"price": "0.5",
"size": "0.5",
"collateral": "0.5",
"feeCollateral": "0.5",
"txHash": "0xabc123",
"timestamp": 123,
"positionId": "5316911983139663"
},
"reason": "NONE",
"createdAt": 123,
"updatedAt": 123
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}Authorizations
EIP-712 signature by an authorised agent over {method, path, body, timestamp, nonce}, sent with X-Gains-Agent, X-Gains-Timestamp and X-Gains-Nonce.
Path Parameters
arbitrum, base, polygon, megaeth, arbitrum-sepolia "arbitrum"
"5316911983139663"
Body
The transaction hash
Hash of the broadcast prepared transaction.
^0x[0-9a-fA-F]*$"0xabc123"
Response
The order after the submission
Order id. A decimal string that fits in a 53-bit integer.
^[1-9]\d{0,15}$"5316911983139663"
^0x[0-9a-fA-F]{40}$"0x73b3A111C5BCCf9086c97B96e0AbAad69Dc4f523"
Gains market symbol, <base>/<quote>.
^[A-Z0-9.]{1,15}\/[A-Z0-9]{1,10}$"BTC/USD"
long, short market, limit, stop Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
Decimal number encoded as a string to preserve precision.
^-?(?:0|[1-9]\d*)(?:\.\d+)?$"0.5"
prepared, pending, open, filled, rejected, timed_out, canceled, expired ^0x[0-9a-fA-F]*$"0xabc123"
For prepared orders, when the prepared transaction stops being valid.
Show child attributes
Show child attributes
NONE, PAUSED, MARKET_CLOSED, SLIPPAGE, TP_REACHED, SL_REACHED, EXPOSURE_LIMITS, PRICE_IMPACT, MAX_LEVERAGE, NO_TRADE, WRONG_TRADE, NOT_HIT, LIQ_REACHED, OTHER, null 