TypeScript SDK — Perpetuals Reference
Methods for perpetual-contract positions, margin, risk statistics, and funding payment history. All methods are on client.perpetuals.
See the API Specifications for full request/response schemas.
Positions & Margin
getAccountMargin
POST /v1/margin · Authenticated
Retrieve the perpetuals margin summary for a symbol — margin assets value, initial margin, available margin, and liquidation information.
Code
Note: This is a POST mutation and is not automatically retried.
Tip: All margin values are decimal strings. See Data Types.
getOpenPositions
POST /v1/positions · Authenticated
Retrieve all open perpetual-contract positions on the account. The response wraps the positions array in an openPositions field.
Code
Note: This is a POST mutation and is not automatically retried.
getRiskStats
GET /v1/riskstats/{symbol} · Public
Retrieve risk statistics for a specific perpetual symbol — mark price, index price, and open interest.
Code
Auto-retried. This is a GET endpoint — the SDK automatically retries on
429,502,503, and504.
Public endpoint. No authentication required. The
symbolpath parameter is passed as a top-level field.
Funding
listFundingPayments
POST /v1/perpetuals/fundingPayment · Authenticated
Retrieve funding payments for your perpetual positions. Supports optional since and to query parameters to filter by time range. Each payment wraps a hourlyFundingTransfer object with the transfer details.
Code
Note: This is a POST mutation and is not automatically retried.
Input pattern. This method takes an input object with
query(optional) andbodykeys, because the endpoint has both query parameters and a request body. Thesinceandtoquery parameters are int64 timestamps — the SDK accepts bothbigintandnumber.
getFundingPaymentReportFile
GET /v1/perpetuals/fundingpaymentreport/records.xlsx · Authenticated
Download a funding payment report as an Excel spreadsheet file. Returns raw bytes, not JSON.
Code
Returns a file, not JSON. The response is a
RestFileResponsewithbytes: Uint8Array,contentType?: string, andcontentDisposition?: string.
Auto-retried. This is a GET endpoint — the SDK automatically retries on transient errors.
All query parameters are optional. Omit them to get a default report.
getFundingPaymentReportJson
POST /v1/perpetuals/fundingpaymentreport/records.json · Authenticated
Retrieve funding payment report data as JSON. Same data as getFundingPaymentReportFile but in a structured JSON format.
Code
Note: This is a POST mutation and is not automatically retried.
Input pattern. This method takes
query(optional) andbodykeys.
What's next
- Margin Reference — margin account details and borrow rates (separate from perpetuals margin)
- Market Data: Networks & Derivatives — public funding-amount data
- Data Types — decimal strings and bigint handling
- Error Handling — error types and metadata