Closed Trade Funding and Leverage

GET/gateway/v1/hyperliquid/trades/context

Returns immutable funding and leverage context for one closed trade identified by the composite key from `/hyperliquid/trades`. Use this for a selected trade detail instead of enriching every history row. `funding_status=complete` distinguishes a real zero from unavailable historical data; leverage fields are omitted when the completed-trade source has no value.

Query Parameters

addressstringrequired

Wallet address: a 0x EVM address or an ENS name (e.g. vitalik.eth). Solana addresses are not supported.

symbolstringrequired

Hyperliquid perpetual market id, including a builder prefix for HIP-3 markets (for example xyz:GOLD).

directionenum<string>required

Opening direction of the episode.

Available options:longshort
open_timeintegerrequired

Episode open time, Unix seconds, copied from GET /hyperliquid/trades.

close_timeintegerrequired

Episode close time, Unix seconds, copied from GET /hyperliquid/trades.

Closed Trade Funding and Leverage
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/hyperliquid/trades/context', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/DataObjectResponseHyperliquidTradeContext.json",
  "data": {
    "funding_pnl": 123,
    "funding_status": "<string>",
    "leverage": 123,
    "leverage_semantics": "<string>",
    "leverage_type": "<string>",
    "reported_leverage": 123,
    "reported_leverage_type": "<string>"
  },
  "meta": {
    "cached": true,
    "credits_used": 123,
    "empty_reason": "<string>"
  }
}