npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openbook-cli

v1.1.1

Published

A comprehensive CLI tool for interacting with OpenBook and Serum DEX markets on Solana

Readme

OpenBook CLI

A comprehensive command-line interface for interacting with OpenBook and Serum DEX markets on Solana.

🚀 Features

  • 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

📦 Installation

npm install -g openbook-cli

Or install locally:

npm install openbook-cli

🎯 Quick Start

# 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 --serum

📋 Commands

Fetch Market Data

openbook-cli <market_address>

Fetches real-time market information and order book data.

Add Market to Known Markets

openbook-cli <market_address> --add

Adds a market to the persistent storage for future quick access.

List Known Markets

# List OpenBook markets
openbook-cli --list

# List Serum markets
openbook-cli --list --serum

🔍 Auto-Detection

The CLI automatically detects whether a market belongs to OpenBook or Serum by checking the market account owner:

  • OpenBook: srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX
  • Serum: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin

📊 Data Storage

The CLI maintains separate files for different market types in the installation directory:

  • known_openbook_markets.json - OpenBook markets and token symbols
  • known_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-cli

📈 Order Book Data

The 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)

Market Statistics

  • 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

🛠️ Development

Prerequisites

  • Node.js >= 16.0.0
  • TypeScript

Setup

git clone https://github.com/belivenn/openbook-cli.git
cd openbook-cli
npm install

Build

npm run build

Development

npm run dev

📝 Examples

Basic Market Fetch

# Fetch any market (auto-detects type)
openbook-cli Gc4tfUHRNnpVwvASfQD3q26G8GNmLYuz4KzB4QNkNuiQ

Add New Markets

# Add OpenBook market
openbook-cli EgnTFXgaQ8CzVSQJyTD2sT3Yx8esLgKf5e6YGvQfm2U7 --add

# Add Serum market
openbook-cli 8nqjw5UVN65GyfdqiXnfJNbDVBgbk8RpFFd7uACXenbx --add

List Markets

# List OpenBook markets
openbook-cli --list

# List Serum markets
openbook-cli --list --serum

Check Market Files Location

# 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/*.json

🔧 Configuration

The CLI uses the following configuration:

  • RPC Endpoint: Default Solana RPC
  • Market Files: Stored in the current directory
  • Token Symbols: Cached for faster access

🚨 Error Handling

Common Issues

  1. Market not found: Invalid market address
  2. Network issues: Connection problems to Solana RPC
  3. Token metadata unavailable: Missing Metaplex data
  4. Program ownership mismatch: Market belongs to different program

Error Messages

  • ❌ Market account not found - Invalid market address
  • ❌ Market verification failed - Program ownership issue
  • No Metaplex metadata found - Token symbol resolution failed

📊 Performance

Response Times

  • Known markets: ~2-3 seconds
  • Unknown markets: ~3-5 seconds (includes metadata fetch)
  • Order book data: ~1-2 seconds

Network Usage

  • Each market fetch requires multiple RPC calls
  • Order book data is fetched in real-time
  • Token metadata is cached after first fetch

🔒 Security

Data Sources

  • All data comes directly from Solana blockchain
  • No third-party API dependencies
  • Real-time verification of market ownership

Market Validation

  • Verifies market account exists
  • Checks program ownership
  • Validates token mint addresses

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request