Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_opportunities(sort_by=models.PerpetualTradingSortBy.VOLUME_24H, sort_order=models.PerpetualTradingSortOrder.DESC)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.perpetualTrading.perpetualTradingOpportunities({
sortBy: "volume_24h",
sortOrder: "desc",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/perpetual_trading/opportunities \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/opportunities', 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.compasslabs.ai/v2/perpetual_trading/opportunities",
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-api-key: <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.compasslabs.ai/v2/perpetual_trading/opportunities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<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.compasslabs.ai/v2/perpetual_trading/opportunities")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/opportunities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"opportunities": [
{
"asset": "AAPL",
"asset_id": 12,
"category": "stock",
"funding_rate": "0.0000125",
"mark_price": "213.88",
"max_leverage": 5,
"open_interest": "8421530.50",
"oracle_price": "213.80",
"sz_decimals": 2,
"volume_24h": "12498230.75"
},
{
"asset": "GOLD",
"asset_id": 3,
"category": "commodity",
"funding_rate": "-0.0000040",
"mark_price": "2438.20",
"max_leverage": 10,
"open_interest": "5102330.10",
"oracle_price": "2438.05",
"sz_decimals": 3,
"volume_24h": "9874120.40"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Perpetual Trading
List perpetual trading markets
List available perpetual trading markets with key metrics.
Returns perp markets (stocks, commodities, forex) with open interest, 24h volume, funding rate, and max leverage. Supports filtering by category, minimum OI/volume, and sorting.
Only perpetual trading assets are returned — crypto perps are excluded.
GET
/
v2
/
perpetual_trading
/
opportunities
Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_opportunities(sort_by=models.PerpetualTradingSortBy.VOLUME_24H, sort_order=models.PerpetualTradingSortOrder.DESC)
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.perpetualTrading.perpetualTradingOpportunities({
sortBy: "volume_24h",
sortOrder: "desc",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/perpetual_trading/opportunities \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/opportunities', 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.compasslabs.ai/v2/perpetual_trading/opportunities",
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-api-key: <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.compasslabs.ai/v2/perpetual_trading/opportunities"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<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.compasslabs.ai/v2/perpetual_trading/opportunities")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/opportunities")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"opportunities": [
{
"asset": "AAPL",
"asset_id": 12,
"category": "stock",
"funding_rate": "0.0000125",
"mark_price": "213.88",
"max_leverage": 5,
"open_interest": "8421530.50",
"oracle_price": "213.80",
"sz_decimals": 2,
"volume_24h": "12498230.75"
},
{
"asset": "GOLD",
"asset_id": 3,
"category": "commodity",
"funding_rate": "-0.0000040",
"mark_price": "2438.20",
"max_leverage": 10,
"open_interest": "5102330.10",
"oracle_price": "2438.05",
"sz_decimals": 3,
"volume_24h": "9874120.40"
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Query Parameters
Filter by minimum open interest in USD
Filter by minimum 24h volume in USD
Filter by asset category: stock, commodity, forex
Available options:
stock, commodity, forex Sort results by this field
Available options:
open_interest, volume_24h, funding_rate Sort direction
Available options:
asc, desc Response
Successful Response
List of available perpetual trading markets.
Available perpetual trading markets
Show child attributes
Show child attributes
Was this page helpful?