Blast Futures Exchange
  • Get Started
    • 👋Introduction
      • What Is Blast?
    • What are Perpetual Futures?
    • Bridging to Blast
    • Blast Points & Gold
      • Blast Gold Liquidity Program
    • BFX Points
      • Staking $RBX
      • Staking $RBX LP
    • USDB Native Yield
    • Referral Program
    • Index Price
    • Funding Rate
    • Deposit & Withdrawal
    • Trading Fees
    • BFX OTC Service
    • Dynamic Market Maker (DMM)
      • Dynamic Router
    • Profit / Loss Calculation
    • Margin Calculation
    • Insurance Fund
    • Liquidations
  • API DOCUMENTATION
    • Introduction
    • Generate Your API Keys
    • Signing with API Key
    • Public Endpoints
      • Market Info
      • Trades
      • Orderbook
      • Funding Rate
      • Candles
    • Private Endpoints
      • Account Operations
      • Authentication
      • Orders
      • Fills
      • Positions
      • Profile
      • Balance History
      • Deadman Switch
    • Websocket
      • Trades
      • Orderbook
      • Market Info
      • Account
    • Responses Data Structure
    • Vault Setup
  • Frequently Asked Questions
  • Contracts
  • Telegram
  • Discord
  • Audits
Powered by GitBook
On this page
  • Orderbook
  • Guide to managing a local orderbook
  1. API DOCUMENTATION
  2. Public Endpoints

Orderbook

Orderbook

Get market orderbook snapshot.

GET /markets/orderbook
Params
{
market_id: "BTC-USD"
p_limit: 100, // max 1000
p_page: 0, // page starts at 0
p_order: "DESC" // default "DESC" for descending and "ASC" for ascending
}
Response 
{
	market_id string               
	bids      [string, string]  // returns array of (price, quantity)
	asks      [string, string]  // returns array of (price, quantity)
	sequence  uint                 
	timestamp int64               
}

Guide to managing a local orderbook

  1. Open a stream to wss://api.bfx.trade/ws

  2. You will receive an orderbook snapshot upon initial subscribe.

  3. Subsequent websocket events from the orderbook channel will give orderbook updates.

  4. Use the sequence number to keep track.

  5. If a sequence number is skipped, get a depth snapshot from https://api.bfx.trade/markets/orderbook

  6. Drop any event where sequence is <= sequence in the snapshot.

  7. The data in each event is the absolute quantity for a price level.

  8. If the quantity is 0, remove the price level.

PreviousTradesNextFunding Rate

Last updated 9 months ago