{"info":{"_postman_id":"5f8563cf-b364-4ed6-a47e-d2de8e24cf57","name":"Orderbook Public API","description":"<html><head></head><body><p>The Orderbook API enables seamless trading on decentralized cryptocurrency perpetual futures markets, allowing users to place market and limit orders, manage positions, and track trade history with real-time updates for executing advanced strategies efficiently.</p>\n<h2 id=\"general-information\">General Information</h2>\n<ul>\n<li><p>The base endpoint is</p>\n<ul>\n<li>Mainnet: <a href=\"https://api.happytrading.global/\">https://api.happytrading.global/</a></li>\n</ul>\n</li>\n<li><p>Timestamp are format as Unix Timestamp in millisec unit</p>\n</li>\n<li><p>Default Rate Limit: 50 request per second</p>\n</li>\n<li><p>All GET endpoint are public and does not require any authentication</p>\n</li>\n</ul>\n<h2 id=\"standard-response\">Standard Response</h2>\n<p>All response will return in the following format for success response</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"code\": 200,\n  \"message\": \"Some message\",\n  \"data\": {},\n  \"timedtamp\": 1739166143822763 // server timestamp in microsecond\n}\n\n</code></pre>\n<h2 id=\"error-response\">Error Response</h2>\n<p>All error response will return in the following format</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">{\n  \"code\": 40x,\n  \"message\": \"Some error message\"\n  \"errors\" : \"\" // optional\n}\n\n</code></pre>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"38613004","collectionId":"5f8563cf-b364-4ed6-a47e-d2de8e24cf57","publishedId":"2sAXxTcWCf","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FFA500"},"publishDate":"2025-02-18T05:32:15.000Z"},"item":[{"name":"Authentication","item":[{"name":"Deposit / Withdraw","item":[],"id":"ba018b04-8165-4d65-9a94-506ad6224740","description":"<p>Deposit and Withdrawal need to be done via smart contract call.</p>\n<h2 id=\"contract-address\">Contract Address</h2>\n<ul>\n<li>Vault Contract : 0x395c7f20bc6f38dfc644aa1a4023dc47d6939481</li>\n</ul>\n<h2 id=\"deposit\">Deposit</h2>\n<ul>\n<li><p>call deposit function at Vault contract</p>\n<ul>\n<li><code>function deposit(address _tokenAddress, bytes32 _subaccount, uint256 _amount);</code></li>\n</ul>\n</li>\n<li><p>Wait for our off-chain sequencer to process the deposit request</p>\n</li>\n<li><p>Once the deposit request is processed, call GET Subaccount Summary to confirm the collateral balance</p>\n</li>\n</ul>\n<h2 id=\"withdrawal\">Withdrawal</h2>\n<ul>\n<li><p>call withdrawal function at Vault contract</p>\n<ul>\n<li><code>function withdraw(address _tokenAddress, bytes32 _subaccount, uint256 _amount);</code></li>\n</ul>\n</li>\n<li><p>Wait for our off-chain sequencer to process the withdrawal request</p>\n</li>\n<li><p>Once the withdrawal request is processed, the token will be transfered back to the wallet owner</p>\n</li>\n</ul>\n","_postman_id":"ba018b04-8165-4d65-9a94-506ad6224740"},{"name":"Generate JWT Token","event":[{"listen":"test","script":{"id":"005cff95-8fb7-4192-9495-268d85d2f60c","exec":[""],"type":"text/javascript","packages":{}}}],"id":"0c0fe5c1-2795-419c-b9cf-e9a812e3a422","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"account\": \"<string>\",\n    \"subaccount_id\": \"<string>\",\n    \"signature\": \"<string>\",\n    \"nonce\": \"<string>\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v2/auth/evm","description":"<p>Generate JWT token by signing a pre-format message. The JWT token is required to trade via API</p>\n<h2 id=\"parameters\">Parameters</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Name</strong></th>\n<th>Type</th>\n<th><strong>Mandator</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>account</td>\n<td>String</td>\n<td>Yes</td>\n<td>The wallet address of account</td>\n</tr>\n<tr>\n<td>subaccount_id</td>\n<td>String</td>\n<td>Yes</td>\n<td>Index of subaccount e.g. 1,2,3</td>\n</tr>\n<tr>\n<td>signature</td>\n<td>String</td>\n<td>Yes</td>\n<td>The signature of the pre-formated message</td>\n</tr>\n<tr>\n<td>nonce</td>\n<td>String</td>\n<td>Yes</td>\n<td>A random string that can only be used once per subaccount</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"path":["v2","auth","evm"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"fad1ae6c-6d52-4b51-b495-15aa75da8c68","name":"Generate JWT Token","originalRequest":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n    \"account\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE\",\n    \"subaccount_id\": \"1\",\n    \"signature\": \"0x1923473151311d052245afffd5101ad6ac68675164ee592c1c70c64bebae3087742d9815154bb0c2ce1d4f3f81cee6dbf7e3c55dde01b8f3c124c7fe79269ca41b\",\n    \"nonce\": \"1909267642088790814\"\n} ","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/v2/auth/evm"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"generate JWT success\",\n    \"data\": {\n        \"jwt\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJobXgiOiIxMDBkb2xsYXIifQ.eAkANxKyGK76R1ZM2AYoj_4lfF8d4fIdQHTA3sOx2ns\"\n    },\n    \"timestamp\": 1739168105871471\n}"}],"_postman_id":"0c0fe5c1-2795-419c-b9cf-e9a812e3a422"}],"id":"e79555d1-2624-4d44-8a29-3928f3a90c70","description":"<h2 id=\"jwt-auth-token-generation\">JWT Auth Token Generation</h2>\n<p>Follow the following step to generate JWT for the subaccount</p>\n<ol>\n<li><p>Generate a signature from the following message format using <a href=\"https://eips.ethereum.org/EIPS/eip-191\">https://eips.ethereum.org/EIPS/eip-191</a><br /> <em><strong>Please make sure the ${wallet_address} is in lower case.</strong></em></p>\n<ol>\n<li><p><code>generate jwt for ${wallet_address} and subaccount id ${subaccount_id} to trade on happytrading.global with nonce: ${nonce}`</code></p>\n<ol>\n<li>Example \"generate jwt for 0x0000000000000000000000000000000000000000 and subaccount id 0 to trade on happytrading.global with nonce: 1821047342528140023\"</li>\n</ol>\n</li>\n<li><p><code>nonce</code> generation can be found in the below section</p>\n</li>\n</ol>\n</li>\n<li><p>Call the auth endpoint to get JWT token</p>\n</li>\n</ol>\n<h2 id=\"signature-generation\">Signature Generation</h2>\n<ul>\n<li>The elliptic curve, secp256k1</li>\n</ul>\n<h2 id=\"nonce-generation-example\">Nonce Generation Example</h2>\n<ul>\n<li><p>Nonce are generated in the following format</p>\n<ul>\n<li><p>timestamp_ms(44 bit) + random_number(20 bit)</p>\n<ul>\n<li><p>Most significant <code>44</code> bits encoding the time in milliseconds (a <code>recv_time</code>) after which the order will be rejected</p>\n</li>\n<li><p>Least significant <code>20</code> bits are a random integer used to order being replayed</p>\n<p>  For example, to place an order with a random integer of 1234, and a discard time 100 ms from now, we would send a nonce of <code>((timestamp_ms() + 100) &lt;&lt; 20) + 1234)</code></p>\n</li>\n</ul>\n</li>\n<li><p>Example,</p>\n<ul>\n<li><p>timestamp_ms = 1736686079528</p>\n</li>\n<li><p>timestamp_ms &lt;&lt; 20 = 1821047342527152128</p>\n</li>\n<li><p>random_number = 987895</p>\n</li>\n<li><p>nonce = 1821047342527152128 + 987895 = 1821047342528140023</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"subaccount-generation\">Subaccount Generation</h2>\n<p>Our protocol operates on subaccount in stead of account.</p>\n<p>Subaccount is expressed as follow</p>\n<ul>\n<li><p>subaccount is 32 bytes that consist of account + subaccountId</p>\n<ul>\n<li><p>account: The wallet address (20 bytes)</p>\n</li>\n<li><p>subaccount: Any number from 0 to maximum off 12 bytes.</p>\n</li>\n</ul>\n</li>\n</ul>\n","_postman_id":"e79555d1-2624-4d44-8a29-3928f3a90c70"},{"name":"Order Management","item":[{"name":"Place New Order","id":"b5271149-1e16-4c02-93b5-2813706de9d8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"<string>\", // Market Symbol\n    \"broker_id\": \"<string>\", // Broker ID\n    \"subaccount\": \"<string>\", // Subaccount\n    \"amount\": \"<string>\", // Amount of contract to trade\n    \"price\": \"<string>\",  // Price of the order\n    \"side\": \"<string>\", // LONG | SHORT\n    \"order_type\": \"Limit\", // \"Limit\" | \"Market\", \"Stop\", \"StopMarket\", \"TakeProfitMarket\"\n    \"time_in_force\": \"GTC\", // \"GTC\" | \"IOC\" | \"FOK\" | \"PostOnly\"\n    \"nonce\": \"<long>\", // Timestamp + random number\n    \"trigger_price\": \"<string>\", // For Stop , StopMarket, TakeProfitMarket order types\n    \"reduce_only\": \"<boolean>\", // Use this order for reducing position only\n    \"wait_for_reply\": false, // Wait for order to match, send false for lower latency \n    \"client_order_id\": \"my-id-1\" // Custom Order Id\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/place-order","description":"<p>The Place New Order endpoint enables users to create a new order in the perpetual futures market. Users can choose between different order types—such as market, limit, stop, or conditional orders—by specifying relevant parameters, including market pair, price, quantity, and side (buy or sell). Additional options like time-in-force (e.g., Good Till Canceled, Immediate or Cancel) and post-only flags can be set to fine-tune the order behavior according to specific trading strategies.</p>\n<h2 id=\"parameters\">Parameters</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Name</strong></th>\n<th>Type</th>\n<th><strong>Mandator</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>broker_id</td>\n<td>String</td>\n<td>Yes</td>\n<td>example: DESK</td>\n</tr>\n<tr>\n<td>subaccount</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>amount</td>\n<td>String</td>\n<td>Yes</td>\n<td>Decimal point e.g. 10.200</td>\n</tr>\n<tr>\n<td>price</td>\n<td>String</td>\n<td>Yes</td>\n<td>Decimal point e.g. 60000.00. For Market Order, send price \"0\"</td>\n</tr>\n<tr>\n<td>order_type</td>\n<td>ENUM</td>\n<td>Yes</td>\n<td>\"Limit\" , \"Market\", \"Stop\", \"StopMarket\", \"TakeProfit\", \"TakeProfitMarket\"</td>\n</tr>\n<tr>\n<td>side</td>\n<td>String</td>\n<td>Yes</td>\n<td>\"Long\" , \"Short\"</td>\n</tr>\n<tr>\n<td>time_in_force</td>\n<td>ENUM</td>\n<td>No</td>\n<td>\"GTC\" , \"IOC\" , \"FOK\" , \"PostOnly\".  <br />  <br />For Market, TakeProfitMarket, and StopMarket Order, do not send this param.</td>\n</tr>\n<tr>\n<td>nonce</td>\n<td>string</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>trigger_price</td>\n<td>string</td>\n<td>No</td>\n<td>For Stop , StopMarket, TakeProfitMarket order types</td>\n</tr>\n<tr>\n<td>reduce_only</td>\n<td>boolean</td>\n<td>no</td>\n<td>Use this order for reducing position</td>\n</tr>\n<tr>\n<td>wait_for_reply</td>\n<td>boolean</td>\n<td>no</td>\n<td>Default: true</td>\n</tr>\n<tr>\n<td>client_order_id</td>\n<td>string</td>\n<td>no</td>\n<td>Alpha Numeric max size 36 characters</td>\n</tr>\n</tbody>\n</table>\n</div><h2 id=\"stop-order--conditional-order\">Stop Order / Conditional Order</h2>\n<ul>\n<li><p>In order to place stop order, send the order type to be</p>\n<ul>\n<li><p>Stop</p>\n</li>\n<li><p>StopMarket</p>\n</li>\n<li><p>TakeProfit</p>\n</li>\n<li><p>TakeProfitMarket</p>\n</li>\n</ul>\n</li>\n<li><p>For Stop and TakeProfit order, trigger_price need to be sent along with the order with the following condition.</p>\n</li>\n</ul>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Order Side</strong></th>\n<th><strong>Order Type</strong></th>\n<th><strong>Trigger Price Criteria</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Long</td>\n<td>Stop / StopMarket</td>\n<td>Mark Price &lt;= Trigger Price</td>\n</tr>\n<tr>\n<td>Short</td>\n<td>Stop / StopMarket</td>\n<td>Mark Price &gt;= Trigger Price</td>\n</tr>\n<tr>\n<td>Long</td>\n<td>TakeProfit / TakeProfitMarket</td>\n<td>Mark Price &gt;= Trigger Price</td>\n</tr>\n<tr>\n<td>Short</td>\n<td>TakeProfit / TakeProfitMarket</td>\n<td>Mark Price &lt;= Triggerprice</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"path":["v2","place-order"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"a4ea5d0a-044b-4464-af62-af45757bcef5","name":"Place New Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"BTCUSD\",\n    \"broker_id\": \"DESK\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"amount\": \"10.00\",\n    \"price\": \"25000.00\",\n    \"side\": \"Long\",\n    \"order_type\": \"Limit\",\n    \"time_in_force\": \"GTC\",\n    \"nonce\": \"1811257020945544621\"\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":{"raw":"{{base_url}}/v2/place-order","host":["{{base_url}}"],"path":["v2","place-order"],"query":[{"key":"","value":null,"type":"text","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"place order success\",\n    \"data\": {\n        \"subaccount\": \"0xead763145cb2c23cf2a0447aabefd8333859e07f000000000000000000000000\",\n        \"symbol\": \"BTCUSD\",\n        \"broker_id\": \"DESK\",\n        \"side\": \"Long\",\n        \"price\": \"60000.00\",\n        \"quantity\": \"1.00\",\n        \"nonce\": \"1811257127598368923\",\n        \"order_type\": \"Limit\",\n        \"time_in_force\": \"GTC\",\n        \"order_digest\": \"0x60f6536f51f92c33303c25f8de75313b2b2babaf5ce3e6b9bd904f231f39ccc7\",\n        \"filled_quantity\": \"0.00\",\n        \"avg_fill_price\": \"0.00\",\n        \"execution_fee\": \"0.01\"\n    },\n    \"timestamp\": 1739168105871471\n}"}],"_postman_id":"b5271149-1e16-4c02-93b5-2813706de9d8"},{"name":"BATCH Place New Order","id":"8765560a-b551-4be4-9825-96e1ed6dde09","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"[\n    {\n        \"symbol\": \"<string>\", // Market Symbol\n        \"broker_id\": \"<string>\", // Broker ID\n        \"subaccount\": \"<string>\", // Subaccount\n        \"amount\": \"<string>\", // Amount of contract to trade\n        \"price\": \"<string>\", // Price of the order\n        \"side\": \"<string>\", // LONG | SHORT\n        \"order_type\": \"Limit\", // \"Limit\" | \"Market\", \"Stop\", \"StopMarket\", \"TakeProfitMarket\"\n        \"time_in_force\": \"GTC\", // \"GTC\" | \"IOC\" | \"FOK\" | \"PostOnly\"\n        \"nonce\": \"<long>\", // Timestamp + random number\n        \"trigger_price\": \"<string>\", // For Stop , StopMarket, TakeProfitMarket order types\n        \"reduce_only\": \"<boolean>\", // Use this order for reducing position only\n        \"wait_for_reply\": false // Wait for order to match, send false for lower latency \n    }\n]","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/batch-place-order","description":"<p>Perform the same function as Place Order endpoint. Traders can send multiple orders for execution to reduce the network round trip time.</p>\n<ul>\n<li>Limit: maximum 20 orders per request</li>\n</ul>\n","urlObject":{"path":["v2","batch-place-order"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"f880b0eb-b563-4b4a-a484-cf96f1d03a38","name":"BATCH Place New Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"[\n    {\n        \"symbol\": \"ETHUSD\",\n        \"broker_id\": \"DESK\",\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n        \"amount\": \"0.05\",\n        \"price\": \"2369.00\",\n        \"side\": \"Long\",\n        \"order_type\": \"Limit\",\n        \"time_in_force\": \"GTC\",\n        \"nonce\": \"1825208168024244161\",\n        \"client_order_id\": \"PLACE-GTC-SUCCESS\"\n    },\n    {\n        \"symbol\": \"ETHUSD\",\n        \"broker_id\": \"DESK\",\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n        \"amount\": \"0.05\",\n        \"price\": \"3000.00\",\n        \"side\": \"Long\",\n        \"order_type\": \"Limit\",\n        \"time_in_force\": \"FOK\",\n        \"nonce\": \"1825208168023652515\",\n        \"client_order_id\": \"Should-Fail-Order\"\n    }\n]","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":{"raw":"{{base_url}}/v2/batch-place-order","host":["{{base_url}}"],"path":["v2","batch-place-order"],"query":[{"key":"","value":null,"type":"text","disabled":true}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": {\n    \"processed_orders\": 2,\n    \"result_orders\": [\n      {\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n        \"symbol\": \"ETHUSD\",\n        \"side\": \"Long\",\n        \"price\": \"2369.60\",\n        \"quantity\": \"0.05\",\n        \"nonce\": \"1825208168024244161\",\n        \"order_type\": \"Limit\",\n        \"time_in_force\": \"GTC\",\n        \"order_digest\": \"0x0000000000000000000000000000000000000000000000000000000001783ba2\",\n        \"filled_quantity\": \"0.00\",\n        \"avg_fill_price\": \"0.00\",\n        \"execution_fee\": \"0.00\",\n        \"client_order_id\": \"PLACE-GTC-SUCCESS\"\n      },\n      {\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n        \"symbol\": \"ETHUSD\",\n        \"side\": \"Long\",\n        \"price\": \"3000.60\",\n        \"quantity\": \"0.05\",\n        \"nonce\": \"1825208168023652515\",\n        \"order_type\": \"Limit\",\n        \"time_in_force\": \"FOK\",\n        \"order_digest\": \"0x0000000000000000000000000000000000000000000000000000000001783ba7\",\n        \"filled_quantity\": \"0.00\",\n        \"avg_fill_price\": \"0.00\",\n        \"execution_fee\": \"0.00\",\n        \"client_order_id\": \"Should-Fail-Order\",\n        \"error_message\": \"FOK rejected\"\n      }\n    ]\n  },\n  \"timestamp\": 1740653852444085\n}"}],"_postman_id":"8765560a-b551-4be4-9825-96e1ed6dde09"},{"name":"Cancel Open Order","id":"d3c6f86f-019e-4893-8ccf-0d0b2f5f363b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"<string>\",\n    \"subaccount\": \"<string>\",\n    \"order_digest\": \"<string>\",\n    \"client_order_id\": \"string>\", // Custom Order Id from client\n    \"nonce\": \"<long>\",\n    \"is_conditional_order\": \"<boolean>\",\n    \"wait_for_reply\": false // Wait for order to match, send false for lower latency \n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/cancel-order","description":"<p>The Cancel Order endpoint allows users to cancel their open orders within the perpetual futures market. By specifying the order ID, users can target a specific order to be canceled. Alternatively, the endpoint supports bulk cancellation, enabling users to cancel all open orders for a particular market or across all markets in a single request. Once a cancellation request is processed, the response will include details such as the status of the cancellation, order digest(s), and any remaining quantities that were not executed. This endpoint is designed to provide fast and efficient order management, allowing users to quickly adapt to changing market conditions.</p>\n<h2 id=\"parameters\">Parameters</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Name</strong></th>\n<th>Type</th>\n<th><strong>Mandator</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>Yes</td>\n<td>Market Symbol</td>\n</tr>\n<tr>\n<td>subaccount</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>order_digest</td>\n<td>String</td>\n<td>No</td>\n<td></td>\n</tr>\n<tr>\n<td>client_order_id</td>\n<td>String</td>\n<td>No</td>\n<td></td>\n</tr>\n<tr>\n<td>nonce</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>is_conditional_order</td>\n<td>bool</td>\n<td>No</td>\n<td>TBD: to be deprecated</td>\n</tr>\n<tr>\n<td>wait_for_reply</td>\n<td>bool</td>\n<td>No</td>\n<td>Default: true</td>\n</tr>\n</tbody>\n</table>\n</div><p><strong>Note</strong></p>\n<ul>\n<li>If order_digest and client_order_id are both presented, client_order_id overwrite the order_digest</li>\n</ul>\n","urlObject":{"path":["v2","cancel-order"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"e95f904c-27b9-45d4-8555-46ec3dedc2e0","name":"Cancel Open Order","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"BTCUSD\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"order_digest\": \"0x00000000000000000000000000000000000000000000000000000000019f2ebd\",\n    \"nonce\": \"1811257020945544621\",\n    \"wait_for_reply\": false // Wait for order to match, send false for lower latency \n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/cancel-order"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": {\n    \"orders\": [\n      {\n        \"order_digest\": \"0x00000000000000000000000000000000000000000000000000000000019f2ebd\",\n        \"status\": \"Success\"\n      }\n    ]\n  },\n  \"timestamp\": 1742282249942389\n}"}],"_postman_id":"d3c6f86f-019e-4893-8ccf-0d0b2f5f363b"},{"name":"BATCH Cancel Multiple Orders","id":"f3748992-6520-463e-9d00-dc6966769c8f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"[\n    {\n        \"symbol\": \"<string>\",\n        \"subaccount\": \"<string>\",\n        \"order_digest\": \"<string>\",\n        \"nonce\": \"<long>\",\n        \"is_conditional_order\": \"<boolean>\"\n    },\n    {\n        \"market\": \"<integer>\",\n        \"subaccount\": \"<integer>\",\n        \"order_digest\": \"<string>\",\n        \"nonce\": \"<long>\",\n        \"is_conditional_order\": \"<boolean>\"\n    }\n]","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/batch-cancel-order","description":"<p>The Cancel Multiple Orders endpoint provides users with the ability to cancel multiple open orders simultaneously. Users can submit a list of order IDs to cancel specific orders in one go, streamlining the process for managing multiple trades. Additionally, the endpoint supports market-wide cancellation, where all open orders for a given market can be canceled with a single request. The response will include the status of each cancellation, confirming which orders were successfully canceled and providing relevant details for any that were not. This feature enhances efficiency for users managing large volumes of orders and allows for rapid adjustments to trading strategies.</p>\n","urlObject":{"path":["v2","batch-cancel-order"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"b8d1a2b1-b28f-4315-899e-ce5bf24baeae","name":"BATCH Cancel Multiple Orders","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"[\n  {\n    \"symbol\": \"BTCUSD\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae33\",\n    \"nonce\": \"19583094395023\",\n    \"is_conditional_order\": false\n  },\n  {\n    \"symbol\": \"BTCUSD\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae35\",\n    \"nonce\": \"19583094395023\",\n    \"is_conditional_order\": false\n  },\n  {\n    \"symbol\": \"BTCUSD\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae36\",\n    \"nonce\": \"19583094395023\",\n    \"is_conditional_order\": false\n  }\n]","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/batch-cancel-order"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": {\n    \"processed_orders\": 3,\n    \"result_orders\": [\n      {\n        \"status\": \"Success\",\n        \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae33\",\n        \"client_order_id\": null\n      },\n      {\n        \"status\": \"OrderNotFound\",\n        \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae35\",\n        \"client_order_id\": null\n      },\n      {\n        \"status\": \"AlreadyCanceledOrFilled\",\n        \"order_digest\": \"0x000000000000000000000000000000000000000000000000000000000178ae36\",\n        \"client_order_id\": null\n      }\n    ]\n  },\n  \"timestamp\": 1740655001685043\n}"}],"_postman_id":"f3748992-6520-463e-9d00-dc6966769c8f"},{"name":"Cancel All Resting Orders","id":"fbb13b20-3f6d-4939-8b54-28f57cf22ce7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"<string>\",\n    \"subaccount\": \"<string>\",\n    \"nonce\": \"<string>\",\n    //TBD: \"is_conditional_order\": true, // true, false, none=>all\n    \"wait_for_reply\": false\n}","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/cancel-all-orders","description":"<p>This endpoint will cancel all of the resting orders. If the market symbol is specified, only the orders in that market will be canceled</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Name</strong></th>\n<th>Type</th>\n<th><strong>Mandator</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>Yes</td>\n<td>Market Symbol</td>\n</tr>\n<tr>\n<td>subaccount</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>nonce</td>\n<td>String</td>\n<td>Yes</td>\n<td></td>\n</tr>\n<tr>\n<td>is_conditional_order</td>\n<td>bool</td>\n<td>No</td>\n<td></td>\n</tr>\n<tr>\n<td>wait_for_reply</td>\n<td>String</td>\n<td>No</td>\n<td>Default: false</td>\n</tr>\n</tbody>\n</table>\n</div><p><strong>Note</strong></p>\n<ul>\n<li><p>If is_conditional_order is not sent, cancel all order both resting and conditional order</p>\n<ul>\n<li><p>If is_conditional_order is true, cancel only conditional orders</p>\n</li>\n<li><p>If is_conditional_order is false, cancel only resting orders</p>\n</li>\n</ul>\n</li>\n</ul>\n","urlObject":{"path":["v2","cancel-all-orders"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"f0704536-d3b7-4d84-99e7-fbb16552584a","name":"Cancel All Resting Orders","originalRequest":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer AUTH_TOKEN","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"symbol\": \"BTCUSD\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"nonce\": \"19583094395023\",\n    \"is_conditional_order\": false\n  }","options":{"raw":{"headerFamily":"json","language":"json"}}},"url":"{{base_url}}/v2/cancel-all-orders"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"place order success\",\n    \"data\": {\n        \"processed_orders\": 10\n    },\n    \"timestamp\": 1739168105871471\n}"}],"_postman_id":"fbb13b20-3f6d-4939-8b54-28f57cf22ce7"}],"id":"e70937e0-a1d7-42e9-bb5e-d266e65fea54","description":"<p>The Order Management endpoints provide users with the functionality to create and cancel orders within the perpetual futures market. These endpoints include:</p>\n<ul>\n<li><p><strong>Create Order</strong>: Allows users to place new orders, such as market, limit, stop, or conditional orders. Users can specify key parameters like the market pair, price, quantity, and order type. Advanced options such as time-in-force and post-only orders are also available for flexible trading strategies.</p>\n</li>\n<li><p><strong>Cancel Order</strong>: Enables users to cancel open orders that have not been fully executed. Users can cancel individual orders by specifying the order ID or cancel all open orders for a specific market in bulk.</p>\n</li>\n<li><p><strong>Batch Order Creation and Cancellation</strong>: Supports batch requests to create or cancel multiple orders in a single operation, providing an efficient way to handle high trading volumes.</p>\n</li>\n</ul>\n<p>These endpoints are designed to facilitate quick and reliable order placement and management, giving users full control over their trading activities in real-time.</p>\n<h2 id=\"authentication-mode\">Authentication Mode</h2>\n<h3 id=\"bearer-token\">Bearer Token</h3>\n<ul>\n<li><p>In order to get the token, please refer to <a href=\"https://developers.hmx.org/#e79555d1-2624-4d44-8a29-3928f3a90c70\">Authentication</a> section</p>\n</li>\n<li><p>Provide the JWT access token in the Authorization header</p>\n</li>\n<li><p>Example</p>\n<ul>\n<li>Authorization: Bearer ey...MY_API_KEY..</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"nonce-generation\">Nonce Generation</h2>\n<p>Every request should be attached with a string called \"nonce\".</p>\n<ul>\n<li><p>Nonce are generated in the following format</p>\n<ul>\n<li><p>timestamp_ms(44 bit) . random_number(20 bit)</p>\n<ul>\n<li><p>Most significant <code>44</code> bits encoding the time in milliseconds (a <code>recv_time</code>) after which the order will be rejected</p>\n</li>\n<li><p>Least significant <code>20</code> bits are a random integer used to order being replayed</p>\n<p>  For example, to place an order with a random integer of 1234, and a discard time 100 ms from now, we would send a nonce of <code>((timestamp_ms() + 100) &lt;&lt; 20) + 1234)</code></p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"broker-id\">Broker ID</h2>\n<ul>\n<li><p>Our backend support multiple Frontend Interfaces. Each frontend has Broker ID associate to it. Please contact our tech support to see check which Broker ID to use.</p>\n</li>\n<li><p>Each Broker ID has different fee structure.</p>\n</li>\n</ul>\n<h2 id=\"order-digest\">Order Digest</h2>\n<ul>\n<li>Order digest is the unique identifier for order in our system</li>\n</ul>\n","_postman_id":"e70937e0-a1d7-42e9-bb5e-d266e65fea54"},{"name":"Histories","item":[{"name":"Get Order History","id":"548eee20-24ec-4030-98b3-dbbde6856175","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"{{base_url}}/v2/order-history/:subaccount?from=&to=&page=&active=","description":"<p>The Order History endpoint allows users to retrieve detailed records of their past orders on the perpetual futures market. This includes information on all types of orders, such as market, limit, and stop orders, along with their respective statuses (e.g., filled, partially filled, canceled). Each order history entry provides key details like order ID, timestamp, market, order type, quantity, price, execution status, and any relevant fees. Users can filter and sort this historical data based on time periods, order types, or market pairs to effectively track their trading activities, analyze their performance, and maintain a record for audit or review purposes.</p>\n","urlObject":{"path":["v2","order-history",":subaccount"],"host":["{{base_url}}"],"query":[{"description":{"content":"<p>from (timestamp in seconds); default 90 days ago</p>\n","type":"text/plain"},"key":"from","value":""},{"description":{"content":"<p>to (timestamp in seconds); default Now</p>\n","type":"text/plain"},"key":"to","value":""},{"description":{"content":"<p>The index of the pages</p>\n","type":"text/plain"},"key":"page","value":""},{"description":{"content":"<p>Filter only active order</p>\n","type":"text/plain"},"key":"active","value":""}],"variable":[{"description":{"content":"<p>(Required) wallet address with subaccount number padding zero in bytes32  </p>\n<blockquote>\n<p><em><strong>e.g.</strong></em> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  </p>\n</blockquote>\n<blockquote>\n<p>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                </p>\n</blockquote>\n","type":"text/plain"},"type":"any","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","key":"subaccount"}]}},"response":[{"id":"02bb7af0-a220-4afe-8b2f-c1ccef936b79","name":"Get Order History","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/order-history/:subaccount?from=1724642559&to=1727320959&page=1&active=true","host":["{{base_url}}"],"path":["v2","order-history",":subaccount"],"query":[{"key":"from","value":"1724642559","description":"from (timestamp in seconds); default 90 days ago"},{"key":"to","value":"1727320959","description":"to (timestamp in seconds); default Now"},{"key":"page","value":"1","description":"The index of the pages"},{"key":"active","value":"true","description":"Filter only active order"}],"variable":[{"key":"subaccount","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001","description":"(Required) wallet address with subaccount number padding zero in bytes32  \n\n                \n>***e.g.*** 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  \n\n                \n>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                "}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"order_digest\": \"0x71d8167b1d91401b41babd37a6bdc8596c1fd725931f8210c514be382279bdc6\",\n      \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n      \"symbol\": \"BTCUSD\",\n      \"side\": \"Short\",\n      \"order_type\": \"Limit\",\n      \"quantity\": \"11.36234519000000000000000000\",\n      \"filled_qty\": \"0\",\n      \"price\": \"88010.0000000000\",\n      \"avg_filled_price\": \"0.00\",\n      \"time_in_force\": \"PostOnly\",\n      \"is_reduce_only\": false,\n      \"is_liquidation\": false,\n      \"created_at\": 1730364493000,\n      \"updated_at\": 1730364493000,\n      \"canceled_at\": 1730364493000,\n      \"expired_at\": null,\n      \"trigger_above_threshold\": null,\n      \"trigger_price\": null\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"548eee20-24ec-4030-98b3-dbbde6856175"},{"name":"Search Order History by Digest","id":"92d622af-fe89-4e35-8a49-ea1f683150d5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"{{base_url}}/v2/order-history-digest?order_digests=order_digest1, order_digest2 ...","description":"<p>Get specific order history providing the order digest or multiple order digests</p>\n","urlObject":{"path":["v2","order-history-digest"],"host":["{{base_url}}"],"query":[{"key":"order_digests","value":"order_digest1, order_digest2 ..."}],"variable":[]}},"response":[{"id":"ed6b26dd-2803-449f-a7a9-dd6989a02489","name":"Search Order History by Digest","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/order-history-digest?order_digests=0x00000000000000000000000000000000000000000000000000000000002a2541,0x00000000000000000000000000000000000000000000000000000000002a2542","host":["{{base_url}}"],"path":["v2","order-history-digest"],"query":[{"key":"order_digests","value":"0x00000000000000000000000000000000000000000000000000000000002a2541,0x00000000000000000000000000000000000000000000000000000000002a2542"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"Success\",\n    \"data\": [\n        {\n            \"id\": \"5094076\",\n            \"order_digest\": \"0x00000000000000000000000000000000000000000000000000000000002a2541\",\n            \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n            \"symbol\": \"ETHUSD\",\n            \"side\": \"Short\",\n            \"order_type\": \"Limit\",\n            \"quantity\": \"6.007\",\n            \"filled_qty\": \"0.132\",\n            \"price\": \"2692.27\",\n            \"avg_filled_price\": \"0.00\",\n            \"time_in_force\": \"PostOnly\",\n            \"is_reduce_only\": false,\n            \"is_liquidation\": false,\n            \"created_at\": 1739936734680,\n            \"updated_at\": 1739936740241,\n            \"canceled_at\": 1739936739809,\n            \"expired_at\": null,\n            \"trigger_above_threshold\": null,\n            \"trigger_price\": null,\n            \"is_conditional_order\": false\n        },\n        {\n            \"id\": \"5094077\",\n            \"order_digest\": \"0x00000000000000000000000000000000000000000000000000000000002a2542\",\n            \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n            \"symbol\": \"ETHUSD\",\n            \"side\": \"Short\",\n            \"order_type\": \"Limit\",\n            \"quantity\": \"6.007\",\n            \"filled_qty\": \"0.132\",\n            \"price\": \"2692.27\",\n            \"avg_filled_price\": \"0.00\",\n            \"time_in_force\": \"PostOnly\",\n            \"is_reduce_only\": false,\n            \"is_liquidation\": false,\n            \"created_at\": 1739936734680,\n            \"updated_at\": 1739936740241,\n            \"canceled_at\": 1739936739809,\n            \"expired_at\": null,\n            \"trigger_above_threshold\": null,\n            \"trigger_price\": null,\n            \"is_conditional_order\": false\n        }\n    ],\n    \"timestamp\": 1739957367011175\n}"}],"_postman_id":"92d622af-fe89-4e35-8a49-ea1f683150d5"},{"name":"Get Payment History","id":"6e4e8f81-1da8-4b15-a115-2386b79d12a9","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/payment-history/:subaccount?types=&from=&to=&page=","description":"<p>The Payment History endpoint provides users with a comprehensive record of all financial transactions related to their account within the perpetual futures market. This includes deposits, withdrawals, fees, and any adjustments or transfers within the platform. Each payment record includes details such as timestamp, type (e.g., deposit, withdrawal, fee), amount, asset, and status (e.g., completed, pending, failed). Users can filter and query this data based on date ranges, transaction types, and currencies to efficiently track their financial activity, reconcile account balances, and ensure the accuracy of their payments and account movements.</p>\n","urlObject":{"path":["v2","payment-history",":subaccount"],"host":["{{base_url}}"],"query":[{"description":{"content":"<p>payment type example (LiquidationFee, FundingFee)</p>\n","type":"text/plain"},"key":"types","value":""},{"description":{"content":"<p>from (timestamp in seconds); default 90 days ago</p>\n","type":"text/plain"},"key":"from","value":""},{"description":{"content":"<p>to (timestamp in seconds); default Now</p>\n","type":"text/plain"},"key":"to","value":""},{"description":{"content":"<p>page</p>\n","type":"text/plain"},"key":"page","value":""}],"variable":[{"description":{"content":"<p>(Required) wallet address with subaccount number padding zero in bytes32  </p>\n<blockquote>\n<p><em><strong>e.g.</strong></em> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  </p>\n</blockquote>\n<blockquote>\n<p>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                </p>\n</blockquote>\n","type":"text/plain"},"type":"any","value":"<string>","key":"subaccount"}]}},"response":[{"id":"055687ec-2a66-4787-93ab-65c6065f69da","name":"Query Payment History success","originalRequest":{"method":"GET","header":[{"key":"Authorization","value":"Bearer <token>","description":"Added as a part of security scheme: bearer"}],"url":{"raw":"{{base_url}}/v2/payment-history/:subaccount?types=TradingFee&from=1724642559&to=1727320959&page=1","host":["{{base_url}}"],"path":["v2","payment-history",":subaccount"],"query":[{"key":"types","value":"TradingFee","description":"payment type example (LiquidationFee, FundingFee)"},{"key":"from","value":"1724642559","description":"from (timestamp in seconds); default 90 days ago"},{"key":"to","value":"1727320959","description":"to (timestamp in seconds); default Now"},{"key":"page","value":"1","description":"page"}],"variable":[{"key":"subaccount","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n      \"symbol\": \"BTCUSD\",\n      \"asset\": \"USDC\",\n      \"amount\": \"-0.13882\",\n      \"payment_type\": \"TradingFee\",\n      \"created_at\": 1730364493000\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"6e4e8f81-1da8-4b15-a115-2386b79d12a9"},{"name":"Get Position History","id":"b4abce7c-815f-4aa9-a0ee-35f95412b9a1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/position-history/:subaccount","description":"<p>The Position History endpoint enables users to view a detailed log of all their closed positions within the perpetual futures market. Each entry in the position history provides comprehensive information, including the market, entry and exit prices, position size, realized profits/losses, and the timestamps for when the position was opened and closed. Users can utilize this endpoint to analyze their trading strategies, review the performance of individual positions, and track their historical exposure across different markets.</p>\n","urlObject":{"path":["v2","position-history",":subaccount"],"host":["{{base_url}}"],"query":[],"variable":[{"description":{"content":"<p>(Required) wallet address with subaccount number padding zero in bytes32  </p>\n<blockquote>\n<p><em><strong>e.g.</strong></em> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  </p>\n</blockquote>\n<blockquote>\n<p>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                </p>\n</blockquote>\n","type":"text/plain"},"type":"any","value":"","key":"subaccount"}]}},"response":[{"id":"9ad0db90-1290-4c9f-a24c-70386fd75947","name":"Get Position History","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/position-history/:subaccount","host":["{{base_url}}"],"path":["v2","position-history",":subaccount"],"variable":[{"key":"subaccount","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001","description":"(Required) wallet address with subaccount number padding zero in bytes32  \n                \n>***e.g.*** 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  \n                \n>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                "}]}},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n      \"symbol\": \"BTCUSD\",\n      \"side\": \"Short\",\n      \"current_qty\": \"0.00\",\n      \"max_qty\": \"26.705000000000000000000\",\n      \"closed_qty\": \"26.705000000000000000000\",\n      \"avg_entry_price\": \"86640.0000000000\",\n      \"avg_close_price\": \"86640.0000000000\",\n      \"realized_pnl\": \"0.00\",\n      \"liquidated_at\": null,\n      \"liquidated_price\": null,\n      \"created_at\": 1730364493000,\n      \"updated_at\": 1730364493000,\n      \"closed_at\": 1730364493000\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"b4abce7c-815f-4aa9-a0ee-35f95412b9a1"},{"name":"Get Trade History","id":"d52a09ba-308f-4863-83ca-8a85b4a7ba9e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/trade-history/:subaccount?from&to&page","description":"<p>The Trade History endpoint allows users to access a detailed record of all executed trades on their account within the perpetual futures market. Each trade entry includes key details such as order digest, timestamp, market pair, trade side (buy or sell), price, quantity. This endpoint provides a comprehensive view of all trades, whether they resulted from being a maker or taker.</p>\n","urlObject":{"path":["v2","trade-history",":subaccount"],"host":["{{base_url}}"],"query":[{"description":{"content":"<p>from (timestamp in seconds); default 90 days ago</p>\n","type":"text/plain"},"key":"from","value":null},{"description":{"content":"<p>to (timestamp in seconds); default Now</p>\n","type":"text/plain"},"key":"to","value":null},{"description":{"content":"<p>The index of the pages</p>\n","type":"text/plain"},"key":"page","value":null}],"variable":[{"description":{"content":"<p>(Required) wallet address with subaccount number padding zero in bytes32  </p>\n<blockquote>\n<p><em><strong>e.g.</strong></em> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  </p>\n</blockquote>\n<blockquote>\n<p>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                </p>\n</blockquote>\n","type":"text/plain"},"type":"any","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","key":"subaccount"}]}},"response":[{"id":"75b0196d-75d9-4f97-9b83-b4f87bb858d1","name":"Get Trade History","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/trade-history/:subaccount","host":["{{base_url}}"],"path":["v2","trade-history",":subaccount"],"variable":[{"key":"subaccount","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001","description":"(Required) wallet address with subaccount number padding zero in bytes32  \n                \n>***e.g.*** 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  \n                \n>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                "}]}},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"symbol\": \"BTCUSD\",\n      \"side\": \"Long\",\n      \"price\": \"86640.0000000000\",\n      \"filled\": \"26.705000000000000000000\",\n      \"trading_fee\": \"13.882327200000000\",\n      \"trading_fee_token\": \"USDC\",\n      \"realized_pnl\": \"0.00\",\n      \"is_taker\": false,\n      \"traded_at\": 1730364493000\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"d52a09ba-308f-4863-83ca-8a85b4a7ba9e"},{"name":"Get Subaccount Summary","id":"f0f540d5-2612-4399-8eca-e4bb3f3fc6ad","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[],"url":"{{base_url}}/v2/subaccount-summary/:subaccount","description":"<p>The Subaccount Summary endpoint provides a overview of a user's subaccount current state. This includes:</p>\n<ul>\n<li><p><strong>Collateral</strong>: A list of all collateral balances.</p>\n</li>\n<li><p><strong>Open Orders</strong>: A list of all active orders, quantities, and markets.</p>\n</li>\n<li><p><strong>Open Positions</strong>: A snapshot of all current positions, including market exposure, entry price, position size</p>\n</li>\n</ul>\n<p>This endpoint is the main endpount used for monitoring subaccount’s status.</p>\n","urlObject":{"path":["v2","subaccount-summary",":subaccount"],"host":["{{base_url}}"],"query":[],"variable":[{"description":{"content":"<p>(Required) wallet address with subaccount number padding zero in bytes32  </p>\n<blockquote>\n<p><em><strong>e.g.</strong></em> 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE with subaccount number 1  </p>\n</blockquote>\n<blockquote>\n<p>GET /subaccount-summary/0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\n                </p>\n</blockquote>\n","type":"text/plain"},"type":"any","value":"<string>","key":"subaccount"}]}},"response":[{"id":"b5325c64-a88d-4d1f-a77e-97c63267aca3","name":"Get Subaccount Summary success","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/subaccount-summary/:subaccount","host":["{{base_url}}"],"path":["v2","subaccount-summary",":subaccount"],"variable":[{"key":"subaccount","value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001"}]}},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": {\n    \"open_orders\": [\n      {\n        \"order_digest\": \"0x0022fcd49c43dfbf111bc769728aa865200bffb8a9c6b809f0241d48046f01b2\",\n        \"symbol\": \"BTCUSD\",\n        \"side\": \"Long\",\n        \"price\": \"67060.0000\",\n        \"original_quantity\": \"74.5601\",\n        \"remaining_quantity\": \"74.5601\",\n        \"order_type\": \"Limit\"\n      }\n    ],\n    \"collaterals\": [\n      {\n        \"collateral_id\": \"0x0000000000000000000000000000000000000001\",\n        \"asset\": \"USDC\",\n        \"amount\": \"99.9979738062\"\n      }\n    ],\n    \"positions\": [\n      {\n        \"symbol\": \"BTCUSD\",\n        \"quantity\": \"36.74\",\n        \"avg_entry_price\": \"720444.0000\",\n        \"side\": \"Short\",\n        \"last_updated_funding_fee\": \"-52.268403665626741739\"\n      }\n    ],\n    \"collateral_value\": \"99.989736973097583306\",\n    \"unrealized_pnl\": \"0.00\",\n    \"pending_funding_fee\": \"0.00\",\n    \"pending_borrowing_fee\": \"0.00\",\n    \"account_imr\": \"0.00\",\n    \"order_imr\": \"0.00\",\n    \"position_imr\": \"0.00\",\n    \"position_mmr\": \"0.00\"\n  },\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"f0f540d5-2612-4399-8eca-e4bb3f3fc6ad"}],"id":"ddc00686-7032-484a-9a9a-cfd4b6689c95","description":"<p>The History Endpoints provide users with access to key historical data for their trading activities on the perpetual futures market. This set includes:</p>\n<ul>\n<li><p><strong>Order History</strong>: Details on all past orders, including type, status, and execution details.</p>\n</li>\n<li><p><strong>Trade History</strong>: Records of executed trades with price, quantity, and timestamp.</p>\n</li>\n<li><p><strong>Position History</strong>: Information on open and closed positions, with entry/exit prices and P&amp;L.</p>\n</li>\n<li><p><strong>Payment History</strong>: Transactions related to deposits, withdrawals, and fees.</p>\n</li>\n<li><p><strong>Subaccount History</strong>: Activity in subaccounts, covering collateral changes, open orders, and open positions.</p>\n</li>\n</ul>\n<p>These endpoints allow users to review and analyze their trading history, financial transactions, and subaccount activities comprehensively.</p>\n<h2 id=\"pagination\">Pagination</h2>\n<ul>\n<li>Default page size: 30 items per page</li>\n</ul>\n","_postman_id":"ddc00686-7032-484a-9a9a-cfd4b6689c95"},{"name":"Global Information","item":[{"name":"Get Market Information","id":"551b27ba-49ab-449d-bad3-cfe6fb42400e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/market-info/brokers/{{broker_id}}","description":"<p>The Get Market Information endpoint provides essential details for all available markets for the particular <strong>Broker</strong>, including:</p>\n<ul>\n<li><p><strong>Market Pair</strong>: The trading pair (e.g., BTC/USDT).</p>\n</li>\n<li><p><strong>Tick Size</strong>: Minimum price increment.</p>\n</li>\n<li><p><strong>Lot Size</strong>: Minimum contract quantity increment.</p>\n</li>\n<li><p><strong>Min Notional Size</strong>: Minimum trade size.</p>\n</li>\n<li><p><strong>IMF</strong>: Initial Margin Requirement</p>\n</li>\n<li><p><strong>Maker Fee</strong>: Trading fee for maker order</p>\n</li>\n<li><p><strong>Taker Fee</strong>: Trading fee for taker order</p>\n</li>\n</ul>\n<p>This information helps users understand market specifications and constraints, ensuring accurate and compliant order placement.</p>\n","urlObject":{"path":["v2","market-info","brokers","{{broker_id}}"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"0c739942-532d-44fa-8d7a-f8e30e64cbde","name":"Get Market Information","originalRequest":{"method":"GET","header":[],"url":"{{base_url}}/v2/market-info/brokers/{{broker_id}}"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"id\": 1,\n      \"symbol\": \"BTCUSD\",\n      \"name\": \"BITCOIN / UNITED STATES DOLLAR\",\n      \"base_asset\": \"BTC\",\n      \"quote_asset\": \"USD\",\n      \"imf\": \"0.05\",\n      \"mmf\": \"0.025\",\n      \"maker_fee\": \"-0.0001\",\n      \"taker_fee\": \"0.00015\",\n      \"price_feed_id\": 3,\n      \"tick_size\": \"0.01\",\n      \"lot_size\": \"0.0001\",\n      \"min_notional_size\": \"10\",\n      \"max_conditional_orders\": 20\n    },\n    {\n      \"id\": 2,\n      \"symbol\": \"ETHUSD\",\n      \"name\": \"ETHEREUM / UNITED STATES DOLLAR\",\n      \"base_asset\": \"ETH\",\n      \"quote_asset\": \"USD\",\n      \"imf\": \"0.05\",\n      \"mmf\": \"0.025\",\n      \"maker_fee\": \"-0.0001\",\n      \"taker_fee\": \"0.00015\",\n      \"price_feed_id\": 5,\n      \"tick_size\": \"0.001\",\n      \"lot_size\": \"0.0001\",\n      \"min_notional_size\": \"10\",\n      \"max_conditional_orders\": 20\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}"}],"_postman_id":"551b27ba-49ab-449d-bad3-cfe6fb42400e"},{"name":"Get Mark Prices","id":"8ea65ca3-3944-4295-8151-d77c9cee6f9e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/mark-prices","description":"<p>The Get Oracle Prices endpoint provides real-time price data from external oracles for all supported markets. This includes accurate and up-to-date price feeds that can be used to inform trading decisions, verify price movements, and manage risk. Each response includes the market pair, current oracle price, and timestamp of the last update, ensuring users have reliable pricing information for trading and analysis.</p>\n","urlObject":{"path":["v2","mark-prices"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"8d42675a-fc9d-412e-b793-10218e916a0f","name":"Get Mark Prices","originalRequest":{"method":"GET","header":[],"url":"{{base_url}}/v2/mark-prices"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"code\": 200,\n  \"message\": \"Success\",\n  \"data\": [\n    {\n      \"symbol\": \"BTCUSD\",\n      \"mark_price\": \"100000.4923\",\n      \"index_price\": \"100001.3983\"\n    },\n    {\n      \"symbol\": \"ETHUSD\",\n      \"mark_price\": \"3200.0211\",\n      \"index_price\": \"3199.5340\"\n    }\n  ],\n  \"timestamp\": 1739168105871471\n}\n"}],"_postman_id":"8ea65ca3-3944-4295-8151-d77c9cee6f9e"},{"name":"Get Collateral Prices","id":"4fa8ea71-473c-474e-b35d-6f0371bd58bd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/collateral-prices","description":"<p>The Get Oracle Prices endpoint provides real-time price data from external oracles for all supported markets. This includes accurate and up-to-date price feeds that can be used to inform trading decisions, verify price movements, and manage risk. Each response includes the market pair, current oracle price, and timestamp of the last update, ensuring users have reliable pricing information for trading and analysis.</p>\n","urlObject":{"path":["v2","collateral-prices"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"f6ebdf40-9f8c-4927-8a60-13172e407373","name":"Get Collateral Prices","originalRequest":{"method":"GET","header":[],"url":"{{base_url}}/v2/collateral-prices"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"Success\",\n    \"data\": [\n        {\n            \"collateral_id\": \"0x0000000000000000000000000000000000000001\",\n            \"asset\": \"USDC\",\n            \"price\": \"1.00008136\"\n        }\n    ],\n  \"timestamp\": 1739168105871471\n}"}],"_postman_id":"4fa8ea71-473c-474e-b35d-6f0371bd58bd"}],"id":"d804ce82-19fb-4411-975d-c6c7465e696f","description":"<p>List of API Endpoints return system configurations</p>\n","_postman_id":"d804ce82-19fb-4411-975d-c6c7465e696f"},{"name":"Price Data","item":[{"name":"Price Chart (Candle Sticks)","id":"544fd54a-a843-4ead-a001-7bf9c720c7c6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/chart?symbol=&from&to&interval","description":"<h2 id=\"parameters\">Parameters</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Name</strong></th>\n<th><strong>Type</strong></th>\n<th><strong>Madatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>Yes</td>\n<td>Market Symbol</td>\n</tr>\n<tr>\n<td>from</td>\n<td>Timestamp</td>\n<td>Yes</td>\n<td>Unix Timestamp</td>\n</tr>\n<tr>\n<td>to</td>\n<td>Timestamp</td>\n<td>Yes</td>\n<td>Unix Timestamp</td>\n</tr>\n<tr>\n<td>inverval</td>\n<td>ENUM</td>\n<td>Yes</td>\n<td>[1m, 5m, 15m, 1h, 4h, 12h, 1d, 3d, 1w, 1M]</td>\n</tr>\n<tr>\n<td>limit</td>\n<td>Number</td>\n<td>No</td>\n<td>Maximum of bar chart. Default 500. Maximum 1500</td>\n</tr>\n</tbody>\n</table>\n</div>","urlObject":{"path":["v2","chart"],"host":["{{base_url}}"],"query":[{"description":{"content":"<p>Market Symbol i.e. BTCUSD</p>\n","type":"text/plain"},"key":"symbol","value":""},{"description":{"content":"<p>Starting time in unix timestamp format</p>\n","type":"text/plain"},"key":"from","value":null},{"description":{"content":"<p>Ending Time in unix timstamp format</p>\n","type":"text/plain"},"key":"to","value":null},{"description":{"content":"<p>Interval e.g 1m, 1H, 1D</p>\n","type":"text/plain"},"key":"interval","value":null}],"variable":[]}},"response":[{"id":"9c76ac1d-dc2f-4530-910a-1e14d7d95aee","name":"Price Chart (Candle Sticks)","originalRequest":{"method":"GET","header":[],"url":{"raw":"{{base_url}}/v2/chart?symbol=BTC/USD&from=1730615871&to=1734935871&interval=4h","host":["{{base_url}}"],"path":["v2","chart"],"query":[{"key":"symbol","value":"BTC/USD"},{"key":"from","value":"1730615871"},{"key":"to","value":"1734935871"},{"key":"interval","value":"4h"}]}},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"Success\",\n    \"data\": {\n        \"bars\": [\n            {\n                \"time\": 1734069600,\n                \"open\": 96297.935,\n                \"high\": 96297.935,\n                \"low\": 96297.935,\n                \"close\": 96297.935,\n                \"volume\": 25402 // Unit in base currency\n            },\n            {\n                \"time\": 1734069660,\n                \"open\": 96297.935,\n                \"high\": 96297.935,\n                \"low\": 96297.935,\n                \"close\": 96297.935,\n                \"volume\": 40395023 // Unit in base currency\n            // ....\n            }\n        ],\n        \"symbol\": \"BTC/USD\",\n        \"interval\": 60,\n        \"from\": 1734069646,\n        \"to\": 1734087646\n    },\n    \"timestamp\": 1739168105871471\n}"}],"_postman_id":"544fd54a-a843-4ead-a001-7bf9c720c7c6"},{"name":"24 Hr Price","id":"025eb7bb-be38-4006-9614-0702acdbd596","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"{{base_url}}/v2/ticker/24hr","urlObject":{"path":["v2","ticker","24hr"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"3828c269-0262-4c6f-84a1-77ae14d0651c","name":"24 Hr Price","originalRequest":{"method":"GET","header":[],"url":"{{base_url}}/v2/ticker/24hr"},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"code\": 200,\n    \"message\": \"Success\",\n    \"data\": [\n        {\n            \"symbol\": \"BTCUSD\",\n            \"current_price\": \"91317.81300000\",\n            \"last_24hr_price\": \"87914.82100000\",\n            \"price_change\": \"3402.99200000\",\n            \"price_change_percent\": \"3.871\",\n            \"volume\": \"1491370.06912800\"\n        },\n        {\n            \"symbol\": \"ETH/USD\",\n            \"current_price\": \"3119.68400000\",\n            \"last_24hr_price\": \"3074.03600000\",\n            \"price_change\": \"45.64800000\",\n            \"price_change_percent\": \"1.485\",\n            \"volume\": \"1007320.67740800\"\n        },\n        {\n            \"symbol\": \"SOL/USD\",\n            \"current_price\": \"210.00000000\",\n            \"last_24hr_price\": \"210.25000000\",\n            \"price_change\": \"-0.25000000\",\n            \"price_change_percent\": \"-0.119\",\n            \"volume\": \"0.00000000\"\n        }\n    ],\n    \"timestamp\": 1739168105871471\n}"}],"_postman_id":"025eb7bb-be38-4006-9614-0702acdbd596"}],"id":"f7e9a4f3-f04c-4f47-b602-5be6667eaa9d","_postman_id":"f7e9a4f3-f04c-4f47-b602-5be6667eaa9d","description":""},{"name":"Websocket","item":[{"name":"L2Book Subscribe","id":"d8482ed6-9b08-4296-b6a5-3f6fe2c98130","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"l2BookV2\",\n        \"symbol\": \"BTCUSD\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"b129558e-d952-4b35-bb7f-625c8ec45210","name":"L2Book Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"type\": \"l2Book\",\n    \"symbol\": \"BTCUSD\",\n    \"data\": {\n        \"bids\": [\n            [\n                \"60500.00\", // Price\n                \"20.00\" // Qty per level\n            ]\n        ],\n        \"asks\": [\n            [\n                \"60700.00\", // Price\n                \"10.00\" // Qty per level\n            ]\n        ]\n    },\n    \"timestamp\": 1739166143822763\n}"}],"_postman_id":"d8482ed6-9b08-4296-b6a5-3f6fe2c98130"},{"name":"Trades Subscribe","id":"52aaf596-29ea-4dc5-be77-d8c53cbd44b8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"tradesV2\",\n        \"symbol\": \"BTCUSD\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"8dde7bf5-bb3c-4eb5-95b1-f9bf708dd13f","name":"Trade Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"type\": \"tradesV2\",\n    \"symbol\": \"BTCUSD\",\n    \"data\": {\n        \"price\": \"60500.00\",\n        \"qty\": \"1.00\",\n        \"side\": \"Long\",\n        \"client_order_id\": \"9e09a7f6-8438-4f0d-b01e-019c840d2190\",\n        \"traded_at\": 1724647795532\n    },\n    \"timestamp\": 1739166143822763\n}"}],"_postman_id":"52aaf596-29ea-4dc5-be77-d8c53cbd44b8"},{"name":"Trades Updates Subscribe","id":"20989eee-55a7-4ca1-9cb4-632156c59042","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"tradeUpdatesV2\",\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"7e0cb05d-f876-4568-a468-91f27ef500dc","name":"Trade Update Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"type\": \"tradeUpdatesV2\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"data\": {\n        \"symbol\": \"ETHUSD\",\n        \"price\": \"4005.00\",\n        \"quantity\": \"0.459\",\n        \"is_taker\": true,\n        \"side\": \"Long\",\n        \"order_digest\": \"0x00000000000000000000000000000000000000000000000000000000003df7e5\",\n        \"client_order_id\": \"9e09a7f6-8438-4f0d-b01e-019c840d2190\",\n        \"traded_at\": 1739169110522\n    },\n    \"timestamp\": 1739169110635191\n}"}],"_postman_id":"20989eee-55a7-4ca1-9cb4-632156c59042"},{"name":"Mark Prices Subscribe","id":"526492e7-b9ca-422e-b7ab-ba810eb45052","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"markPricesV2\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"61841f75-37ce-4650-8ca9-7b513a82dc9d","name":"Mark Prices Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n  \"type\": \"markPrices\",\n  \"data\": [\n    {\n      \"symbol\": \"BTCUSD\",\n      \"mark_price\": \"60000.00\",\n      \"index_price\": \"60000.00\"\n    },\n    {\n      \"symbol\": \"ETHUSD\",\n      \"mark_price\": \"3200.0200\",\n      \"index_price\": \"3200.0022\"\n    }\n  ],\n  \"timestamp\": 1739166143822763\n}\n"}],"_postman_id":"526492e7-b9ca-422e-b7ab-ba810eb45052"},{"name":"Order Updates Subscribe","id":"e5133da0-3870-4ad2-b735-10ee058b118f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"orderUpdatesV2\",\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"d68bcea6-34ea-45d5-a8f2-58c3915eb477","name":"Order Updates Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"type\": \"orderUpdates\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"data\": {\n        \"symbol\": \"BTCUSD\",\n        \"avg_price\": \"60000.00\",\n        \"original_quantity\": \"1.00\",\n        \"filled_quantity\": \"1.00\",\n        \"side\": \"Short\",\n        \"order_type\": \"Limit\",\n        \"tif\": \"PostOnly\",\n        \"status\": \"Open\", // Open | Filled | Canceled | Expired\n        \"order_updated_at\": 1724653836139,\n        \"client_order_id\": \"my-id-1\",\n        \"order_digest\" : \"0x...\"\n    },\n    \"timestamp\": 1739166143822763\n}"}],"_postman_id":"e5133da0-3870-4ad2-b735-10ee058b118f"},{"name":"Position Updates Subscribe","id":"e7abef83-af1b-4382-9e62-f39ac1b2f15c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"WSS","header":[],"body":{"mode":"raw","raw":"{\n    \"method\": \"subscribe\",\n    \"subscription\": {\n        \"type\": \"positionUpdatesV2\",\n        \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\"\n    }\n}","options":{"raw":{"language":"json"}}},"urlObject":{"query":[],"variable":[]},"url":""},"response":[{"id":"986b3d8d-7efd-4009-a51e-4fcf1c429cb6","name":"Position Updates Subscribe","originalRequest":{"method":"GET","header":[]},"_postman_previewlanguage":"json","header":[{"key":"Content-Type","value":"application/json","description":"","type":"text"}],"cookie":[],"responseTime":null,"body":"{\n    \"type\": \"positionUpdates\",\n    \"subaccount\": \"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE000000000000000000000001\",\n    \"data\": {\n        \"symbol\": \"BTCUSD\",\n        \"quantity\": \"36.74\",\n        \"avg_entry_price\": \"720444.0000\",\n        \"side\": \"Short\"\n      },\n    \"timestamp\": 1739166143822763\n}"}],"_postman_id":"e7abef83-af1b-4382-9e62-f39ac1b2f15c"}],"id":"121cbf41-70e2-41df-ad3c-5d630075a6f3","description":"<p>This documentation provides details on how to connect to the WebSocket server, subscribe to specific data streams, and interpret the responses received from the server.</p>\n<ul>\n<li>Validity: 24 Hours</li>\n</ul>\n<h2 id=\"general-info\">General Info</h2>\n<ul>\n<li><p>The base endpoint are</p>\n<ul>\n<li><p>testnet: <code>wss://trade-ws-api.happytrading.global/ws</code></p>\n</li>\n<li><p>mainnet: <code>wss://ws-api.happytrading.global/ws</code></p>\n</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"default-timeout\">Default Timeout</h2>\n<p>Our server will terminate streams that are idle (OrderUpdate, PositionUpdate) for longer than <strong>100 second</strong>. To keep the connection open, please send ping frame every 60s.</p>\n<h2 id=\"websocket-request-format\">Websocket Request Format</h2>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th><strong>Mandatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>method</td>\n<td>String</td>\n<td>YES</td>\n<td>Subcribe</td>\n</tr>\n<tr>\n<td>subscription</td>\n<td>Object</td>\n<td>YES</td>\n<td>Refer to Subscription Type section</td>\n</tr>\n</tbody>\n</table>\n</div><h2 id=\"subscription-type\">Subscription Type</h2>\n<h3 id=\"l2book\">L2Book</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th><strong>Mandatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>String</td>\n<td>YES</td>\n<td>\"l2bookV2\"</td>\n</tr>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>YES</td>\n<td>Market symbol e.g. \"BTCUSD\"</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"trade\">Trade</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th><strong>Mandatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>String</td>\n<td>YES</td>\n<td>\"tradesV2\"</td>\n</tr>\n<tr>\n<td>symbol</td>\n<td>String</td>\n<td>YES</td>\n<td>Market symbol e.g. \"BTCUSD\"</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"mark-prices\">Mark Prices</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th><strong>Mandatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>String</td>\n<td>YES</td>\n<td>\"markPricesV2\"</td>\n</tr>\n</tbody>\n</table>\n</div><h3 id=\"order-updates\">Order Updates</h3>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Type</th>\n<th><strong>Mandatory</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>type</td>\n<td>String</td>\n<td>YES</td>\n<td>\"orderUpdatesV2\"</td>\n</tr>\n<tr>\n<td>wallet_address</td>\n<td>String</td>\n<td>YES</td>\n<td>Wallet address of the account</td>\n</tr>\n<tr>\n<td>subaccount_id</td>\n<td>Integer</td>\n<td>YES</td>\n<td>The subaccount ID</td>\n</tr>\n</tbody>\n</table>\n</div>","_postman_id":"121cbf41-70e2-41df-ad3c-5d630075a6f3"}],"event":[{"listen":"prerequest","script":{"id":"b330249e-09ca-4de1-b49c-8f3302389479","type":"text/javascript","packages":{},"exec":[""]}},{"listen":"test","script":{"id":"5deb9092-ed0f-46ec-ae90-4d6a65be215e","type":"text/javascript","packages":{},"exec":[""]}}]}