Orders placed through the API, newest first
curl --request GET \
--url https://api.gains.trade/v1/{chain}/account/{address}/orders/history \
--header 'X-Gains-Signature: <api-key>'import requests
url = "https://api.gains.trade/v1/{chain}/account/{address}/orders/history"
headers = {"X-Gains-Signature": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Gains-Signature': '<api-key>'}};
fetch('https://api.gains.trade/v1/{chain}/account/{address}/orders/history', 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}/account/{address}/orders/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.gains.trade/v1/{chain}/account/{address}/orders/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Gains-Signature", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gains.trade/v1/{chain}/account/{address}/orders/history")
.header("X-Gains-Signature", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gains.trade/v1/{chain}/account/{address}/orders/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Gains-Signature"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"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
}
],
"nextCursor": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"details": {}
}Account
Orders placed through the API, newest first
GET
/
v1
/
{chain}
/
account
/
{address}
/
orders
/
history
Orders placed through the API, newest first
curl --request GET \
--url https://api.gains.trade/v1/{chain}/account/{address}/orders/history \
--header 'X-Gains-Signature: <api-key>'import requests
url = "https://api.gains.trade/v1/{chain}/account/{address}/orders/history"
headers = {"X-Gains-Signature": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Gains-Signature': '<api-key>'}};
fetch('https://api.gains.trade/v1/{chain}/account/{address}/orders/history', 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}/account/{address}/orders/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.gains.trade/v1/{chain}/account/{address}/orders/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Gains-Signature", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.gains.trade/v1/{chain}/account/{address}/orders/history")
.header("X-Gains-Signature", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gains.trade/v1/{chain}/account/{address}/orders/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Gains-Signature"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"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
}
],
"nextCursor": "<string>"
}{
"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
AgentSignatureApiKey
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
Available options:
arbitrum, base, polygon, megaeth, arbitrum-sepolia Example:
"arbitrum"
Example:
"0x73b3A111C5BCCf9086c97B96e0AbAad69Dc4f523"
Query Parameters
Opaque cursor from the previous page.
Required range:
1 <= x <= 500Example:
50
