Hibit: Omni-chain DEX with CEX-level performance
  • Overview
    • Why Hibit DEX
    • Hibit L1 Features
  • Core mechanisms
    • 📜Hybrid Consensus Protocol
    • 🔍AI-Driven Tokenization & Intelligent Interactions
    • ⛽Omni-Chain Compatibility
    • 🧠AI-Powered Liquidity & Order Matching Engine
    • 🧩Scalable & Sustainable Cross-Chain Solutions
    • 💻Development Achievements
    • 💠Transparency & Open Infrastructure
  • AI-Driven Future and Ecosystem
    • 📏Trading Hub
    • 🐶Meme Economy
    • 💸AI-Integrated Wallet
    • 💱Payment System
    • 🌲Infrastructure and Ecosystem
  • Get started
    • 🔑Login
    • 💵Deposit
    • 📊Trade
    • 💰Fee Structure
    • ⛲Withdrawal
    • 🚀Token Listing
      • 🌟Basic mode
      • 🎓Pro mode
    • 💳Manage Liquidity
    • 💸Liquidity Provider
    • ❓Q & A
      • Why Swap Orders Get Cancelled?
  • Developers
    • API
      • Basic
        • get timestamp
        • get chains
        • get assets
        • get asset
      • Market
        • get markets
        • get market
        • get 24hr ticker
        • get extended 24‑hr ticker
        • get kline
        • get swap info
        • get depth
        • get trade history
      • Order
        • get orders
        • get order
        • get trades of order
        • submit spot order
        • cancel spot order
      • Wallet
        • get nonce
        • get balances
      • Broker
        • Get payment address
        • Quote
        • Swap
        • Get agent order
    • Dev SDK
    • Getting Your Proxy Key
  • Risk Management
  • Rewards Program
  • Roadmap
  • Glossary
Powered by GitBook
On this page
  1. Developers
  2. API
  3. Order

submit spot order

Previousget trades of orderNextcancel spot order

Last updated 23 days ago

API details

This API enables placing orders in the spot market, supporting both limit orders and swap orders.

Code example

Limit order

import { hibitClient } from '@delandlabs/hibit-sdk';

const options = {
  network: HibitNetwork.Testnet,
  hin: 10000n,
  proxyKey:"your proxy key in hexadecimal (hex) format"
};
hibitClient.setOptions(options);

// get base and quote asset of the market
const baseAsset = ...;
const quoteAsset = ...;

const decimalOptions: DecimalOptions = {
  baseAssetDecimals: Number(baseAsset.decimalPlaces),
  quoteAssetDecimals: Number(quoteAsset.quoteAssetDecimals)
};

const submitLimitOrderReq: SubmitSpotOrderInput = {
  marketId: BigInt(10006n),
  orderCategory: OrderCategory.LimitOrder,
  limitOrderDetails: {
    orderSide: OrderSide.Ask,
    price: 17.32,
    volume: 100.8
  }
};

await client.submitSpotOrder(submitLimitOrderReq, decimalOptions);

Swap order

import { hibitClient } from '@delandlabs/hibit-client';

const options = {
  baseUrl: 'https://testnetopenapi.hibit.app',
  hin: 10000n,
  proxyKey:"your proxy key in hexadecimal (hex) format"
};
hibitClient.setOptions(options);

// get base and quote asset of the market
const baseAsset = ...;
const quoteAsset = ...;

const decimalOptions: DecimalOptions = {
  baseAssetDecimals: Number(baseAsset.decimalPlaces),
  quoteAssetDecimals: Number(quoteAsset.quoteAssetDecimals)
};

const submitSwapOrderReq: SubmitSpotOrderInput = {
  marketId: BigInt(10006n),
  orderCategory: OrderCategory.SwapOrder,
  swapV2OrderDetails: {
    orderSide: OrderSide.Ask,
    exactTokensType: SwapV2ExactTokensType.Source,
    exactTokens: 1000.12,
    minOut: 1000.00
  }
};

await client.submitSpotOrder(submitSwapOrderReq, decimalOptions);

SDK

References

Source code

https://github.com/Deland-Labs/hibit-sdk
What is HIN?
How to Obtain your HIN and Proxy Key?
  • API details
  • POSTSubmit a spot order
  • Code example
  • SDK
  • References

Submit a spot order

post
Body
typestringOptional
userIdstringOptional
noncestringOptional
messagestringOptional
hashstringOptional
signaturestringOptional
Responses
200
OK
400
Bad Request
401
Unauthorized
403
Forbidden
404
Not Found
500
Internal Server Error
501
Not Implemented
post
POST /v1/tx/submit-spot-order HTTP/1.1
Host: testnetopenapi.hibit.app
Content-Type: application/json
Accept: */*
Content-Length: 96

{
  "type": "text",
  "userId": "text",
  "nonce": "text",
  "message": "text",
  "hash": "text",
  "signature": "text"
}
{
  "code": 1,
  "message": "text",
  "data": {}
}