bloXroute Documentation
WebsiteBlogTwitterDiscord
  • Welcome to bloXroute
  • Introduction
    • Why Use bloXroute?
    • Products
    • Create An Account
    • Technical Support
  • SOLANA
    • Trader API
      • Introduction
        • Regions
        • Authorization
        • Rate Limits
        • Tip and Tipping Addresses
      • Quick Start
        • Transaction Submission
        • Front-Running Protection & Transaction Bundle
        • Go SDK
        • Python SDK
        • Typescript SDK
        • Rust SDK
      • API Endpoints
        • Core Endpoints
          • submit
          • submit-paladin
          • submit-batch
          • balance
          • rate-limit
          • transaction
          • priority-fee
          • GetPriorityFeeStream
          • GetBundleTipStream
          • submit-snipe
        • Pump.fun
          • quotes
          • swap
          • swap-sol
          • GetPumpFunNewTokensStream
          • GetPumpFunSwapsStream
          • GetPumpFunAMMSwapsStream
        • Raydium
          • quotes
          • pools
          • pool-reserves
          • swap
          • cpmm-swap
          • clmm-swap
          • route-swap
          • GetPoolReservesStream
          • GetSwapsStream
          • GetNewRaydiumPoolsStream
          • GetNewRaydiumPoolsByTransactionStream
        • Jupiter
          • quotes
          • swap
          • swap-instructions
          • route-swap
        • Openbook
          • markets
          • orderbooks/{market}
          • depth/{market}
          • tickers/{market}
          • open-orders/{market}
          • unsettled/{market}
          • place
          • replace
          • cancel
          • settle
          • GetOrderbooksStream
          • GetTickersStream
      • Best Performance for Landing Transactions
      • Support
        • API Health
        • Contact us
        • Suggestions
        • Wiki
          • Terms & Concepts
          • Resources
    • Optimized Feed Relay (OFR)
      • Transaction Streamer
      • Gateway and OFR Requirements
      • Gateway and OFR Setup
      • Gateway Startup Arguments
      • OFR performance
      • Logging
      • Submitting Transaction
      • Upgrading Gateway
      • Troubleshooting
  • BSC & ETH
    • EVM Blockchain Distribution Network (BDN)
      • How to Connect
      • The bloXroute Gateway
        • Local Gateway
          • Installation and Startup
            • Authentication & Certificates
            • Requirements
            • Supported Clients
            • GitHub repository option
            • Docker container option
            • Startup Script
            • Startup Arguments
          • General Connectivity Troubleshooting
          • Logging
          • Upgrading your Gateway
        • Add Your Gateway as a Trusted Peer to Your Execution Layer Client
        • Connecting Your Gateway with the Consensus Layer
      • IPs & Relays
        • Relays IPs
        • Private Relays
        • Cloud-API IPs
          • ⏩Reducing Latencies using the BDN
    • APIs
      • Authorization
      • Check Transaction Quota
      • Submit a Transaction
        • Raw Transaction Construction
        • Tx-Validation
        • Batch Transaction
      • Private Transactions
        • ETH Private Transactions
        • BSC Private Transactions
      • Transaction Bundles
        • Bundle Simulation
        • Bundle Validation
        • Bundle Submission
          • BSC Bundle Submission
            • List of BSC Validators
          • ETH Bundle Submission
          • Bundle Submission with Gateway
        • Bundle Tracking
          • BSC Bundle-Trace
          • ETH Bundle-Trace
          • ETH Bundle Inclusion Status
        • Bundle Refunds
          • Priority Fee Refund
          • Bundle Refund
          • Latest Bundle Refunds
      • Backrun Arbitrage
        • BackRunMe: Bundle Submission
          • BSC submit arbOnly
          • ETH submit arbOnly
            • blxr_info
            • ETH arbOnly Simulation
      • Token Launch Sniping
      • Other Utilities
        • List of bloXroute Builders
        • List of External Builders
        • Tx-Trace
        • Ping
    • Streams
      • Requirements
      • Subscription limits
      • Working With Streams
        • Creating a Subscription
          • Websocket
          • gRPC
        • Handling the Notification
          • Websocket
          • gRPC
        • Cancelling a Subscription
          • Websocket
          • gRPC
        • Local Node Validation
      • newTxs and pendingTxs
        • Filters
        • Raw TX Reconstruction
      • BackRunMe: arbOnlyMEV
        • ETH arbOnlyMEV
        • BSC arbOnlyMEV
      • transactionStatus
      • txReceipts
      • newBlocks
      • bdnBlocks
      • ethOnBlock
      • MEVBlockValue
      • MEVNextProposerInfo
    • Block Builders and Validators
      • Validator Gateway
      • MEV Relay (For Validators)
      • Block Submission
      • Proposer MEV-Protect
      • Compliance Lists
      • Preconfirmations
    • Protect RPCs
      • ETH Protect RPC
      • ETH Gas Protect RPC
      • BSC Protect RPC
      • SOL Protect RPC
  • Base Network
    • Submit Transactions
    • Streams
      • GetBdnBlockStream
  • TON NETWORK
    • TON Trader API
      • Quick Start
      • Fee Schedule
      • Connection
      • Submit Signed Transaction
  • Resources
    • BDN Explorer
    • Block Explorer
    • Guides
      • Algorithmic Trading
      • Setting Up a Local Gateway
      • Gateway as Web3 Bridge
    • Architecture
      • BDN Architecture
        • Network Components
        • Performance Techniques
          • Block Compression
          • Cut-through Routing
          • Optimized Topology
      • bloXroute Protocol
        • Versioning
        • Message Structure
        • Message Types
    • Contact Us
Powered by GitBook
On this page
  • Summary
  • Find Openbook market (trading pair)
  • Get Orderbook
  1. SOLANA
  2. Trader API
  3. Tutorials

Get Market Info - Openbook

Summary

This section serves as a basic guideline to help new user to get started. The very first step is getting market information.

Find Openbook market (trading pair)

Project Openbook has various markets (think of them as trading pairs in traditional exchanges).

The easiest way to find the market you want to trade in and its name is using the GET markets endpoint which will return all markets preloaded in Openbook API.

$ curl 'http://uk.solana.dex.blxrbdn.com/api/v2/openbook/markets' -H "Authorization: <YOUR-AUTHORIZATION-HEADER>" 
{
   "markets":{
      "AAVE/USDC":{
         "market":"AAVE/USDC",
         "status":"MS_ONLINE",
         "address":"8WZrmdpLckptiVKd2fPHPjewRVYQGQkjxi9vzRYG1sfs"
      },
      "AAVE/USDT":{
         "market":"AAVE/USDT",
         "status":"MS_ONLINE",
         "address":"LghsMERQWQFK3zWMTrUkoyAJARQw2wSmcYZjexeN3zy"
      },
      // ...
}

In the response you'll see the names of the markets and their marketAddress, which represents their program address. You can use either value in most Serum API endpoints.

One quick note on market names: avoid the / format in HTTP endpoints. For example, instead of SOL/USDC use SOLUSDC or SOL:USDC. You can freely use SOL/USDC in WebSockets and GRPC.

For the rest of this tutorial, we will be using the SOL/USDC market.

Get Orderbook

Openbook DEX is orderbook based. In order to get the most out of this decentralized trading platform, we recommend using the streaming API to get notifications on the orderbook changes. You can use the GET orderbooks endpoint for the development processes and/or parallel to the streaming. We provide WebSocket & gRPC based streaming service for this endpoint.

$ curl 'https://uk.solana.dex.blxrbdn.com/api/v2/openbook/orderbooks/SOLUSDC?limit=3' -H "Authorization: <YOUR-AUTHORIZATION-HEADER>" 
{
   "market":"SOL/USDC",
   "marketAddress":"9wFFyRfZBsuAha4YcuxcXLKwMxJR43S7fPfQLusDBzvT",
   "bids":[
      {
         "price":34.602,
         "size":1257.5
      },
      {
         "price":34.643,
         "size":628
      },
      {
         "price":34.664,
         "size":313.8
      }
   ],
   "asks":[
      {
         "price":34.718,
         "size":180
      },
      {
         "price":34.863,
         "size":156.8
      },
      {
         "price":34.874,
         "size":313.6
      }
   ]
}

In this example response, you can see the best three bids and asks in the SOL/USDC market. The best bid wants to buy 10 SOL at the price of 34.664 SOL per USDC. To contrast, the best ask wants to sell 180 SOL at the price of 34.718 SOL per USDC.

$ wscat -c wss://uk.solana.dex.blxrbdn.com/ws --wait 1000 --execute '{"jsonrpc": "2.0", "id": 1, "method": "GetOrderbooksStream", "params": {"market": "SOL/USDC", "limit": 3}}'

{"id":1,"result":{"blockHeight":"138584086","orderbook":{"market":"SOL/USDC","marketAddress":"9wFFyRfZBsuAha4YcuxcXLKwMxJR43S7fPfQLusDBzvT","bids":[{"price":34.583,"size":228.4},{"price":34.59,"size":314.1},{"price":34.6,"size":157}],"asks":[{"price":34.713,"size":180},{"price":34.788,"size":157},{"price":34.799,"size":314}]}},"jsonrpc":"2.0"}

{"id":1,"result":{"blockHeight":"138584086","orderbook":{"market":"SOL/USDC","marketAddress":"9wFFyRfZBsuAha4YcuxcXLKwMxJR43S7fPfQLusDBzvT","bids":[{"price":34.583,"size":228.4},{"price":34.59,"size":314.1},{"price":34.6,"size":157}],"asks":[{"price":34.723,"size":180},{"price":34.788,"size":157},{"price":34.799,"size":314}]}},"jsonrpc":"2.0"}

Note here that the two responses from the stream may be identical depending on your limit parameter and we don't aggregate orders with the same price. Typically, duplicate responses from the stream indicate that some other activity has happened in the orderbook, though your specific filtering criteria masks the changes (as of v0.1).

Refer to API Stream - Orderbooks for more information.

Last updated 4 months ago