# Add Agent Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/add-agent openapi/exchange/accounts/add-agent.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Register an API agent wallet that can act on behalf of your account or a sub-account. # Approve Broker Fee Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/approve-broker-fee openapi/exchange/accounts/approve-broker-fee.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Use the ExchangeClient `approveBrokerFee` method to approve a builder and set a maximum fee rate they can charge. # Claim Referral Rewards Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/claim-referral-rewards openapi/exchange/accounts/claim-referral-rewards.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Claim your accumulated referral rewards to either spot or derivatives collateral balance. # Create Referral Code Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/create-referral-code openapi/exchange/accounts/create-referral-code.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Create a new referral code for your account. # Revoke Agent Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/revoke-agent openapi/exchange/accounts/revoke-agent.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Revoke an API wallet # Set Referrer Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/set-referrer openapi/exchange/accounts/set-referrer.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Set referral code # Update Perp Instrument Leverage Source: https://docs.hotstuff.trade/api-reference/exchange/accounts/update-perp-instrument-leverage openapi/exchange/accounts/update-perp-instrument-leverage.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Update Perpetual instrument leverage # Derivative Balance Transfer Request Source: https://docs.hotstuff.trade/api-reference/exchange/collateral-transfers/derivative-balance-transfer openapi/exchange/collateral-transfers/derivative-balance-transfer.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Send assets from your derivatives collateral balance. # Derivative Collateral Withdraw Request Source: https://docs.hotstuff.trade/api-reference/exchange/collateral-transfers/derivative-withdraw openapi/exchange/collateral-transfers/derivative-withdraw.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Withdraw from derivatives collateral balance. # Internal Balance Transfer Request Source: https://docs.hotstuff.trade/api-reference/exchange/collateral-transfers/internal-balance-transfer openapi/exchange/collateral-transfers/internal-balance-transfer.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Rebalance funds between your `spot` and `derivatives` balances. # Spot Balance Transfer Request Source: https://docs.hotstuff.trade/api-reference/exchange/collateral-transfers/spot-balance-transfer openapi/exchange/collateral-transfers/spot-balance-transfer.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Send assets from your spot collateral balance. # Spot Collateral Withdraw Request Source: https://docs.hotstuff.trade/api-reference/exchange/collateral-transfers/spot-withdraw openapi/exchange/collateral-transfers/spot-withdraw.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Withdraw from derivatives collateral balance. # Cancel All Orders Source: https://docs.hotstuff.trade/api-reference/exchange/trading/cancel-all openapi/exchange/trading/cancel-all.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Cancel all open orders. # Cancel Orders by Client Order ID Source: https://docs.hotstuff.trade/api-reference/exchange/trading/cancel-by-cloid openapi/exchange/trading/cancel-by-cloid.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Batch cancel order(s) by their client order order ids i.e. cloid(s) # Cancel Orders by Instrument Source: https://docs.hotstuff.trade/api-reference/exchange/trading/cancel-by-instrument openapi/exchange/trading/cancel-by-instrument.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Cancel all open orders by instrument. # Cancel Orders by Order ID Source: https://docs.hotstuff.trade/api-reference/exchange/trading/cancel-by-oid openapi/exchange/trading/cancel-by-oid.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Cancel open order(s) by order id(s) # Place Order Source: https://docs.hotstuff.trade/api-reference/exchange/trading/place-order openapi/exchange/trading/place-order.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Batch place orders. # Deposit to Vault Source: https://docs.hotstuff.trade/api-reference/exchange/vaults/deposit-to-vault openapi/exchange/vaults/deposit-to-vault.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Use the ExchangeClient `depositToVault` method to deposit collateral into a vault. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/exchange \ --header 'Content-Type: application/json' \ --data '{ "action": { "data": { "vaultAddress": "0x1234567890123456789012345678901234567890", "amount": "100.0", "nonce": 1769691074949 }, "type": "1401" }, "signature": "0x865876d8ea761547980c364c54e310f0cc6c2cc852fdcbff3c3534fc2d2b77d9...", "nonce": 1769691074949 }' ``` ```json 200 theme={null} { "tx_hash": "0x24666c7647f68ed388aa6f5aa2e08a7f36adc5f6339b5d12937e15e3b2cb928c", "tx_type": 1401, "error": "", "data": { "shares_minted": "100.0" }, "address": "0xEc6d21B8c1FF6dF523F22c4cf54F077e5F7cAfBf" } ``` ### Request body ``` { "data": { "vaultAddress": String, "amount": String, "nonce": Number }, "type": String } ``` Signed payload in hexadecimal format Current timestamp in milliseconds # Redeem from Vault Source: https://docs.hotstuff.trade/api-reference/exchange/vaults/redeem-from-vault openapi/exchange/vaults/redeem-from-vault.json POST /exchange Send POST request to /exchange, or use the ExchangeClient SDKs. Use the ExchangeClient `redeemFromVault` method to redeem shares from a vault and receive collateral. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/exchange \ --header 'Content-Type: application/json' \ --data '{ "action": { "data": { "vaultAddress": "0x1234567890123456789012345678901234567890", "shares": "50.0", "nonce": 1769691075449 }, "type": "1402" }, "signature": "0xc1aa6c72696fe7396404049143da22d26301a565d3b9cdcab36ac5872def6a89...", "nonce": 1769691075449 }' ``` ```json 200 theme={null} { "tx_hash": "0xa04e3a17347b9561983107ce39ae6671d6a20a787a20427d07094c6ab7b7543e", "tx_type": 1402, "error": "", "data": { "assets_redeemed": "50.0" }, "address": "0xEc6d21B8c1FF6dF523F22c4cf54F077e5F7cAfBf" } ``` ### Request body ``` { "data": { "vaultAddress": String, "shares": String, "nonce": Number }, "type": String } ``` Signed payload in hexadecimal format Current timestamp in milliseconds # Builder codes Source: https://docs.hotstuff.trade/api-reference/getting-started/builders ## API integration for builders ### Approving builder fees Builder actions require users to approve a broker/builder fee. See [Approve Broker Fee endpoint](../../api-reference/exchange/accounts/approve-broker-fee). ``` curl --request POST \ --url https://api.hotstuff.trade/exchange \ --header 'Content-Type: application/json' \ --data '{ "action": { "data": { "broker": "0x1234567890123456789012345678901234567890", "maxFeeRate": "0.001", "nonce": 1769690420567 }, "type": "approveBrokerFee" }, "signature": "0x79a8f17e198acb5532166f9705a4b9d49ac029cc390b310e07f11b2b3a03f591...", "nonce": 1769690420567 }' ``` ### Check Builder fee approval See [Check Broker Approval endpoint](../../api-reference/info/accounts/brokers-check) ### Place orders with builder codes Set `BrokerConfig` in place order actions by adding a `brokerConfig` to all place order actions in the [Place Order API endpoint](../../api-reference/exchange/trading/place-order) ### Claim rewards Accumulated builder fee can be claimed via the referral dashboard in the UI or via the [Claim Rewards API endpoint](../../api-reference/exchange/accounts/claim-referral-rewards) # API Introduction Source: https://docs.hotstuff.trade/api-reference/getting-started/introduction Reference for the Hotstuff API ## Overview The Hotstuff API provides REST and WebSocket endpoints for trading, market data, and blockchain information. ### Mainnet URLs * REST-API: `https://api.hotstuff.trade` * WSS: `wss://api.hotstuff.trade/ws` ### Testnet URLs * REST-API: `https://testnet-api.hotstuff.trade` * WSS: `wss://testnet-api.hotstuff.trade/ws` ## Endpoints * **General**: Health checks and API information * **Node Info**: Blockchain node status and peer information * **Global**: Market data for all trading instruments * **Account-specific**: User positions, orders, and transaction history * **WebSocket**: Real-time market data and order updates ## Response Format All responses use JSON format with standard HTTP status codes: * `200` - Success * `400` - Bad request * `401` - Unauthorized * `403` - Forbidden * `404` - Not found * `429` - Rate limit exceeded * `500` - Server error * `503` - Service unavailable * `504` - Gateway timeout # Nonce Management Source: https://docs.hotstuff.trade/api-reference/getting-started/nonce-management Nonce on Hotstuff are tracked per signer, which is the user address if signed with private key of the address, or the agent address if signed with an API wallet. Nonces must be within `(T - 2 days, T + 1 day)`, where `T` is the unix millisecond timestamp on the block of the transaction. #### Notes for API traders * For each batch of orders or cancels, fetch and increment an atomic counter that ensures a unique nonce for the address. The atomic counter can be fast-forwarded to current unix milliseconds if needed. * For concurrent operations, we recommend using an shared atomic nonce counter ensuring unique nonces per transaction/api call. * For batch operations, like place/cancel orders, there's a hard cap of 100 ops per batch per api call. # Rate Limits Source: https://docs.hotstuff.trade/api-reference/getting-started/rate-limits We enforce rate limits on both REST API and WebSocket usage. All rate limits are enforced **per IP address**. ## REST API | Endpoint | Requests/min | Requests/hour | | ---------------- | :----------: | :-----------: | | `POST /exchange` | 20,000 | — | | `POST /info` | 5,000 | 200,000 | ## WebSocket | Limit | Value | | ------------------------------- | :---: | | Max connections per IP | 100 | | Max subscriptions per IP | 1,000 | | Max inbound messages/min per IP | 2,000 | The 2,000 messages/min limit applies to messages **sent by the client** (subscribe, unsubscribe, ping, etc.). There is no limit on server-to-client messages. ## Response Headers ### `/exchange` endpoint | Header | Description | Example | | ------------------ | ----------------------------------------- | :-----: | | `X-Used-Weight-1m` | Weight used in current minute | `1250` | | `Retry-After` | Seconds until retry allowed (only on 429) | `12` | ### `/info` endpoint Includes all headers from `/exchange`, plus: | Header | Description | Example | | ---------------- | ------------------------------------- | :-----------: | | `X-RateLimit-1m` | Requests used / limit (1 min window) | `150/5000` | | `X-RateLimit-1h` | Requests used / limit (1 hour window) | `3200/200000` | ## Error Responses ### HTTP 429 — Rate Limited ```json theme={null} { "code": 429, "message": "Rate limit exceeded. Try again later." } ``` ### HTTP 418 — IP Banned Returned after repeated rate limit violations. ```json theme={null} { "code": 418, "message": "IP banned. Retry in 300 seconds." } ``` Ban durations escalate with repeated violations: **5 min → 30 min → 2 hours → 24 hours → 7 days**. # Client SDKs Source: https://docs.hotstuff.trade/api-reference/getting-started/sdks https://api.hotstuff.trade/exchange * Python: github.com/hotstuff-labs/python-sdk * TypeScript: github.com/hotstuff-labs/ts-sdk * Golang: coming soon * Rust: coming soon # Signing Actions Source: https://docs.hotstuff.trade/api-reference/getting-started/signing ### How Signing Works The SDK uses EIP-712 typed data signing for all exchange actions. Here's what happens under the hood: 1. **Action Encoding**: The action payload is encoded using MessagePack 2. **Hashing**: The encoded bytes are hashed with keccak256 3. **EIP-712 Signing**: The hash is signed using EIP-712 typed data with the following structure: ```typescript theme={null} const domain = { name: "HotstuffCore", version: "1", chainId: 1, verifyingContract: "0x1234567890123456789012345678901234567890", }; const types = { Action: [ { name: "source", type: "string" }, // "Testnet" or "Mainnet" { name: "hash", type: "bytes32" }, // keccak256 of msgpack-encoded action { name: "txType", type: "uint16" }, // Tx Op Code ], }; ``` ### Action types & Opcodes | **Action** | **Tx Type** | \*\*Tx Op Codes \*\* | | ----------------------------------- | ---------------------------------- | :------------------: | | **Account Actions** | | | | Add Agent | `addAgent` | 1201 | | Revoke Agent | `revokeAgent` | 1211 | | Update Perp Instrument Leverage | `updatePerpLeverage` | 1203 | | Approve Broker Fee | `approveBrokerFee` | 1207 | | Create Referral Code | `createReferralCode` | 1208 | | Set Referrer | `setReferrer` | 1209 | | Claim Referral Rewards | `claimReferralRewards` | 1210 | | **Trading Actions** | | | | Place Order | `placeOrder` | 1301 | | Cancel Order by OID | `cancelByOid` | 1302 | | Cancel All | `cancelAll` | 1311 | | Cancel by Cloid | `cancelByCloid` | 1312 | | Cancel by Instrument | `cancelByInstrument` | 1313 | | **Collateral Actions** | | | | Spot Withdraw Request | `spotWithdrawRequest` | 1002 | | Derivative Withdraw Request | `derivativeWithdrawRequest` | 1003 | | Spot Balance Transfer Request | `spotBalanceTransferRequest` | 1051 | | Derivative Balance Transfer Request | `derivativeBalanceTransferRequest` | 1052 | | Internal Balance Transfer Request | `internalBalanceTransferRequest` | 1053 | ### SDK Implementation ```typescript TypeScript theme={null} import { encode } from "@msgpack/msgpack"; import { keccak256 } from "viem"; export async function signAction( args: { wallet: any; action: unknown; txType: number; }, options?: { isTestnet: boolean; }, ) { const isTestnet = options?.isTestnet ?? false; const actionBytes = encode(args.action); const payloadHash = keccak256(actionBytes); const domain = { name: "HotstuffCore", version: "1", chainId: 1, verifyingContract: "0x1234567890123456789012345678901234567890" as `0x${string}`, }; const types = { Action: [ { name: "source", type: "string" }, { name: "hash", type: "bytes32" }, { name: "txType", type: "uint16" }, ], }; const eip712Message = { source: isTestnet ? "Testnet" : "Mainnet", hash: payloadHash, txType: args.txType, }; const signature = await args.wallet.signTypedData({ domain, types, primaryType: "Action", message: eip712Message, }); return signature; } ``` ```python Python theme={null} """Signing utilities for EIP-712 typed data.""" import msgpack from eth_account import Account from eth_account.messages import encode_structured_data from eth_utils import keccak from hotstuff.methods.exchange.op_codes import EXCHANGE_OP_CODES async def sign_action( wallet: Account, action: dict, tx_type: int, is_testnet: bool = False ) -> str: """ Sign an action using EIP-712. Args: wallet: The account to sign with action: The action data tx_type: The transaction type code is_testnet: Whether this is for testnet Returns: str: The signature """ # Encode action to msgpack action_bytes = msgpack.packb(action) # Hash the payload payload_hash = keccak(action_bytes) # EIP-712 domain domain = { "name": "HotstuffCore", "version": "1", "chainId": 1, "verifyingContract": "0x1234567890123456789012345678901234567890", } # EIP-712 types types = { "EIP712Domain": [ {"name": "name", "type": "string"}, {"name": "version", "type": "string"}, {"name": "chainId", "type": "uint256"}, {"name": "verifyingContract", "type": "address"}, ], "Action": [ {"name": "source", "type": "string"}, {"name": "hash", "type": "bytes32"}, {"name": "txType", "type": "uint16"}, ], } # Message message = { "source": "Testnet" if is_testnet else "Mainnet", "hash": payload_hash, "txType": tx_type, } # Create structured data structured_data = { "types": types, "primaryType": "Action", "domain": domain, "message": message, } # Encode and sign encoded_data = encode_structured_data(structured_data) signed_message = wallet.sign_message(encoded_data) return signed_message.signature.hex() ``` ### Debugging Signature Issues It is recommended to use an existing SDK instead of manually generating signatures. There are many potential ways in which signatures can be wrong. An incorrect signature results in recovering a different signer based on the signature and payload and results in one of the following errors: ``` "Error: account does not exist." ``` ``` "invalid order signer" ``` where the returned address does not match the public address of the wallet you are signing with. The returned address also changes for different inputs. An incorrect signature does not indicate why it is incorrect which makes debugging more challenging. To debug this it is recommended to read through the SDK carefully and make sure the implementation matches exactly. If that doesn't work, add logging to find where the output diverges. *** # account_history Source: https://docs.hotstuff.trade/api-reference/info/accounts/account-history openapi/info/accounts/account-history.json POST /info Send POST request to /info with method: "account_history" Retrieve historical account data including total PnL, total volume, account value, and timestamps for a user. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "account_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "account_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "account_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "account_history", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "account_history", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"account_history\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "account_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # account_info Source: https://docs.hotstuff.trade/api-reference/info/accounts/account-info openapi/info/accounts/account-info.json POST /info Send POST request to /info with method: "account_info" Retrieve account information including account details, rewards, and optional referral reward history. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "account_info", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "collateralID": 1, "includeHistory": true } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "account_info", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "collateralID": 1, "includeHistory": True } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "account_info", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", collateralID: 1, includeHistory: true, }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "account_info", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "collateralID" => 1, "includeHistory" => true ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "account_info", "params": map[string]interface{}{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "collateralID": 1, "includeHistory": true, }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"account_info\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\"collateralID\":1,\"includeHistory\":true}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "account_info", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", collateralID: 1, includeHistory: true } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # account_summary Source: https://docs.hotstuff.trade/api-reference/info/accounts/account-summary openapi/info/accounts/account-summary.json POST /info Send POST request to /info with method: "account_summary" Retrieve comprehensive account summary including positions, balances, margin information, and account equity for a user. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "account_summary", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "account_summary", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "account_summary", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "account_summary", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "account_summary", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"account_summary\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "account_summary", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # all_agents Source: https://docs.hotstuff.trade/api-reference/info/accounts/agent-wallet openapi/info/accounts/agent-wallet.json POST /info Send POST request to /info with method: "all_agents" Retrieve information about all trading agents associated with the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "all_agents", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "all_agents", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "all_agents", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "all_agents", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "all_agents", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"all_agents\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "all_agents", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # brokers_check Source: https://docs.hotstuff.trade/api-reference/info/accounts/brokers-check openapi/info/accounts/brokers-check.json POST /info Send POST request to /info with method: "brokers_check" Retrieve broker approval records for a given user. Optionally filter by a specific broker address. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "brokers_check", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "broker": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "brokers_check", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "broker": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "brokers_check", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", broker: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "brokers_check", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "broker" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "brokers_check", "params": map[string]interface{}{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "broker": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"brokers_check\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\"broker\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "brokers_check", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", broker: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` ## Response | Field | Type | Description | | --------------------- | ------- | ------------------------------------------------- | | `data` | Array | List of broker approval records | | `data[].account` | String | User wallet address | | `data[].broker` | String | Broker wallet address | | `data[].max_fee_rate` | String | Maximum fee rate the broker is approved to charge | | `data[].updated_at` | Number | Unix timestamp (seconds) of the last update | | `page` | Number | Current page number | | `limit` | Number | Maximum records per page | | `total_count` | Number | Total number of records | | `total_pages` | Number | Total number of pages | | `has_next` | Boolean | Whether a next page exists | | `has_prev` | Boolean | Whether a previous page exists | # fills Source: https://docs.hotstuff.trade/api-reference/info/accounts/fills openapi/info/accounts/fills.json POST /info Send POST request to /info with method: "fills" Retrieve trade fills and execution history for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "fills", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "fills", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "fills", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "fills", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "fills", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"fills\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "fills", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # funding_history Source: https://docs.hotstuff.trade/api-reference/info/accounts/funding-history openapi/info/accounts/funding-history.json POST /info Send POST request to /info with method: "funding_history" Retrieve funding payments and interest history for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "funding_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "funding_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "funding_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "funding_history", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "funding_history", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"funding_history\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "funding_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # instrument_leverage Source: https://docs.hotstuff.trade/api-reference/info/accounts/instrument-leverage openapi/info/accounts/instrument-leverage.json POST /info Send POST request to /info with method: "instrument_leverage" Retrieve leverage information for a specific instrument for a user, including margin type and leverage value. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "instrument_leverage", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "symbol": "BTC-PERP" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "instrument_leverage", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "symbol": "BTC-PERP" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "instrument_leverage", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", symbol: "BTC-PERP", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "instrument_leverage", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "symbol" => "BTC-PERP" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "instrument_leverage", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "symbol": "BTC-PERP", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"instrument_leverage\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\",\"symbol\":\"BTC-PERP\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "instrument_leverage", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", symbol: "BTC-PERP" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # open_orders Source: https://docs.hotstuff.trade/api-reference/info/accounts/open-orders openapi/info/accounts/open-orders.json POST /info Send POST request to /info with method: "open_orders" Retrieve all open orders for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "open_orders", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "open_orders", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "open_orders", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "open_orders", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "open_orders", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"open_orders\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "open_orders", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # order_history Source: https://docs.hotstuff.trade/api-reference/info/accounts/order-history openapi/info/accounts/order-history.json POST /info Send POST request to /info with method: "order_history" Retrieve historical order data for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "order_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "order_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "order_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "order_history", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "order_history", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"order_history\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "order_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # positions Source: https://docs.hotstuff.trade/api-reference/info/accounts/positions openapi/info/accounts/positions.json POST /info Send POST request to /info with method: "positions" Retrieve current positions for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "positions", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "positions", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "positions", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "positions", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "positions", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"positions\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "positions", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # referral_summary Source: https://docs.hotstuff.trade/api-reference/info/accounts/referral-summary openapi/info/accounts/referral-summary.json POST /info Send POST request to /info with method: "referral_summary" Retrieve referral summary including referrer information, referral codes, rewards, and referral tier details for a user. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "referral_summary", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "referral_summary", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "referral_summary", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "referral_summary", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "referral_summary", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"referral_summary\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "referral_summary", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # transfer_history Source: https://docs.hotstuff.trade/api-reference/info/accounts/transfer-history openapi/info/accounts/transfer-history.json POST /info Send POST request to /info with method: "transfer_history" Retrieve deposit transaction history for the authenticated user account. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "transfer_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "transfer_history", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "transfer_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "transfer_history", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "transfer_history", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"transfer_history\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "transfer_history", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # user_fees Source: https://docs.hotstuff.trade/api-reference/info/accounts/user-fees openapi/info/accounts/user-fees.json POST /info Send POST request to /info with method: "user_fees" Retrieve fee information for a user including trading volumes and fee rates for perpetuals, spot, and options trading. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "user_fees", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "user_fees", "params": { "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "user_fees", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "user_fees", "params" => [ "user" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "user_fees", "params": map[string]string{ "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"user_fees\",\"params\":{\"user\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "user_fees", params: { user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # Block Source: https://docs.hotstuff.trade/api-reference/info/explorer/block openapi/info/explorer/block.json POST /explorer Send POST request to /explorer with method: "block" Retrieve detailed information about a specific block including its transactions. Can be queried by block hash or block height. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/explorer \ --header 'Content-Type: application/json' \ --data '{ "method": "block", "params": { "block_height": 162778 } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/explorer" payload = { "method": "block", "params": { "block_height": 162778 } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/explorer"; const payload = { method: "block", params: { block_height: 162778, }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "block", "params" => [ "block_height" => 162778 ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/explorer" payload := map[string]interface{}{ "method": "block", "params": map[string]interface{}{ "block_height": 162778, }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/explorer"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"block\",\"params\":{\"block_height\":162778}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/explorer') payload = { method: "block", params: { block_height: 162778 } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # Blocks Source: https://docs.hotstuff.trade/api-reference/info/explorer/blocks openapi/info/explorer/blocks.json POST /explorer Send POST request to /explorer with method: "blocks" Retrieve a paginated list of blocks with their details including block height, hash, parent hash, and transaction counts. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/explorer \ --header 'Content-Type: application/json' \ --data '{ "method": "blocks", "params": { "offset": 60, "limit": 80 } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/explorer" payload = { "method": "blocks", "params": { "offset": 60, "limit": 80 } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/explorer"; const payload = { method: "blocks", params: { offset: 60, limit: 80, }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "blocks", "params" => [ "offset" => 60, "limit" => 80 ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/explorer" payload := map[string]interface{}{ "method": "blocks", "params": map[string]interface{}{ "offset": 60, "limit": 80, }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/explorer"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"blocks\",\"params\":{\"offset\":60,\"limit\":80}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/explorer') payload = { method: "blocks", params: { offset: 60, limit: 80 } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # Transaction Source: https://docs.hotstuff.trade/api-reference/info/explorer/transaction openapi/info/explorer/transaction.json POST /explorer Send POST request to /explorer with method: "transaction" Retrieve detailed information about a specific transaction by its hash, including block information, transaction type, and success status. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/explorer \ --header 'Content-Type: application/json' \ --data '{ "method": "transaction", "params": { "tx_hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/explorer" payload = { "method": "transaction", "params": { "tx_hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/explorer"; const payload = { method: "transaction", params: { tx_hash: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "transaction", "params" => [ "tx_hash" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/explorer" payload := map[string]interface{}{ "method": "transaction", "params": map[string]string{ "tx_hash": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/explorer"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"transaction\",\"params\":{\"tx_hash\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/explorer') payload = { method: "transaction", params: { tx_hash: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # Transactions Source: https://docs.hotstuff.trade/api-reference/info/explorer/transactions openapi/info/explorer/transactions.json POST /explorer Send POST request to /explorer with method: "transactions" Retrieve a paginated list of transactions with optional filtering by account. Returns transaction details including hash, block information, transaction type, and success status. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/explorer \ --header 'Content-Type: application/json' \ --data '{ "method": "transactions", "params": { "filter": { "account": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/explorer" payload = { "method": "transactions", "params": { "filter": { "account": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/explorer"; const payload = { method: "transactions", params: { filter: { account: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "transactions", "params" => [ "filter" => [ "account" => "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" ] ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/explorer" payload := map[string]interface{}{ "method": "transactions", "params": map[string]interface{}{ "filter": map[string]string{ "account": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/explorer"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"transactions\",\"params\":{\"filter\":{\"account\":\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\"}}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/explorer') payload = { method: "transactions", params: { filter: { account: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # bbo Source: https://docs.hotstuff.trade/api-reference/info/global/bbo openapi/info/global/bbo.json POST /info Send POST request to /info with method: "bbo" Retrieve best bid and offer (BBO) data for trading instruments. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "bbo", "params": { "symbol": "all" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "bbo", "params": { "symbol": "all" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "bbo", params: { symbol: "all", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "bbo", "params" => [ "symbol" => "all" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "bbo", "params": map[string]string{ "symbol": "all", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"bbo\",\"params\":{\"symbol\":\"all\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "bbo", params: { symbol: "all" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # chart Source: https://docs.hotstuff.trade/api-reference/info/global/chart openapi/info/global/chart.json POST /info Send POST request to /info with method: "chart" Retrieve OHLCV chart data for technical analysis and charting. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "chart", "params": { "symbol": "1", "chart_type": "mark", "resolution": "1", "from": 1658716757, "to": 1758716766000 } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "chart", "params": { "symbol": "1", "chart_type": "mark", "resolution": "1", "from": 1658716757, "to": 1758716766000 } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "chart", params: { symbol: "1", chart_type: "mark", resolution: "1", from: 1658716757, to: 1758716766000, }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "chart", "params" => [ "symbol" => "1", "chart_type" => "mark", "resolution" => "1", "from" => 1658716757, "to" => 1758716766000 ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "chart", "params": map[string]interface{}{ "symbol": "1", "chart_type": "mark", "resolution": "1", "from": 1658716757, "to": 1758716766000, }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"chart\",\"params\":{\"symbol\":\"1\",\"chart_type\":\"mark\",\"resolution\":\"1\",\"from\":1658716757,\"to\":1758716766000}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "chart", params: { symbol: "1", chart_type: "mark", resolution: "1", from: 1658716757, to: 1758716766000 } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` ## Chart Types | Type | Description | | ------- | ---------------------- | | `mark` | Mark price data | | `index` | Index price data | | `ltp` | Last traded price data | ## Resolutions | Resolution | Interval | | :--------: | ---------- | | `1` | 1 minute | | `5` | 5 minutes | | `15` | 15 minutes | | `30` | 30 minutes | | `60` | 1 hour | | `240` | 4 hours | | `1D` | 1 day | | `1W` | 1 week | # instruments Source: https://docs.hotstuff.trade/api-reference/info/global/instruments openapi/info/global/instruments.json POST /info Send POST request to /info with method: "instruments" Retrieve information about available instruments in the system. Use this endpoint to discover what trading instruments are available. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "instruments", "params": { "type": "perps" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "instruments", "params": { "type": "perps" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "instruments", params: { type: "perps", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "instruments", "params" => [ "type" => "perps" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "instruments", "params": map[string]string{ "type": "perps", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"instruments\",\"params\":{\"type\":\"perps\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "instruments", params: { type: "perps" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # mids Source: https://docs.hotstuff.trade/api-reference/info/global/mids openapi/info/global/mids.json POST /info Send POST request to /info with method: "mids" Retrieve mid prices for trading instruments (average of bid and ask). ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "mids", "params": { "symbol": "all" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "mids", "params": { "symbol": "all" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "mids", params: { symbol: "all", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "mids", "params" => [ "symbol" => "all" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "mids", "params": map[string]string{ "symbol": "all", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"mids\",\"params\":{\"symbol\":\"all\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "mids", params: { symbol: "all" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # oracle Source: https://docs.hotstuff.trade/api-reference/info/global/oracle openapi/info/global/oracle.json POST /info Send POST request to /info with method: "oracle" Retrieve oracle price information for a specific symbol including index price, external mark price, and last update timestamp. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "oracle", "params": { "symbol": "USDT/USDC" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "oracle", "params": { "symbol": "USDT/USDC" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "oracle", params: { symbol: "USDT/USDC", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "oracle", "params" => [ "symbol" => "USDT/USDC" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "oracle", "params": map[string]string{ "symbol": "USDT/USDC", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"oracle\",\"params\":{\"symbol\":\"USDT/USDC\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "oracle", params: { symbol: "USDT/USDC" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # orderbook Source: https://docs.hotstuff.trade/api-reference/info/global/orderbook openapi/info/global/orderbook.json POST /info Send POST request to /info with method: "orderbook" Retrieve current order book data with bid and ask levels for specified trading instruments. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "orderbook", "params": { "symbol": "BTC-PERP" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "orderbook", "params": { "symbol": "BTC-PERP" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "orderbook", params: { symbol: "BTC-PERP", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "orderbook", "params" => [ "symbol" => "BTC-PERP" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "orderbook", "params": map[string]string{ "symbol": "BTC-PERP", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"orderbook\",\"params\":{\"symbol\":\"BTC-PERP\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "orderbook", params: { symbol: "BTC-PERP" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # supported_collateral Source: https://docs.hotstuff.trade/api-reference/info/global/supported-collateral openapi/info/global/supported-collateral.json POST /info Send POST request to /info with method: "supported_collateral" Retrieve supported collateral configuration, risk parameters, and bridge details for a specific symbol or all symbols. `params.symbol` is required. Pass a collateral symbol like `USDC`, or use `all` to fetch all supported collateral types. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "supported_collateral", "params": { "symbol": "USDC" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "supported_collateral", "params": { "symbol": "USDC" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "supported_collateral", params: { symbol: "USDC", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "supported_collateral", "params" => [ "symbol" => "USDC" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "supported_collateral", "params": map[string]interface{}{ "symbol": "USDC", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"supported_collateral\",\"params\":{\"symbol\":\"USDC\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "supported_collateral", params: { symbol: "USDC" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # ticker Source: https://docs.hotstuff.trade/api-reference/info/global/ticker openapi/info/global/ticker.json POST /info Send POST request to /info with method: "ticker" Retrieve ticker information for trading instruments including current prices, volume, and market data. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "ticker", "params": { "symbol": "all" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "ticker", "params": { "symbol": "all" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "ticker", params: { symbol: "all", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "ticker", "params" => [ "symbol" => "all" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "ticker", "params": map[string]string{ "symbol": "all", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"ticker\",\"params\":{\"symbol\":\"all\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "ticker", params: { symbol: "all" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # trades Source: https://docs.hotstuff.trade/api-reference/info/global/trades openapi/info/global/trades.json POST /info Send POST request to /info with method: "trades" Retrieve recent trade history for specified trading instruments. ```bash cURL theme={null} curl --request POST \ --url https://api.hotstuff.trade/info \ --header 'Content-Type: application/json' \ --data '{ "method": "trades", "params": { "symbol": "BTC-PERP" } }' ``` ```python Python theme={null} import requests url = "https://api.hotstuff.trade/info" payload = { "method": "trades", "params": { "symbol": "BTC-PERP" } } response = requests.post(url, json=payload) print(response.json()) ``` ```javascript Javascript theme={null} const url = "https://api.hotstuff.trade/info"; const payload = { method: "trades", params: { symbol: "BTC-PERP", }, }; fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload), }) .then((response) => response.json()) .then((data) => console.log(data)); ``` ```php PHP theme={null} "trades", "params" => [ "symbol" => "BTC-PERP" ] ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']); $response = curl_exec($ch); curl_close($ch); print_r(json_decode($response, true)); ?> ``` ```go Go theme={null} package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) func main() { url := "https://api.hotstuff.trade/info" payload := map[string]interface{}{ "method": "trades", "params": map[string]string{ "symbol": "BTC-PERP", }, } jsonData, _ := json.Marshal(payload) resp, _ := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```java Java theme={null} import java.net.HttpURLConnection; import java.net.URL; import java.io.*; URL url = new URL("https://api.hotstuff.trade/info"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); conn.setDoOutput(true); String jsonPayload = "{\"method\":\"trades\",\"params\":{\"symbol\":\"BTC-PERP\"}}"; OutputStream os = conn.getOutputStream(); os.write(jsonPayload.getBytes()); os.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String response = in.readLine(); System.out.println(response); ``` ```ruby Ruby theme={null} require 'net/http' require 'json' uri = URI('https://api.hotstuff.trade/info') payload = { method: "trades", params: { symbol: "BTC-PERP" } } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json') request.body = payload.to_json response = http.request(request) puts JSON.parse(response.body) ``` # Welcome to Hotstuff Source: https://docs.hotstuff.trade/hotstuff-docs/about/welcome-to-hotstuff Hotstuff Hotstuff is one margin account to trade, earn, and bank, designed for retail users outside the United States. The platform is built around a unified account model where a user opens and funds a single account, and the same balance can be used across perpetual futures, spot markets, tokenized real-world assets (RWAs), stablecoins, cards, and local payment rails. Under the hood, Hotstuff runs on a purpose-built Layer 1 powered by [DracoBFT](/hotstuff-docs/hotstuff-L1/dracobft/overview), a consensus mechanism designed for low-latency financial applications. Validators on Hotstuff perform functions beyond block production. In addition to participating in consensus, they coordinate execution, liquidity routing, fiat access, compliance workflows, and last-mile money movement around a single user account. This architecture allows the network to operate as financial infrastructure rather than only a settlement layer. The result is a system where trading, asset custody, payments, and fiat connectivity can be integrated into a unified account experience for non-US retail users. One account for every product on Hotstuff. Perpetuals with leverage, tight spreads, and real depth. Invest in 200+ listed tokenized real-world assets. Deposit idle cash into vaults and earn APY on your balance. # Blog Source: https://docs.hotstuff.trade/hotstuff-docs/external/blog # Discord Source: https://docs.hotstuff.trade/hotstuff-docs/external/discord # Feedback Source: https://docs.hotstuff.trade/hotstuff-docs/external/feedback # @tradehotstuff Source: https://docs.hotstuff.trade/hotstuff-docs/external/x # Affiliate Program Source: https://docs.hotstuff.trade/hotstuff-docs/programs/affiliate Hotstuff Affiliates earn fee share commissions of up to **50%** from the trading activity of their referred users. Spots in the affiliate program are **limited** and participation is a selective process based on the Hotstuff team's discretion. Your commission tier scales with the total volume your referred users generate over a **30-day rolling window**, rewarding affiliates who bring consistent, high-quality trading activity to the platform. If you have a large trading community interested in trading on Hotstuff, apply below or open a ticket in our [Discord](https://discord.gg/tradehotstuff). *** ## Affiliate Tiers | Tier | 30d Affiliate Volume | Fee Discount | Commission | | ----- | -------------------- | ------------ | ---------- | | Scout | Up to \$5M | 5% | 35% | | Pro | > \$5M | 5% | 40% | | Elite | > \$20M | 5% | 45% | | Titan | > \$100M | 5% | 50% | Tiers use a **30-day rolling window**. Maintain the volume threshold over any trailing 30-day period to hold or advance your tier. *** ## FAQs The referral program is open to any user who reaches \$10,000 in personal trading volume. The affiliate program is invite-only, designed for community builders, KOLs, and high-volume introducers. Affiliate commissions are significantly higher, scaling up to 50%. Your tier is recalculated based on the total trading volume generated by your referred users over the last 30 days. Sustaining or growing that volume moves you up. Dropping below a threshold moves you down. Commissions accumulate in real time as your referred users trade. You can claim them anytime from the referral dashboard, and they are credited directly to your perp account. There is no cap on total commissions. Affiliate rewards apply for each referred user's first \$1B in trading volume. Yes. Affiliate status replaces your standard referral tier and applies the higher commission rate to all referred users under your link. *** Open a ticket in our Discord to start the application process. Tell us about your community and trading background. # Builder Program Source: https://docs.hotstuff.trade/hotstuff-docs/programs/builders Hotstuff Builder Program Hotstuff is built to be built on. The Builder Program is an open invitation for developers, trading platforms, and product teams to plug into Hotstuff's infrastructure and earn a direct share of the fees generated by the activity they bring. You grow your product, your users trade, and you earn alongside them. Builder codes affect only Hotstuff's order fee logic and are fully verified on-chain according to user approval, fee limits, and builder configuration. *** ## Points Rewards Hotstuff has set aside up to **2,000,000 points** to reward teams building on the Builder Program. * Rewards are distributed based on each team's contribution to Hotstuff's growth * An evaluation process is conducted to ensure fairness and meaningful ecosystem impact * Only teams making significant contributions will be eligible for point rewards *** Start with the [Hotstuff 101 for Builders](/hotstuff-docs/for-builders/101) guide for a full walkthrough on integrating builder codes and setting up fee collection. For API specifics, see the [Builders API reference](/api-reference/getting-started/builders). If you have questions, want to connect with other builders, or are exploring what to build, join us on [Discord](https://discord.gg/tradehotstuff). # Creator Program Source: https://docs.hotstuff.trade/hotstuff-docs/programs/creators The Hotstuff Creator Program is an invite for the best creators to become an integral part of Hotstuff's growth engine. Hotstuff Creator Program * **Starts:** May 26, 2026 * **Concludes:** Aug 31, 2026 * **Duration:** \~15 weeks Rewards are distributed based on content performance, user referrals, trading activity generated, consistency, and regional leaderboard ranking. Additional bonus campaigns and seasonal competitions may be announced during the program. For full program details including tiers, supported platforms, content guidelines, and regional rewards, [read the full program breakdown](https://hotstuff-labs.notion.site/hotstuff-creator-program). *** Open a ticket in our Discord to start your application. Tell us about your platform, audience, and content background. # Points Program Source: https://docs.hotstuff.trade/hotstuff-docs/programs/points The Hotstuff Points program recognizes and rewards users who contribute to Hotstuff's growth through organic trading activity and participation. Hotstuff Points * The program launched on **Feb 26, 2026** * Points are distributed **every Monday at 12:00 UTC**, based on the previous week's activity * The weekly allocation is **capped at 1.5M points**, depending on weekly trading volume * The program will conclude no later than **Q3 2026** * Earn points by engaging in organic trading activity via the app or API. Self-trading, sybil behavior, and any other manipulative activity will not earn points **1,400,000 points** were retroactively distributed to **1,800+ early users** based on the snapshot taken on Feb 26, 2026. *** ## FAQs The formula is dynamic and opaque by design, updated weekly as usage evolves. Many activities are tracked by the points program. Attribution for different activities may happen immediately or be applied over time across several distributions. No. Discrete or costless actions do not yield rewards in isolation. Having 100 accounts provides no advantage over one. The points program is structured to balance both early supporters and long-term contributors fairly. No. There was no prior sale and there is no way to purchase points. They can only be earned through trading and participation. # Referral Program Source: https://docs.hotstuff.trade/hotstuff-docs/programs/referral Once you have generated **\$10,000 in trading volume**, you can generate a referral link from [app.hotstuff.trade/referral](https://app.hotstuff.trade/referral) and share it with others to join Hotstuff as your referee. * **Referrers** earn a commission on fees generated by their referred users * **Referees** receive a flat **5% fee discount** on all trades * Referral rewards accumulate automatically. Claim them anytime from the referral dashboard and they are credited directly to your perp account. * Referral rewards apply for a user's first **\$1B in referred volume**. *** ## Referral Tiers Your tier is determined by your **14-day rolling referred trading volume**. Higher volume unlocks a higher commission rate. | Tier | Referred Volume (14d) | Fee Discount | Commission | | -------- | --------------------- | ------------ | ---------- | | Standard | $0 - $500K | 5% | 10% | | Silver | > \$500K | 5% | 15% | | Gold | > \$1M | 5% | 20% | | Platinum | > \$3M | 5% | 25% | Tiers use a **14-day rolling window**. Reach the volume threshold over any trailing 14-day period to unlock and maintain that tier. *** ## FAQs Navigate to [app.hotstuff.trade/referral](https://app.hotstuff.trade/referral) after reaching the \$10,000 volume threshold. Click **Generate Referral Link**, enter your preferred referral name, and copy the link. Anyone who joins Hotstuff through your link will be attached to your account as a referee. After connecting a new wallet, open the referral section from the top-right corner of the app. You will be prompted to enter a referral code. Entering one links your account as a referee to the user who generated it. Click a referral link shared by another user. You will be prompted to connect your wallet and claim the referral. This will attach your account as a referee to the referral link's owner. You must make a deposit to complete the claim. Rewards accumulate in real time as your referred users trade. You can claim them anytime from the referral dashboard, and they are credited directly to your perp account. No. Every user who reaches the \$10,000 volume threshold can generate a referral link directly from their account dashboard. No application or approval is required. Referral rewards apply for a referred user's first \$1B in trading volume. # Contract Specifications Source: https://docs.hotstuff.trade/hotstuff-docs/trading/contract-specifications Hotstuff perpetual contracts allow users to gain leveraged exposure to crypto assets and tokenized real-world assets (RWAs) without an expiration date. All perpetual markets are settled in USDC and share the same unified margin infrastructure used across the platform. Contract specifications define how positions are margined, settled, funded, and risk-managed. Understanding these parameters is important for evaluating leverage, liquidation risk, and capital efficiency. The table below summarizes the core specifications that apply to Hotstuff perpetual markets. ## Hotstuff Contract Specifications | Specification | Description | Details | | ----------------------- | --------------------------------------------------------- | ---------------------------------------------------------------------------------- | | Contract Type | Type of perpetual contract | Linear perpetual | | Settlement Asset | Asset used for PnL settlement | USDC | | Contract Size | Size per contract | 1 unit of the underlying asset | | Initial Margin (IM) | Margin required to open a position | Determined by selected leverage and market risk parameters | | Maintenance Margin (MM) | Minimum margin required to keep a position open | Defined per market and used for liquidation calculations | | Margin Mode | Position margining model | Cross margin or isolated margin | | Maximum Leverage | Maximum allowable leverage | Up to 50×, depending on market | | Mark Price | Price used for unrealized PnL and liquidation checks | Oracle-informed fair price | | Oracle Price | External reference price | Aggregated from supported price feeds | | Funding | Mechanism used to anchor perpetual prices to spot markets | Periodic funding payments between longs and shorts | | Delivery / Expiration | Contract expiry | None | | Liquidation Engine | Risk management system | Automatic position reduction and liquidation when margin requirements are breached | | Position Settlement | Realization of profits and losses | Continuous USDC settlement through the unified account | | Account Type | Account structure | Unified margin account | | Tradable Assets | Supported markets | Crypto assets and tokenized RWAs, including stocks and commodities | | Trading Hours | Market availability | 24/7, subject to market-specific restrictions | | Order Types | Supported execution methods | Market, limit, stop-loss, take-profit, and conditional orders | Individual markets may have additional parameters such as leverage caps, maintenance margin schedules, funding limits, and liquidity protections. These values are available on each market's specification page. For details on margin calculations, liquidations, funding, mark prices, and risk parameters, refer to the corresponding sections of the documentation. # Deposits & Withdrawals Source: https://docs.hotstuff.trade/hotstuff-docs/trading/deposits-&-withdrawals Hotstuff supports deposits and withdrawals through the Hotstuff Bridge on Ethereum. ## Deposits Deposited assets are credited to your Spot Account and can be transferred or used across supported products within the platform. 1. Navigate to **Wallet → Deposit**. 2. Select the asset and amount. 3. Submit the deposit transaction on Ethereum. 4. Wait for the transaction to be finalized. 5. Funds are credited to your Spot Account. Hotstuff does not charge deposit fees. Users are responsible for Ethereum network gas costs. *** ## Withdrawals Withdrawals transfer assets from your Hotstuff account back to Ethereum through the Hotstuff Bridge. | Item | Details | | ----------------- | --------------- | | Network | Ethereum | | Withdrawal Fee | 1.5 USDC | | Processing Method | Hotstuff Bridge | Assets must be available in your Spot Account before they can be withdrawn. Assets locked in open orders, used as collateral, or otherwise unavailable cannot be withdrawn until they are released. Withdrawal processing times may vary depending on Ethereum network conditions and bridge activity. # Fees Source: https://docs.hotstuff.trade/hotstuff-docs/trading/fees # Volume Tracking Hotstuff L1 tracks your 14 day as well as 30 day rolling volumes across all markets which are assessed at the end of each day in UTC. **Total Volume Formula** ``` Total Volume = Perp Volume + 2 × Spot Volume + 2 × Stable-Spot Volume ``` # Fee Tiers Fee Tiers are based on a users 14-day rolling total volumes. ### Perps | Tier | 14d Weighted Volume (\$) | Taker Fee | Maker Fee | | -------- | ------------------------ | --------- | --------- | | Standard | 0 - 1M | 0.025% | -0.002% | | VIP 1 | >1M | 0.024% | -0.0025% | | VIP 2 | >5M | 0.023% | -0.003% | | VIP 3 | >20M | 0.022% | -0.0035% | | VIP 4 | >100M | 0.021% | -0.005% | | VIP 5 | >250M | 0.020% | -0.007% | | VIP 6 | >500M | 0.020% | -0.014% | ### Perp Maker Rebate Tiers | Tier | % of Perp Maker Volumes (14 day rolling) | Rebate | | ---- | ---------------------------------------- | ------- | | 0 | >2.5% | -0.010% | | 1 | >5% | -0.011% | | 2 | >7.5% | -0.012% | | 3 | >10% | -0.013% | For Makers, who qualify for the above fee rebates, exact fee is determined by the following formula: ``` min(rebate_tier, maker_fee_tier_rate) ``` All rebates are credited directly to the account balance on each trade. # Funding Rates Source: https://docs.hotstuff.trade/hotstuff-docs/trading/funding-rates # Overview Funding rates for perpetual future contracts are a mechanism to ensure the price of the contract stays close to the underlying asset's price. When the funding rate is positive, long position holders pay funding to the short position holders; when the funding rate is negative, short position holders pay funding to the long position holders. ### Funding Interval Hotstuff charges hourly funding payments. There are no fees on funding payments. To aid readability the funding rate is expressed as an 8-hour interest rate. All the funding payments are transferred between the holders of the perpetual contracts. This makes the funding a zero-sum game, where longs receive all funding from shorts, or shorts receive all funding from longs. Funding rates are designed to prevent large price disparities between the perpetual contract and the underlying asset. When the funding rate is high, it can incentivize traders to take the opposite position and help to bring the contract's price closer to the spot price of the underlying asset. ### Funding payments For a user with an open perpetual position, the exact funding payment is calculated as follows: ``` Funding payment = position_size * oracle_price * funding_rate ``` where `oracle_price` is underlying asset's spot index price. ### Funding Rate Calculations ``` impact_price_difference = max(impact_bid_px - index_price, 0) - max(index_price - impact_ask_px, 0) premium = impact_price_difference / index_price interestRate_8Hours = 0.01% interestRate_Hour = 0.00125% clampLimit = 0.05% Funding Rate (8 hour) = time_weighted_avg_premium(P) + clamped(interest - Premium) Funding Rate (Hourly) = Funding Rate (8 hour) / 8 ``` where, * `time_weighted_avg_premium` is the Average Premium Index (P) * `impact_bid_px` is the avg execution price for a buy order of size `impact_notional_usd` * `impact_ask_px` is the avg execution price for a sell order of size `impact_notional_usd` * `impact_notional_usd` is an instrument specific risk parameter ### Funding Rate Caps Further caps on Funding rates are enforced on a per-instrument basis. # Index Price Source: https://docs.hotstuff.trade/hotstuff-docs/trading/index-price Hotstuff aggregates prices from CEXs, DEXs, and on-chain oracles to compute accurate index prices. The aggregation process is designed to remain resilient to exchange outages, stale data, and abnormal price deviations. Current price sources include Binance, Bybit, Gate.io, Hyperliquid, Kraken, KuCoin, MEXC, OKX, and Pyth Network. Each source is assigned a protocol-defined weight. Weights are maintained by the protocol and may differ between assets. *** ## Calculation Process ### 1. Price Collection The oracle service collects index prices from all available sources for a given asset. Invalid values, including zero, NaN, or unavailable prices, are discarded before aggregation. ### 2. Outlier Filtering If three or more valid sources are available, Hotstuff applies Median Absolute Deviation (MAD) filtering. The process: 1. Compute the median price. 2. Measure each source's deviation from the median. 3. Compute the median deviation. 4. Remove sources exceeding the configured MAD threshold. Example: | Source | Price | | ---------- | ------ | | Binance | 100.00 | | Bybit | 100.10 | | OKX | 99.95 | | Kraken | 100.05 | | Exchange X | 115.00 | Median Price = 100.05 `Exchange X` is identified as an outlier and excluded from the calculation. ### 3. Weighted Median Aggregation The remaining sources are aggregated using a weighted median. | Source | Price | Weight | | ------- | ------ | ------ | | Binance | 100.00 | 40% | | Bybit | 100.10 | 25% | | OKX | 99.95 | 20% | | Kraken | 100.05 | 15% | Sources are sorted by price and accumulated by weight. The first price where cumulative weight exceeds 50% becomes the final Index Price. # Liquidations Source: https://docs.hotstuff.trade/hotstuff-docs/trading/liquidations Liquidations on Hotstuff L1 occur when a trader's account equity falls below the maintenance margin. All liquidation positions are first attempted to be entirely closed by sending market orders to the orderbook. These orders can either be for the full position or for a portion of it's size in case on incremental liquidations. In case of multiple positions, liquidation occur only until maintenance margin requirements are met, leaving remaining positions and collateral intact. ## Backstop Liquidations If a trader's positions cannot be fully closed through the orderbook, and their account equity falls below two-thirds of the required maintenance margin, backstop liquidation is initiated using HLV's Liquidator sub-vaults. For cross margin positions, backstop liquidation results in all of the trader's cross positions and cross margin being transferred to the liquidator. If the trader holds no isolated positions, this will leave their account equity at zero. For isolated margin positions, only the specific isolated position and its corresponding margin are transferred to the liquidator. The trader’s remaining cross margin and other positions remain unaffected. During a backstop liquidation, the maintenance margin is not returned to the trader. This margin acts as a buffer, ensuring that the liquidator vault can perform backstop liquidations profitably on average. To avoid losing their maintenance margin, traders should consider placing stop loss orders or exiting positions before the mark price approaches the liquidation threshold. Note that positions in isolated-only perpetual markets are not backstopped and proceed direct to ADL. ## Auto Deleveraging (ADL) Auto-deleveraging (ADL) is a critical mechanism that guarantees the ongoing solvency of the platform. When a user's overall account equity or the value of an isolated position drops below zero, the system intervenes to prevent bad debt. ADL may also be triggered if the backstop vault lacks sufficient capital to take over a user's cross or isolated positions. In such scenarios, traders with opposite positions are prioritized for ADL based on their unrealized profit and loss as well as the amount of leverage they are using. These prioritized traders will have their positions automatically closed at the prior mark price, offsetting the loss from the underwater account. This process ensures that losses are contained and not absorbed by the platform itself, thereby eliminating the risk of bad debt. ADL acts as the platform's final layer of protection for system solvency. Importantly, the system guarantees that users without open positions will never be required to share in or cover any platform losses under any circumstances. # Margin & Leverage Source: https://docs.hotstuff.trade/hotstuff-docs/trading/margin-&-leverage Hotstuff enables users to trade either in a cross-margin mode or isolated margin mode. All Positions in cross-margin share the same collateral whereas positions in isolated margin mode have their collateral constrained to their respective position only. Liquidation of an isolated position does not affect a user's other isolated positions or their cross margin positions. Some perp markets operate in isolated-only mode where only isolated margin is allowed. Further isolated-only markets do not allow users to remove margin from their positions. ### Initial Margin Initial margin is the margin required to open a position and cannot be withdrawn for cross margin positions. Isolated margin positions support adding and removing margin after the position is opened. ``` IM = position size * mark price / leverage ``` The leverage of position is an integer and can be set by a user to any value between 1 and the max leverage. Max leverage of a perp instrument can vary according to the instrument as well a user's margin tier. ### Maintenance Margin Maintenance Margin is the total margin required to keep position(s) open. ``` MM = position size * mark price / ( 2* max_leverage) ``` # Mark Price Source: https://docs.hotstuff.trade/hotstuff-docs/trading/mark-price The Mark Price is the fair reference price used by Hotstuff for unrealized P\&L, margin calculations, and liquidations. It is derived from multiple market data sources and pricing safeguards to provide a robust estimate of market value while reducing the impact of temporary price dislocations, low liquidity, and manipulation attempts. Hotstuff determines the Mark Price using a mark-to-market model based on: * Index Price * Hotstuff order book data * External perpetual market prices To reduce short-term noise, Hotstuff computes a 150-second EMA of the difference between the market mid price and the Index Price. This allows the Mark Price to follow sustained market movements while filtering temporary dislocations. The final Mark Price is derived from multiple independent pricing signals and bounded around the Index Price to prevent excessive deviations during periods of low liquidity or heightened volatility. *** ### Trading Bandwidth Trades are restricted to a predefined price band around the fair market price. For most markets, the bandwidth is calculated using the Index Price and the 150-second EMA of the difference between the market mid price and the Index Price. The resulting trading range is bounded by a maximum deviation of ±7.5% from the Index Price. For specific asset classes: * RWA Markets: ±3% from the Index Price * Pre-IPO Markets: ±20% from the Index Price Orders outside the allowed Trading Bandwidth will be rejected. # Order Types Source: https://docs.hotstuff.trade/hotstuff-docs/trading/order-types Hotstuff L1 currently supports the following order types: * **Limit Orders**: executed only at specified limit price or better * **Market Orders**: executed immediately at the current market price Support for additional order types is planned and will be documented here as they are made available. ## Execution options ### Time In Force (TIF) * **GTC**: Good-Till-Cancel * **IOC**: Immediate-or-Cancel ### Post-only Post-only orders don't execute immediately but rather get added to the orderbook for future execution as a maker. Incoming Post-only orders which may be executed immediately are cancelled. ### Reduce-only Reduce-only orders only execute if they reduce an existing open position as opposed to opening a new position in the opposite direction. ## TP/SL orders Hotstuff currently supports placing TP/SL orders tied to open positions. These orders by default are reduce-only and can further be either limit or market orders depending on if a trigger price is set. # Overview Source: https://docs.hotstuff.trade/hotstuff-docs/trading/overview Hotstuff provides access to perpetual futures and spot markets through a unified margin account. Users can manage positions across both products from a single balance without moving funds between separate trading accounts. The platform focuses on tokenized real-world assets (RWAs), including stocks, commodities, and other traditional financial instruments represented on-chain, alongside crypto-native assets. Perpetual and spot markets share the same account infrastructure, margin system, and settlement asset. More than 22 perpetual markets are currently available. Spot markets are quoted against USDC and include both crypto assets and tokenized RWAs. | | Perpetuals | Spot | | ---------- | -------------------------------- | ------------------- | | Instrument | Linear contracts settled in USDC | Base asset vs. USDC | | Margin | Cross or isolated | Cross only | | Leverage | 3x–50x, depending on market | 1x | All trading activity is settled and collateralized through the user's unified account, allowing balances, unrealized PnL, and available margin to be managed from a single portfolio view. **Detailed Pages:** * [Contract Specifications](/hotstuff-docs/trading/perps) * [Robust Price Indices](/hotstuff-docs/trading/index-price) * [Order Types](/hotstuff-docs/trading/order-types) * [Margin & Leverage](/hotstuff-docs/trading/margin-&-leverage) * [Funding Rates](/hotstuff-docs/trading/funding) * [Trading Fees](/hotstuff-docs/trading/fees) * [Liquidations](/hotstuff-docs/trading/liquidations) * [Spot Trading](/hotstuff-docs/trading/spot-trading) * [Deposits & Withdrawals](/hotstuff-docs/trading/deposits-&-withdrawals) # Spot Trading Source: https://docs.hotstuff.trade/hotstuff-docs/trading/spot-trading Hotstuff powers spot markets where underlying assets can be directly deposited and withdrawn. Only assets in a user's spot account are tradeable on the spot orderbooks. ### Stable Spot markets Spot markets where both the base and quote assets are highly correlated are termed as stable spot markets. Examples of such markets include, but are not limited to, USDT/USDC, wstETH/ETH, cbBTC/wBTC. # account_summary Source: https://docs.hotstuff.trade/wss/accounts/account-summary Subscribe to real-time user account summary updates. Account-specific channel. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "account_summary", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "account_summary@0x42C183edba036906447372a7c81Eb89D0B9f2175", "data": { "address": "0x42C183edba036906447372a7c81Eb89D0B9f2175", "margin_mode": "cross", "multi_asset_mode": false, "hedge_mode": false, "spot_collateral": { "USDC": { "balance": 2250.2685305, "withdrawable_balance": 2250.2685305 }, "USDT": { "balance": 2881.2922, "withdrawable_balance": 2881.2922 } }, "collateral": { "USDC": { "balance": 1577.138734, "withdrawable_balance": 1542.074016 } }, "vault_balances": { "0xdE66c594AF8e4AD2C62DcFadCb6714F8b176A4ef": { "withdrawable_shares": 0.000002, "total_shares": 0.000002, "amount": 1.3209 } }, "staked_collateral": 0, "perp_positions": { "TSLA-PERP": { "position_type": "oneWay", "legs": [ { "instrument_id": 10, "instrument_name": "TSLA-PERP", "side": "BOTH", "size": 0.833, "entry_price": 420, "leverage": { "type": "isolated", "value": 10 }, "position_value": 349.86 } ], "liquidation_price": 399, "mm": 17.571718, "im": 35.064718, "upnl": 2.74057 } }, "initial_margin_utilization": 0, "maintenance_margin_utilization": 0, "upnl": 2.74057, "total_account_equity": 6706.98644984, "margin_balance": 1542.074016, "initial_margin": 0, "maintenance_margin": 0, "total_volume": 21961028, "total_pnl": 50252.231826, "available_balance": 1542.074016, "withdrawable_balance_notional": 1542.074016, "transfer_margin_req": 0, "max_drawdown": 0.417427, "spot_account_equity": 5129.84771584, "derivative_account_equity": 1577.138734, "spot_volume": 3502, "perp_volume": 39187 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "account_summary", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "account_summary", user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # fills Source: https://docs.hotstuff.trade/wss/accounts/fills Subscribe to real-time user fill updates. Account-specific channel. **WebSocket URL:** `wss://api.hotstuff.trade/ws` **Channel:** `fills` ## Parameters | Parameter | Type | Required | Description | Example | | --------- | ------ | -------- | ------------------------------- | ---------------------------------------------- | | `jsonrpc` | string | Yes | JSON-RPC version | `"2.0"` | | `id` | string | Yes | Request identifier for tracking | `"1"` | | `method` | string | Yes | Action to perform | `"subscribe"` or `"unsubscribe"` | | `channel` | string | Yes | Channel name | `"fills"` | | `user` | string | Yes | User wallet address | `"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"` | ## Supported Methods * `subscribe` - Subscribe to user fill updates * `unsubscribe` - Unsubscribe from user fill updates ## Authentication This endpoint requires a valid user wallet address to receive account-specific fill updates. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "fills", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "fills@0x42C183edba036906447372a7c81Eb89D0B9f2175", "data": { "instrument_id": 1, "instrument": "BTC-PERP", "account": "0x42C183edba036906447372a7c81Eb89D0B9f2175", "order_id": 172559639, "cloid": "58172def-5a81-408f-88a0-329b6e482b15", "trade_id": 5110687635023935944, "side": "b", "position_side": "BOTH", "price": 67977, "size": 0.05113, "closed_pnl": 0.069513, "direction": "openLong", "original_size": 0.00545, "original_price": 67977, "fee": -0.069513, "broker_fee": 0, "fee_token_id": 1, "crossed": false, "tx_hash": "0x55cbd08b1249771a68e83e0a70330ab95c1fc7b46034068de9ad7f38ce12200a", "block_timestamp": 1770854228441, "fill_type": 2 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "fills", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "fills", user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # funding Source: https://docs.hotstuff.trade/wss/accounts/funding Subscribe to real-time funding events. **WebSocket URL:** `wss://api.hotstuff.trade/ws` **Channel:** `fundingPayments` ## Parameters | Parameter | Type | Required | Description | Example | | --------- | ------ | -------- | ------------------------------- | ---------------------------------------------- | | `jsonrpc` | string | Yes | JSON-RPC version | `"2.0"` | | `id` | string | Yes | Request identifier for tracking | `"1"` | | `method` | string | Yes | Action to perform | `"subscribe"` or `"unsubscribe"` | | `channel` | string | Yes | Channel name | `"fundingPayments"` | | `user` | string | Yes | User wallet address | `"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"` | ## Supported Methods * `subscribe` - Subscribe to user order updates * `unsubscribe` - Unsubscribe from user order updates ## Authentication This endpoint requires a valid user wallet address to receive account-specific order updates. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "fundingPayments", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "fundingPayments", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "fundingPayments", user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # orders Source: https://docs.hotstuff.trade/wss/accounts/orders Subscribe to real-time user order status updates. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "orders", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "orders@0x42C183edba036906447372a7c81Eb89D0B9f2175", "data": { "instrument_id": 1, "instrument": "BTC-PERP", "account": "0x42C183edba036906447372a7c81Eb89D0B9f2175", "tif": "GTC", "order_id": 172561523, "cloid": "69901641-e0ad-47eb-80bf-f285321f5bd0", "side": "b", "position_side": "BOTH", "limit_price": "67977", "size": "0.06107", "old_price": "67977", "old_size": "0.06107", "unfilled": "0.05737", "state": "open", "reduce_only": false, "post_only": false, "timestamp": 1770854411081 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "orders", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "orders", user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # positions Source: https://docs.hotstuff.trade/wss/accounts/positions Subscribe to real-time user position updates. Account-specific channel. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "positions", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "positions@0x42C183edba036906447372a7c81Eb89D0B9f2175", "data": { "account": "0x42C183edba036906447372a7c81Eb89D0B9f2175", "instrument_id": 10, "instrument": "TSLA-PERP", "position_type": "oneWay", "old_position": { "size": 0.833, "entry_price": 420 }, "position_side_updated": "BOTH", "realized_pnl": 0, "legs": [ { "side": "BOTH", "size": 0.833, "entry_price": 420, "leverage": { "type": "isolated", "value": 10, "margin": "53.477383" }, "position_value": 349.86 } ], "block_timestamp": 1770853898179 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "positions", "user": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "positions", user: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # Introduction Source: https://docs.hotstuff.trade/wss/getting-started/introduction WebSocket connection setup, limits, and error handling. ## Endpoints | Environment | URL | | ----------- | ------------------------------------- | | Mainnet | `wss://api.hotstuff.trade/ws` | | Testnet | `wss://testnet-api.hotstuff.trade/ws` | ## Limits | Limit | Value | | --------------------------- | :-------: | | Connections per IP | 100 | | Subscriptions per IP | 1,000 | | Inbound messages per minute | 2,000 | | Max message size | 512 bytes | ## Message Buffering Each client has a **256-message outbound buffer**. When the buffer fills (slow consumer), new messages are **dropped silently**—the connection remains open with no error sent. Slow clients will miss data without warning. Process messages promptly to avoid gaps. ## Rate Limiting Exceeding 2,000 inbound messages/min triggers a JSON-RPC error. The connection stays open: ```json theme={null} { "jsonrpc": "2.0", "id": "1", "error": { "code": -32001, "message": "Message rate limit exceeded", "data": { "retry_after": 12 } } } ``` The `retry_after` field indicates seconds to wait before sending more messages. ## JSON-RPC `post` Methods (Info + Exchange) In addition to subscriptions, WebSocket supports request-response calls through: * `method: "post"` * `params.type: "info"` for all Info REST endpoints * `params.type: "action"` for all Exchange REST endpoints The payload format mirrors the REST API reference methods and params. See the WSS section **Info + Exchnage Requests** for separate interactive pages: * `Info Requests` * `Action Requests` ## Error Codes | Code | Name | Description | | :----: | ----------------- | ---------------------- | | -32700 | Parse Error | Invalid JSON | | -32600 | Invalid Request | Malformed JSON-RPC 2.0 | | -32601 | Method Not Found | Unknown method | | -32602 | Invalid Params | Bad method parameters | | -32603 | Internal Error | Server-side failure | | -32000 | Server Error | Generic server error | | -32001 | Too Many Requests | Rate limit exceeded | # Timeout & Heartbeats Source: https://docs.hotstuff.trade/wss/getting-started/timeout-and-heartbeats The server closes idle connections after **60 seconds** of inactivity. This page explains how heartbeats work and how to handle disconnections. ## Heartbeat The server sends a WebSocket **Ping frame every 30 seconds**. Clients must respond with a Pong within **60 seconds** or the connection is terminated. ``` Server Client | | |-------- Ping frame ------------>| every 30s |<------- Pong frame -------------| automatic in most libraries | | | [60s timer resets] | | | |-------- Ping frame ------------>| 30s later | | | [No Pong within 60s?] | | [Connection closed] | ``` | Timing | Value | | --------------------- | :---: | | Ping interval | 30s | | Pong timeout | 60s | | Server write deadline | 10s | Most WebSocket libraries respond to Pings automatically (`gorilla/websocket`, `ws`, `websocket-client`, etc.). No manual implementation required. ## Application-Level Ping Send a JSON-RPC ping to verify connectivity and retrieve server time. Useful for latency checks or confirming the connection is healthy. This does **not** reset the 60-second timeout. Only the protocol-level Pong does that. ```json Request theme={null} { "jsonrpc": "2.0", "id": "1", "method": "ping" } ``` ```json Response theme={null} { "jsonrpc": "2.0", "id": "1", "result": { "timestamp": "2026-02-15T12:00:00.000Z" } } ``` ## Reconnection The server does not persist session state. When a connection drops, all subscriptions are cleared. Clients must reconnect and resubscribe. **Recommended strategy:** Use exponential backoff (1s → 2s → 4s → 8s, max 30s), then resubscribe to all channels. # bbo Source: https://docs.hotstuff.trade/wss/global/bbo Subscribe to real-time best bid and offer (BBO) data showing top-of-book prices and sizes. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "bbo", "symbol": "BTC-PERP" // support "all" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "bbo:BTC-PERP", "data": { "symbol": "BTC-PERP", "best_bid_price": 67738, "best_ask_price": 67741, "best_bid_size": 0.00273, "best_ask_size": 0.01499 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "bbo", "symbol": "BTC-PERP" # or "all" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "bbo", symbol: "BTC-PERP", // or "all" }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # chart Source: https://docs.hotstuff.trade/wss/global/chart Subscribe to real-time OHLCV chart data with configurable resolution and chart type for technical analysis. ## Chart Types * `mark` - Mark price data * `index` - Index price data * `ltp` - LTP price data ## Resolutions * `1`, `5`, `15`, `30` - Minute intervals (1, 5, 15, 30 minutes) * `60`, `240` - Hour intervals (1 hour, 4 hours) * `1D`, `1W` - Day/week intervals ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "chart", "symbol": "1", "chart_type": "mark", "resolution": "1" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "chart:1:index:1", "data": { "time": 1770860580000, "open": "67965.20189", "high": "67965.20189", "low": "67951.616513", "close": "67951.616513", "volume": "0.0029" } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "chart", "symbol": "1", "chart_type": "mark", "resolution": "1" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "chart", symbol: "1", chart_type: "mark", resolution: "1", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # explorer Source: https://docs.hotstuff.trade/wss/global/explorer Subscribe to real-time blockchain explorer data including block information, transactions, and network activity. ## Channel Types Subscribe to either `"blocks"` or `"transactions"` channel: * **blocks** - Block information including block height, hashes, transaction count, and timestamps * **transactions** - Transaction details including transaction hash, account, block information, transaction type, success status, and timestamps ## Example Request Subscribe to blocks: ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "blocks" } } ``` Subscribe to transactions: ```json theme={null} { "jsonrpc": "2.0", "id": "2", "method": "subscribe", "params": { "channel": "transactions" } } ``` ## Example Response ### Blocks Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "blocks", "data": { "block_height": 49639461, "block_hash": "0xf2908f4abba7dc26d394f559c63b12afa57904b9f71861eabbf30c63937e605a", "parent_hash": "0x95df533b6322f5546df823862cdd69569871b974415b80d5eebdd0023fceaee8", "change_log_hash": "0x12792f5ad322c03de737e3838720a0e5b8bfc7376cb332221f0389409378fab9", "timestamp": 1770860677971, "tx_count": 4, "created_at": 1770860678 } } } ``` ### Transactions Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "transactions", "data": { "tx_hash": "0x37c59f8a124919fe7fd2ad96d574bb800a3653fdde0b7ca180443c4ba208b1cf", "account": "0x2daABa67B7c0eA90668f5eE2FB21CaA30D6bD62A", "block_height": 49641126, "block_hash": "0x9c380e17843da4a03e14c0ac39748f02a63f0d4753f03ec74943263eacd8354e", "tx_type": 1302, "success": true, "timestamp": 1770860765391, "created_at": 1770860765 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): # Subscribe to blocks subscribe_blocks = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "blocks" } } ws.send(json.dumps(subscribe_blocks)) # Subscribe to transactions subscribe_txs = { "jsonrpc": "2.0", "id": "2", "method": "subscribe", "params": { "channel": "transactions" } } ws.send(json.dumps(subscribe_txs)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { // Subscribe to blocks const subscribeBlocks = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "blocks", }, }; ws.send(JSON.stringify(subscribeBlocks)); // Subscribe to transactions const subscribeTxs = { jsonrpc: "2.0", id: "2", method: "subscribe", params: { channel: "transactions", }, }; ws.send(JSON.stringify(subscribeTxs)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # mids Source: https://docs.hotstuff.trade/wss/global/mids Subscribe to real-time mid prices (average of best bid and ask) for trading instruments. ## Supported Symbols * Individual markets: `BTC-PERP`, `ETH-PERP`, etc. * All markets: `"all"` ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "mids", "symbol": "BTC-PERP" // support "all" or "BTC-PERP" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "mids:BTC-PERP", "data": { "symbol": "BTC-PERP", "mid_price": 67887 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "mids", "symbol": "BTC-PERP" # or "all" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "mids", symbol: "BTC-PERP", // or "all" }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # orderbook Source: https://docs.hotstuff.trade/wss/global/orderbook Subscribe to Level 2 orderbook updates for bids and asks. Each event includes an `update_type` set to either `snapshot` (a full orderbook) or `delta` (only the changes). When you subscribe, you’ll first receive a complete `snapshot` with its `sequence_number`. After that, you’ll get `delta` updates, which only include what’s changed. In a `delta`, any bid or ask with `size: 0` means that price level has been removed. Each `delta` update should have a sequence number that increases by one. If you notice a gap or jump in sequence numbers, you may have missed updates. In that case, resubscribe to ensure your orderbook is accurate. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "orderbook", "symbol": "BTC-PERP" } } ``` ## Example Response The first event received after subscribing is a **snapshot** of the complete orderbook. Subsequent events are **delta** updates that modify the orderbook state. ### Snapshot (First Event) ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "orderbook:BTC-PERP", "data": { "update_type": "snapshot", "books": { "instrument_name": "BTC-PERP", "bids": [ { "price": 63874, "size": 0.0003 } ], "asks": [ { "price": 62761, "size": 0.05 } ], "sequence_number": 11414520, "timestamp": 1770859215981 } } } } ``` ### Delta Updates (Subsequent Events) After the initial snapshot, subsequent events contain delta updates with `"update_type": "delta"` that modify the orderbook state. Apply these deltas to maintain an up-to-date orderbook. ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "orderbook", "symbol": "BTC-PERP" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "orderbook", symbol: "BTC-PERP", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # ticker Source: https://docs.hotstuff.trade/wss/global/ticker Subscribe to real-time ticker data including price, volume, and 24h change for trading instruments. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "ticker", "symbol": "BTC-PERP" // support "all" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "ticker:BTC-PERP", "data": { "instrument_name": "BTC-PERP", "instrument_id": 1, "symbol": "BTC-PERP", "mark_price": 68295, "mid_price": 120000, "index_price": 67631.049159, "best_bid_price": 119999, "best_ask_price": 120001, "best_bid_size": 0.001, "best_ask_size": 0.002, "funding_rate": 0.000012, "volume_24h": 6319.722, "change_24h": 341, "open_interest": 0.093, "max_trading_price": 70344.489513, "min_trading_price": 66246.75226, "premium": 0, "last_price": 119999 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "ticker", "symbol": "BTC-PERP" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "ticker", symbol: "BTC-PERP", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # trades Source: https://docs.hotstuff.trade/wss/global/trades Subscribe to real-time trade executions with price, size, and side information for trading instruments. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "trades", "symbol": "BTC-PERP" } } ``` ## Example Response ```json theme={null} { "jsonrpc": "2.0", "method": "event", "params": { "channel": "trades:BTC-PERP", "data": { "instrument_id": 1, "instrument": "BTC-PERP", "trade_id": 1977789105883768779, "tx_hash": "0x7f3f0051f155a58a9362882ec3fe01162d0c2c3123d32fc87f89ac31ab039c4d", "side": "b", "price": "67804", "size": "0.00303", "maker": "0x14191D72B99Fb42E712360eF518e983e87d551Ec", "taker": "0xeE1c303b69Fe40B74BB7c2408e99C5415928EFcb", "timestamp": 1770859894258 } } } ``` ## WebSocket Client Examples ### Python ```python theme={null} import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_open(ws): subscribe_msg = { "jsonrpc": "2.0", "id": "1", "method": "subscribe", "params": { "channel": "trades", "symbol": "BTC-PERP" } } ws.send(json.dumps(subscribe_msg)) ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws", on_message=on_message, on_open=on_open) ws.run_forever() ``` ### JavaScript ```javascript theme={null} const ws = new WebSocket("wss://api.hotstuff.trade/ws"); ws.onopen = function () { const subscribeMsg = { jsonrpc: "2.0", id: "1", method: "subscribe", params: { channel: "trades", symbol: "BTC-PERP", }, }; ws.send(JSON.stringify(subscribeMsg)); }; ws.onmessage = function (event) { console.log("Received:", event.data); }; ``` # Action Requests Source: https://docs.hotstuff.trade/wss/info-exchnage-requests/action-requests Use JSON-RPC `post` with `params.type: "action"` to call all Exchange/action endpoints from the REST API reference over WebSocket. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": 2, "method": "post", "params": { "type": "action", "payload": { "action": { "data": { "collateralId": 1, "amount": "50", "toDerivativesAccount": false, "nonce": 1774279181328 }, "type": "internalBalanceTransferRequest" }, "signature": "0x22ea3cd743b8c1090ab6987fddfec85d9d9d459e9ca2060295243b0a2065247424b431b6f7bbd60e1f0b0540b1de390c760eb6c518455430fbd64f5ba0451ef11c", "nonce": 1774279181328 } } } ``` # Info Requests Source: https://docs.hotstuff.trade/wss/info-exchnage-requests/info-requests Use JSON-RPC `post` with `params.type: "info"` to call all Info endpoints from the REST API reference over WebSocket. ## Example Request ```json theme={null} { "jsonrpc": "2.0", "id": "1", "method": "post", "params": { "type": "info", "payload": { "method": "instruments", "params": { "type": "all" } } } } ```