from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_activity(owner="0x06A9aF046187895AcFc7258450B15397CAc67400")
# 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.perpetualTradingActivity({
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/perpetual_trading/activity \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/activity', 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/activity",
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/activity"
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/activity")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/activity")
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{
"account_value": "1058.32",
"builder_approval": {
"approved": true,
"builder": "0x42e1A5b3F1a17d9B2bC0c5d3f3aFf0d27e1c3Fa0",
"max_fee_tenth_bps": 50
},
"fills": [
{
"asset": "AAPL",
"builder_fee": "0.1062",
"closed_pnl": "0",
"fee": "0.5310",
"order_id": 9182734102,
"price": "212.40",
"side": "buy",
"size": "5.00",
"time_ms": 1747010983250
}
],
"open_orders": [
{
"asset": "GOLD",
"limit_price": "2450.00",
"order_id": 9182734201,
"reduce_only": false,
"side": "sell",
"size": "0.500",
"time_ms": 1747011100000
}
],
"owner": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"partial_errors": [],
"positions": [
{
"asset": "AAPL",
"asset_id": 12,
"entry_price": "212.40",
"funding_accrued": "-0.12",
"leverage": "3",
"liquidation_price": "180.12",
"margin_used": "354.00",
"mark_price": "213.88",
"side": "long",
"size": "5.00",
"unrealized_pnl": "7.40"
}
],
"withdrawable": "704.32"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Aggregated Hyperliquid activity for a user
Return positions, fills, open orders, and (optionally) builder approval state for an end-user in one normalized payload.
Each section is fetched in parallel from the Hyperliquid info API.
If a single upstream call fails the corresponding section returns null
and an entry is added to partial_errors; if every section fails the
endpoint responds with 502.
Pass builder to additionally include the user’s current approved max
fee rate for that builder (used by dashboards to decide whether to prompt
the user to sign an approveBuilderFee action).
from compass_api_sdk import CompassAPI
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.perpetual_trading.perpetual_trading_activity(owner="0x06A9aF046187895AcFc7258450B15397CAc67400")
# 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.perpetualTradingActivity({
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/perpetual_trading/activity \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/perpetual_trading/activity', 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/activity",
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/activity"
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/activity")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/perpetual_trading/activity")
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{
"account_value": "1058.32",
"builder_approval": {
"approved": true,
"builder": "0x42e1A5b3F1a17d9B2bC0c5d3f3aFf0d27e1c3Fa0",
"max_fee_tenth_bps": 50
},
"fills": [
{
"asset": "AAPL",
"builder_fee": "0.1062",
"closed_pnl": "0",
"fee": "0.5310",
"order_id": 9182734102,
"price": "212.40",
"side": "buy",
"size": "5.00",
"time_ms": 1747010983250
}
],
"open_orders": [
{
"asset": "GOLD",
"limit_price": "2450.00",
"order_id": 9182734201,
"reduce_only": false,
"side": "sell",
"size": "0.500",
"time_ms": 1747011100000
}
],
"owner": "0x1F31bAad9e2adC1Dc8B0FF8B0c2cF7D0e7d1A8c9",
"partial_errors": [],
"positions": [
{
"asset": "AAPL",
"asset_id": 12,
"entry_price": "212.40",
"funding_accrued": "-0.12",
"leverage": "3",
"liquidation_price": "180.12",
"margin_used": "354.00",
"mark_price": "213.88",
"side": "long",
"size": "5.00",
"unrealized_pnl": "7.40"
}
],
"withdrawable": "704.32"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Query Parameters
End-user EOA whose activity should be fetched.
Optional builder address. When provided, the response includes the current builder-fee approval state for this (owner, builder) pair.
Response
Successful Response
Aggregated HL activity for a single end-user.
Any section may be null if its upstream HL call failed — see
partial_errors for details. positions/fills/open_orders
are always either a populated list or null; an empty list means the
user has no activity of that type, not a failure.
Owner address that was queried (checksummed)
Open positions (null if the upstream call failed)
Show child attributes
Show child attributes
Total account value in USDC (null if positions failed)
Withdrawable USDC balance (null if positions failed)
Recent fills (null if the upstream call failed)
Show child attributes
Show child attributes
Resting orders (null if the upstream call failed)
Show child attributes
Show child attributes
Builder approval state — only present when the builder query parameter was supplied (null on upstream failure).
Show child attributes
Show child attributes
One entry per section that failed to load.
Show child attributes
Show child attributes
Was this page helpful?