Market Data

Perps offers the same websocket feed that for real time market data, order and fill updates as the spot exchange. The channel names are the same, except with "Spot" replaced by "Perps" (e.g. topOfBooksSpot -> topOfBooksPerps).

Spot WebSocket API

Unauthenticated channels

Mark Prices

Channel for mark prices per-market. Doesn’t require authentication.

// Request
// Subscribe to mark price updates.
{
	"op": "subscribe",
  "channel": "markPricesPerps",
	"markets": ["BTC-USD.P"]
}

// Response
// First will be confirmation about operation success/failure.
{
  "channel": "markPricesPerps",
  "type":"subscribed",
  "data": ...
}

{
  "type": "update",
  "channel":"markPricesPerps",
  "data": [{
		"market": "BTC-USD.P",
		"markPrice": "27005.54", // Mark price determined from oracle
	}]
}

Funding Rates

Channel for funding rate updates per-market. Doesn’t require authentication.

// Request
// Subscribe to funding rate updates.
{
	"op": "subscribe",
  "channel": "fundingRatesPerps",
	"markets": "BTC-USD.P"
}

// Response
// First will be confirmation about operation success/failure.
{
  "channel": "fundingRatesPerps",
  "type":"subscribed",
  "data": ...
}

{
  "type": "update",
  "channel":"fundingRatesPerps",
  "data": [{
		"market": "BTC-USD.P",
		"rate": "0.0005", // Estimated funding rate as a fraction
		"intervalEnds": "1692983823000000000", // Unix timestamp (nanoseconds) when the current interval ends
		"premiums": [
			... // Ignore, might be removed later
		]
	},
	...]
}

Authenticated channels

Additional authenticated channels are available for information specific to your account. These require authenticating as described here.

Margin Account

Channel for updates about your margin account balance and usage. See the REST endpoint for details about each field.

// Request
// Subscribe to margin account updates.
{
	"op": "subscribe",
  "channel": "balancePerps"
}

// Response
// First will be confirmation about operation success/failure.
{
  "channel": "balancePerps",
  "type":"subscribed",
  "data": ...
}

{
  "type": "update",
  "channel":"balancePerps",
  "data": {
		"walletBalance": "800",
		"unrealizedPNL":"200",
		"usedMargin": "8600"
		"availableMargin": "1300"
		"marginBalance": "1000"
		"maintenanceMargin": "4300"
		"marginRatio": "0.43"
	}
}

Positions

Channel for positions updates. See the REST endpoint for details about each field.

// Request
// Subscribe to positions updates.
{
	"op": "subscribe",
  "channel": "positionsPerps",
}

// Response
// First will be confirmation about operation success/failure.
{
  "channel": "positionsPerps",
  "type":"subscribed",
  "data": ...
}

{
  "type": "update",
  "channel":"positionsPerps",
  "data": [{
		"market": "BTC-USD.PERP",
		"direction": "long",
		"netQuantity": "1",
		"averageEntryPrice": "20500",
		"usedMargin": "10250",
		"unrealizedPnl": "100",
		"markPrice":" "20600",
		"liquidationPrice": "10000",
		"marginRatio": "0.5",
	},
	...]

Liquidations