### Get Mark Prices JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get Mark Prices' endpoint, showing funding rate, index price, mark price, next funding timestamp, and symbol. ```json [ { "fundingRate": "string", "indexPrice": "string", "markPrice": "string", "nextFundingTimestamp": 0, "symbol": "string" } ] ``` -------------------------------- ### Get K-lines JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get K-lines' endpoint, showing the structure of asks and bids, last update ID, and timestamp. ```json { "asks": [ [ "21.9", "500.123" ], [ "22.1", "2321.11" ] ], "bids": [ [ "20.12", "255.123" ], [ "20.5", "499.555" ] ], "lastUpdateId": "1684026955123", "timestamp": 1684026955123 } ``` -------------------------------- ### Get Borrow/Lend History - Request Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html This example shows how to retrieve borrow and lend history. It utilizes query parameters such as 'type', 'sources', 'positionId', 'symbol', 'limit', 'offset', and 'sortDirection' to filter and paginate the results. Essential headers include API key, signature, timestamp, and window. ```http GET /wapi/v1/history/borrowLend?type=Borrow&symbol=BTC&limit=100&sortDirection=Desc HTTP/1.1 Host: api.backpack.exchange X-API-KEY: YOUR_API_KEY X-SIGNATURE: YOUR_SIGNATURE X-TIMESTAMP: 1678886400000 X-WINDOW: 5000 ``` -------------------------------- ### Get Open Positions - Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html This is a sample JSON response for the 'Get open positions' endpoint. It details various attributes of a futures position, including entry price, mark price, PnL, and liquidation price. The structure provides a comprehensive overview of an account's open positions. ```json [ { "breakEvenPrice": "string", "entryPrice": "string", "estLiquidationPrice": "string", "imf": "string", "imfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "markPrice": "string", "mmf": "string", "mmfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "netCost": "string", "netQuantity": "string", "netExposureQuantity": "string", "netExposureNotional": "string", "pnlRealized": "string", "pnlUnrealized": "string", "cumulativeFundingPayment": "string", "subaccountId": 0, "symbol": "string", "userId": 0, "positionId": "string", "cumulativeInterest": "string" } ] ``` -------------------------------- ### Get Funding Interval Rates JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get Funding Interval Rates' endpoint, including symbol, interval end timestamp, and funding rate. ```json [ { "symbol": "string", "intervalEndTimestamp": "string", "fundingRate": "string" } ] ``` -------------------------------- ### Get Open Interest JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get Open Interest' endpoint, containing symbol, open interest, and timestamp. ```json [ { "symbol": "string", "openInterest": "string", "timestamp": 0 } ] ``` -------------------------------- ### Get Ticker - JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get ticker' endpoint, showing detailed market statistics for a single symbol over the last 24 hours. Includes price, volume, and trade data. ```json { "symbol": "string", "baseSymbol": "BTC", "quoteSymbol": "BTC", "marketType": "SPOT", "filters": { "price": { "minPrice": "string", "maxPrice": "string", "tickSize": "string", "maxMultiplier": "string", "minMultiplier": "string", "maxImpactMultiplier": "string", "minImpactMultiplier": "string", "meanMarkPriceBand": { "maxMultiplier": "string", "minMultiplier": "string" }, "meanPremiumBand": { "tolerancePct": "string" }, "borrowEntryFeeMaxMultiplier": "string", "borrowEntryFeeMinMultiplier": "string" }, "quantity": { "minQuantity": "string", "maxQuantity": "string", "stepSize": "string" } }, "imfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "mmfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "fundingInterval": 0, "fundingRateUpperBound": "string", "fundingRateLowerBound": "string", "openInterestLimit": "string", "orderBookState": "Open", "createdAt": "string", "visible": true } ``` -------------------------------- ### Get Markets Response Sample (JSON) Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html This snippet displays a sample JSON response for the 'Get markets' endpoint, detailing supported markets with their trading parameters and funding information. ```json [{ "borrowInterestRate": "string", "borrowedQuantity": "string", "lendInterestRate": "string", "lentQuantity": "string", "timestamp": "2019-08-24T14:15:22Z", "utilization": "string" }] ``` -------------------------------- ### Get Tickers - JSON Response Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Example JSON response for the 'Get tickers' endpoint, returning an array of market symbols, each with summarized statistics for the last 24 hours. Includes price, volume, and trade data. ```json [ { "symbol": "string", "firstPrice": "string", "lastPrice": "string", "priceChange": "string", "priceChangePercent": "string", "high": "string", "low": "string", "volume": "string", "quoteVolume": "string", "trades": "string" } ] ``` -------------------------------- ### Get Open Positions - Request Example Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html This snippet demonstrates how to request open positions for a futures account. It includes essential header parameters like API key, signature, and timestamp. The query parameter 'symbol' can be used to filter results. ```http GET /api/v1/position?symbol=BTCUSDT HTTP/1.1 Host: api.backpack.exchange X-API-KEY: YOUR_API_KEY X-SIGNATURE: YOUR_SIGNATURE X-TIMESTAMP: 1678886400000 X-WINDOW: 5000 ``` -------------------------------- ### Get Market Response Sample (JSON) Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html This snippet provides a sample JSON response for the 'Get market' endpoint, showcasing detailed information about a specific market, including its filters, funding rates, and creation timestamp. ```json [{ "symbol": "string", "baseSymbol": "BTC", "quoteSymbol": "BTC", "marketType": "SPOT", "filters": { "price": { "minPrice": "string", "maxPrice": "string", "tickSize": "string", "maxMultiplier": "string", "minMultiplier": "string", "maxImpactMultiplier": "string", "minImpactMultiplier": "string", "meanMarkPriceBand": { "maxMultiplier": "string", "minMultiplier": "string" }, "meanPremiumBand": { "tolerancePct": "string" }, "borrowEntryFeeMaxMultiplier": "string", "borrowEntryFeeMinMultiplier": "string" }, "quantity": { "minQuantity": "string", "maxQuantity": "string", "stepSize": "string" } }, "imfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "mmfFunction": { "type": "sqrt", "base": "string", "factor": "string" }, "fundingInterval": 0, "fundingRateUpperBound": "string", "fundingRateLowerBound": "string", "openInterestLimit": "string", "orderBookState": "Open", "createdAt": "string", "visible": true }] ``` -------------------------------- ### Cancel Order (URL Example) Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html A URL-formatted example for canceling an order on the BPX exchange. It includes the order ID, symbol, and a timestamp, demonstrating the parameters required for order cancellation. ```url instruction=ordercancel&orderid=28&symbol=btc_usdt×tamp=1614550000000&window=5000 ``` -------------------------------- ### Test WebSocket Subscription with wscat Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html Provides a command-line example using 'wscat' to test subscribing to the 'depth.SOL_USDC' stream. It includes piping a subscription command and then allowing standard input for further interaction. ```bash (sleep 1; echo '{"method":"SUBSCRIBE","params":["depth.SOL_USDC"]}\n'; cat) | wscat -c wss://ws.backpack.exchange ``` -------------------------------- ### Fetch K-Line Data (URL Example) Source: https://github.com/backpack-exchange/bpx-openapi/blob/master/docs/index.html URL structure for fetching K-line (candlestick) data for a given symbol and interval. This is crucial for technical analysis and backtesting trading strategies. ```url kline..