A comprehensive command-line interface for interacting with OpenBook and Serum DEX markets on Solana.
- Auto-detection: Automatically detects OpenBook vs Serum markets
- Real-time data: Fetches live order book data from the blockchain
- Market management: Add and list known markets
- Universal support: Works with any market address (known or unknown)
- Separate storage: Maintains separate files for OpenBook and Serum markets
npm install -g openbook-cliOr install locally:
npm install openbook-cli# Fetch market data (auto-detects OpenBook/Serum)
openbook-cli Gc4tfUHRNnpVwvASfQD3q26G8GNmLYuz4KzB4QNkNuiQ
# Add market to known markets
openbook-cli 8nqjw5UVN65GyfdqiXnfJNbDVBgbk8RpFFd7uACXenbx --add
# List OpenBook markets
openbook-cli --list
# List Serum markets
openbook-cli --list --serumopenbook-cli <market_address>Fetches real-time market information and order book data.
openbook-cli <market_address> --addAdds a market to the persistent storage for future quick access.
# List OpenBook markets
openbook-cli --list
# List Serum markets
openbook-cli --list --serumThe CLI automatically detects whether a market belongs to OpenBook or Serum by checking the market account owner:
- OpenBook:
srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX - Serum:
9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
The CLI maintains separate files for different market types in the installation directory:
known_openbook_markets.json- OpenBook markets and token symbolsknown_serum_markets.json- Serum markets and token symbols
File Location: The market files are stored in the CLI's installation directory:
~/.nvm/versions/node/v24.2.0/lib/node_modules/openbook-cli/dist/
You can find the exact location by running:
npm list -g openbook-cliThe CLI fetches live order book data directly from the blockchain:
- Bids: Buy orders sorted by price (highest first)
- Asks: Sell orders sorted by price (lowest first)
- Depth: Configurable depth (default: 15 levels)
- Total Bids/Asks: Number of orders on each side
- Best Bid/Ask: Highest bid and lowest ask prices
- Spread: Difference between best ask and best bid
- Spread %: Spread as a percentage of best bid
- Node.js >= 16.0.0
- TypeScript
git clone https://github.com/belivenn/openbook-cli.git
cd openbook-cli
npm installnpm run buildnpm run dev# Fetch any market (auto-detects type)
openbook-cli Gc4tfUHRNnpVwvASfQD3q26G8GNmLYuz4KzB4QNkNuiQ# Add OpenBook market
openbook-cli EgnTFXgaQ8CzVSQJyTD2sT3Yx8esLgKf5e6YGvQfm2U7 --add
# Add Serum market
openbook-cli 8nqjw5UVN65GyfdqiXnfJNbDVBgbk8RpFFd7uACXenbx --add# List OpenBook markets
openbook-cli --list
# List Serum markets
openbook-cli --list --serum# Find where market files are stored
npm list -g openbook-cli
ls -la $(npm list -g openbook-cli | grep openbook-cli | awk '{print $2}')/dist/*.jsonThe CLI uses the following configuration:
- RPC Endpoint: Default Solana RPC
- Market Files: Stored in the current directory
- Token Symbols: Cached for faster access
- Market not found: Invalid market address
- Network issues: Connection problems to Solana RPC
- Token metadata unavailable: Missing Metaplex data
- Program ownership mismatch: Market belongs to different program
β Market account not found- Invalid market addressβ Market verification failed- Program ownership issueNo Metaplex metadata found- Token symbol resolution failed
- Known markets: ~2-3 seconds
- Unknown markets: ~3-5 seconds (includes metadata fetch)
- Order book data: ~1-2 seconds
- Each market fetch requires multiple RPC calls
- Order book data is fetched in real-time
- Token metadata is cached after first fetch
- All data comes directly from Solana blockchain
- No third-party API dependencies
- Real-time verification of market ownership
- Verifies market account exists
- Checks program ownership
- Validates token mint addresses
MIT License - see LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request