Send Leverage or Margin Action REST API Endpoint
資訊
Exchange API 呼叫不會消耗Quicknode 點數。透過此endpoint 進行的交易endpoint 附加建置商手續費。完整明細請參閱hyperliquidapi.com。若要使用您自己的建置商代碼進行白標服務,請與我們聯繫。
This endpoint is not a drop-in replacement for Hyperliquid's native /exchange endpoint. See the Exchange API Overview for key differences.
身體參數
動作
物件
必填
載入中...
類型
字串
載入中...
非重複數
整數
必填
載入中...
簽名
物件
必填
載入中...
r
字串
載入中...
s
字串
載入中...
v
整數
載入中...
退貨
success
布林值
載入中...
使用者
字串
載入中...
exchangeResponse
物件
載入中...
請求
1curl -s -X POSTmainnet\2-H "Content-Type: application/json" \3-d '{4"action": {5"type": "updateLeverage",6"asset": 0,7"isCross": true,8「槓桿」:109},10"nonce": 1234567890,11"signature": {12"r": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",13"s": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",14"v": 2815}16}'17
1curl -s -X POSTmainnet\2-H "Content-Type: application/json" \3-d '{4"action": {5"type": "updateLeverage",6"asset": 0,7"isCross": true,8「槓桿」:109},10"nonce": 1234567890,11"signature": {12"r": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",13"s": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",14"v": 2815}16}'17
1const axios = require('axios');23const 資料 = {4action: {5類型: "updateLeverage",6asset: 0,7isCross: true,8槓桿: 109},10nonce: 1234567890,11signature: {12r: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",13s: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",14v: 2815}16};1718axios.post('https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange', data, {19headers: { 'Content-Type': 'application/json' }20})21.接著(回應 => 控制台.log(response.data))22.catchcatch(錯誤 => console.錯誤(錯誤));23
1const axios = require('axios');23const 資料 = {4action: {5類型: "updateLeverage",6asset: 0,7isCross: true,8槓桿: 109},10nonce: 1234567890,11signature: {12r: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",13s: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",14v: 2815}16};1718axios.post('https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange', data, {19headers: { 'Content-Type': 'application/json' }20})21.接著(回應 => 控制台.log(response.data))22.catchcatch(錯誤 => console.錯誤(錯誤));23
1匯入 請求2匯入 json34網址 = "mainnet"5有效載荷 = json.dumps({6"action": {7"類型": "updateLeverage",8"asset": 0,9"isCross": True,10「槓桿」: 1011},12"nonce": 1234567890,13"signature": {14"r": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",15"s": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",16"v": 2817}18})19headers = { 'Content-Type': 'application/json' }20回應 = 請求.請求("POST", url, headers=headers, data=有效載荷)21列印(回應.text)22
1匯入 請求2匯入 json34網址 = "mainnet"5有效載荷 = json.dumps({6"action": {7"類型": "updateLeverage",8"asset": 0,9"isCross": True,10「槓桿」: 1011},12"nonce": 1234567890,13"signature": {14"r": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",15"s": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",16"v": 2817}18})19headers = { 'Content-Type': 'application/json' }20回應 = 請求.請求("POST", url, headers=headers, data=有效載荷)21列印(回應.text)22
1需要 "uri"2require "json"3需要 "net/http"45網址 = URI("mainnet")6https = 網::HTTP.new(url.主機, 網址.port)7https.use_ssl = true8請求 = 淨額::HTTP::POST.新增(網址)9請求["Content-Type"] = "application/json"10請求。主體 = JSON.dump({11action: {12類型: "updateLeverage",13asset: 0,14isCross: true,15槓桿: 1016},17nonce: 1234567890,18signature: {19r: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",20s: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",21v: 2822}23})24回應 = https.請求(請求)25puts 回應。read_body26
1需要 "uri"2require "json"3需要 "net/http"45網址 = URI("mainnet")6https = 網::HTTP.new(url.主機, 網址.port)7https.use_ssl = true8請求 = 淨額::HTTP::POST.新增(網址)9請求["Content-Type"] = "application/json"10請求。主體 = JSON.dump({11action: {12類型: "updateLeverage",13asset: 0,14isCross: true,15槓桿: 1016},17nonce: 1234567890,18signature: {19r: "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890ab",20s: "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12",21v: 2822}23})24回應 = https.請求(請求)25puts 回應。read_body26