Get Positions
curl --request GET \
--url https://api-options.sandbox.rails.xyz/account/positions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-options.sandbox.rails.xyz/account/positions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/positions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-options.sandbox.rails.xyz/account/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": "BTC-3JUL26-62000-C",
"side": "long",
"optionType": "C",
"qty": "2",
"value": "298.32",
"entryPrice": "120.00",
"markPrice": "149.16",
"markIV": "0.3035",
"underlyingPrice": "61650.00",
"liqPrice": "--",
"breakEvenPrice": "62120.00",
"initialMargin": "--",
"realizedPnl": "0.00",
"unrealizedPnl": "58.32"
},
{
"market": "BTC-3JUL26-60000-P",
"side": "short",
"optionType": "P",
"qty": "-3",
"value": "-36.57",
"entryPrice": "15.00",
"markPrice": "12.19",
"markIV": "0.3925",
"underlyingPrice": "61650.00",
"liqPrice": "58100.00",
"breakEvenPrice": "59985.00",
"initialMargin": "22829.07",
"realizedPnl": "0.00",
"unrealizedPnl": "8.43"
}
]
}User Account
Get Positions
Retrieve your open positions.
GET
/
account
/
positions
Get Positions
curl --request GET \
--url https://api-options.sandbox.rails.xyz/account/positions \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-options.sandbox.rails.xyz/account/positions"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/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://api-options.sandbox.rails.xyz/account/positions")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-options.sandbox.rails.xyz/account/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": "BTC-3JUL26-62000-C",
"side": "long",
"optionType": "C",
"qty": "2",
"value": "298.32",
"entryPrice": "120.00",
"markPrice": "149.16",
"markIV": "0.3035",
"underlyingPrice": "61650.00",
"liqPrice": "--",
"breakEvenPrice": "62120.00",
"initialMargin": "--",
"realizedPnl": "0.00",
"unrealizedPnl": "58.32"
},
{
"market": "BTC-3JUL26-60000-P",
"side": "short",
"optionType": "P",
"qty": "-3",
"value": "-36.57",
"entryPrice": "15.00",
"markPrice": "12.19",
"markIV": "0.3925",
"underlyingPrice": "61650.00",
"liqPrice": "58100.00",
"breakEvenPrice": "59985.00",
"initialMargin": "22829.07",
"realizedPnl": "0.00",
"unrealizedPnl": "8.43"
}
]
}⌘I