Get Account Positions
curl --request GET \
--url https://user-account.sandbox.rails.xyz/api/v1/positions \
--header 'Authorization: Bearer <token>'import requests
url = "https://user-account.sandbox.rails.xyz/api/v1/positions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://user-account.sandbox.rails.xyz/api/v1/positions', 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://user-account.sandbox.rails.xyz/api/v1/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://user-account.sandbox.rails.xyz/api/v1/positions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://user-account.sandbox.rails.xyz/api/v1/positions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://user-account.sandbox.rails.xyz/api/v1/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"positions": [
{
"market": "ETH-USDT",
"value": "3772.272138",
"quantity": "1.0",
"funding": "92.49110924999998",
"realizedPnl": "0.1",
"unrealizedPnl": "-33.25166999999965",
"liquidationPrice": "3500.652918",
"type": "LONG",
"notionalValue": "3739.020468",
"marginMode": "C"
},
{
"market": "BTC-USDT",
"value": "-65000.272138",
"quantity": "-1.0",
"funding": "920.49110924999998",
"realizedPnl": "1.5",
"unrealizedPnl": "400.25166999999965",
"liquidationPrice": "61033.135417",
"type": "SHORT",
"notionalValue": "-65400.523808",
"marginMode": "I"
}
]
}{
"message": "Unauthorized"
}User Account
Get Account Positions
This endpoint retrieves the account positions by market.
GET
/
api
/
v1
/
positions
Get Account Positions
curl --request GET \
--url https://user-account.sandbox.rails.xyz/api/v1/positions \
--header 'Authorization: Bearer <token>'import requests
url = "https://user-account.sandbox.rails.xyz/api/v1/positions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://user-account.sandbox.rails.xyz/api/v1/positions', 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://user-account.sandbox.rails.xyz/api/v1/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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://user-account.sandbox.rails.xyz/api/v1/positions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://user-account.sandbox.rails.xyz/api/v1/positions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://user-account.sandbox.rails.xyz/api/v1/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"positions": [
{
"market": "ETH-USDT",
"value": "3772.272138",
"quantity": "1.0",
"funding": "92.49110924999998",
"realizedPnl": "0.1",
"unrealizedPnl": "-33.25166999999965",
"liquidationPrice": "3500.652918",
"type": "LONG",
"notionalValue": "3739.020468",
"marginMode": "C"
},
{
"market": "BTC-USDT",
"value": "-65000.272138",
"quantity": "-1.0",
"funding": "920.49110924999998",
"realizedPnl": "1.5",
"unrealizedPnl": "400.25166999999965",
"liquidationPrice": "61033.135417",
"type": "SHORT",
"notionalValue": "-65400.523808",
"marginMode": "I"
}
]
}{
"message": "Unauthorized"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Market name. Example value: ETH-USDT. To get all supported markets, call /api/v1/markets endpoint. Omit this parameter to get results across all markets.
Response
List of positions for the account.
Show child attributes
Show child attributes
⌘I