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

topstepx-cli

v1.0.0

Published

CLI tool for the TopStepX / ProjectX Gateway API

Readme

topstepx-cli

Terminal-first CLI for the TopStepX (ProjectX Gateway) trading API.

Features

  • Account Management -- List and inspect trading accounts
  • Market Data -- Search contracts, fetch quotes, retrieve historical bars
  • Order Placement -- Buy and sell with market, limit, stop, stop-limit, and bracket orders
  • Order Management -- List, modify, and cancel orders
  • Position Management -- View, flatten, and trim positions
  • Trade History -- Query past fills with date and symbol filters
  • Real-Time Streaming -- Live quotes, depth-of-book, and time-and-sales
  • Account Monitoring -- Stream order fills, position changes, and trade events

Install

$ npm install -g topstepx-cli

Requires Node.js >= 20.

Quick Start

# 1. Install
$ npm install -g topstepx-cli

# 2. Authenticate
$ topstep login

# 3. View your accounts
$ topstep accounts

Authentication

Log in with your TopStepX username and API key:

$ topstep login

Verify your session:

$ topstep status

Clear stored credentials:

$ topstep logout

Credentials are stored in the OS keychain when available, with an encrypted file fallback for headless environments.

Commands

Account Management

List all active trading accounts:

$ topstep accounts

View account details (balance, P&L, daily loss limit):

$ topstep account 12345

Select a specific account for any command with the --account global flag:

$ topstep positions --account 12345

Market Data

Search for contracts by keyword:

$ topstep contracts ES

View contract details:

$ topstep contract CON.F.US.EP.H26

Fetch a one-shot quote:

$ topstep quotes ES

Retrieve historical bars:

# Last 50 five-minute bars
$ topstep bars ES --interval 5m --count 50

# Date range query
$ topstep bars NQ --interval 1h --from 2025-01-01 --to 2025-01-31

# Daily bars
$ topstep bars ES --interval 1d --count 20

Order Placement

Place a market buy order:

$ topstep buy ES 1

Place a limit sell order:

$ topstep sell ES 1 --limit 5500.00

Place a stop order:

$ topstep buy ES 1 --stop 5400.00

Place a stop-limit order:

$ topstep buy ES 1 --stop-limit 5400 5395

Attach a bracket (stop-loss and take-profit):

$ topstep buy ES 1 --bracket 10 20

Skip the confirmation prompt:

$ topstep buy ES 1 --yes

Tag an order for tracking:

$ topstep sell NQ 2 --limit 19800 --tag "mean-reversion"

Order Management

List open/working orders:

$ topstep orders

Include filled and cancelled orders:

$ topstep orders --all

Filter by symbol:

$ topstep orders --symbol ES

Modify a working order:

$ topstep modify abc123 --limit 5510.00

Cancel a single order:

$ topstep cancel abc123

Cancel all working orders:

$ topstep cancel-all

Position Management

View open positions:

$ topstep positions

Flatten (close) a position:

$ topstep flatten ES

Flatten all positions:

$ topstep flatten

Partially close a position:

$ topstep trim ES 1

Trade History

View recent trades:

$ topstep trades

Filter by date range and symbol:

$ topstep trades --from 2025-01-01 --to 2025-01-31 --symbol ES --limit 100

Streaming

Stream live quotes with in-place updates:

$ topstep watch ES

Include depth-of-book (DOM):

$ topstep watch ES --depth

Include time-and-sales:

$ topstep watch ES --trades

Monitor account events (order fills, position changes, trade executions):

$ topstep monitor

Filter to specific event types:

$ topstep monitor --orders-only
$ topstep monitor --positions-only
$ topstep monitor --trades-only

Press Ctrl+C to exit any streaming command.

Global Flags

| Flag | Description | | ----------------- | ---------------------------------------------- | | --json | Output as JSON instead of a formatted table | | --no-color | Disable colored output (also respects NO_COLOR)| | --verbose | Show API request/response details on stderr | | --account <id> | Use a specific trading account |

Symbol Resolution

Friendly symbols like ES, NQ, MES, CL, and GC are automatically resolved to full contract IDs. You can use either form:

# These are equivalent
$ topstep quotes ES
$ topstep quotes CON.F.US.EP.H26

The resolver maintains a disk-persisted cache with a 24-hour TTL to minimize API lookups.

Scripting and Piping

Use --json for machine-readable output in scripts:

# Get account balance as JSON
$ topstep accounts --json

# Extract specific fields with jq
$ topstep accounts --json | jq '.[0].balance'

# Check position size
$ topstep positions --json | jq '.[] | select(.contractId | contains("ES")) | .qty'

# Place an order without confirmation
$ topstep buy ES 1 --limit 5450 --yes --json

License

MIT