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

@agrigoryan/questrade-cli

v0.1.0

Published

CLI for the Questrade API. Agent-friendly, JSON-first output.

Downloads

52

Readme

questrade-cli

CLI for the Questrade API. JSON-first output, agent-friendly. Built on @agrigoryan/questrade-api.

Features

  • Full Questrade v1 API coverage (accounts, markets, symbols, orders)
  • Real-time L1 quote and notification streaming via WebSocket (JSONL)
  • OAuth2 authentication with automatic token refresh
  • JSON output by default, table/CSV via --format
  • Auto-resolves account ID from flag, env var, or primary account
  • Named profiles for multi-account setups

Install

bun add -g @agrigoryan/questrade-cli
# or
npm install -g @agrigoryan/questrade-cli

Quick Start

# Authenticate with a refresh token from Questrade API Hub
questrade auth login --refresh-token <token>

# List accounts
questrade accounts list

# Get positions
questrade accounts positions

# Search for a symbol
questrade symbols search --prefix AAPL

# Get a quote
questrade markets quote --ids 8049

Or skip the login step with environment variables:

export QUESTRADE_REFRESH_TOKEN="<token>"
export QUESTRADE_ACCOUNT_ID="<account_number>"

questrade accounts balances

Authentication

Questrade uses OAuth2. Get a refresh token from the Questrade API Hub.

Refresh Token Flow

questrade auth login --refresh-token <token>

Authorization Code Flow (partner apps)

questrade auth callback --code <code> --client-id <id> --redirect-uri <uri>

Practice (Demo) Account

questrade auth login --refresh-token <token> --practice

Check Status / Revoke

questrade auth status
questrade auth revoke

Credentials are stored in ~/.config/questrade-cli/auth.json. For named profiles: ~/.config/questrade-cli/profiles/<name>/auth.json.

Account Resolution

Commands that need an account number resolve it automatically:

  1. --account <id> flag (highest priority)
  2. QUESTRADE_ACCOUNT_ID env var
  3. Primary account from API
  4. If ambiguous: errors with available account list

Commands

Server Time

questrade time

Accounts

questrade accounts list
questrade accounts positions [--account <id>]
questrade accounts balances [--account <id>]
questrade accounts orders [--account <id>] [--start <iso>] [--end <iso>] [--state All|Open|Closed] [--order-id <id>]
questrade accounts executions [--account <id>] [--start <iso>] [--end <iso>]
questrade accounts activities [--account <id>] --start <iso> --end <iso>

Symbols

questrade symbols search --prefix AAPL [--offset <n>]
questrade symbols get --ids 8049,9292
questrade symbols get --names AAPL,MSFT
questrade symbols options --id 8049

Market Data

questrade markets list
questrade markets quote --ids 8049,9292
questrade markets candles --id 8049 --start <iso> --end <iso> --interval OneDay
questrade markets quote-options --body-file <path>
questrade markets quote-options --underlying <id> --expiry <date> [--type Call|Put] [--min-strike N] [--max-strike N]
questrade markets quote-strategies --body-file <path>

Candle Intervals

OneMinute, TwoMinutes, ThreeMinutes, FourMinutes, FiveMinutes, TenMinutes, FifteenMinutes, TwentyMinutes, HalfHour, OneHour, TwoHours, FourHours, OneDay, OneWeek, OneMonth, OneYear

Orders

Requires partner/trade scope.

questrade orders create [--account <id>] --body-file <path>
questrade orders update [--account <id>] --order-id <id> --body-file <path>
questrade orders cancel [--account <id>] --order-id <id>
questrade orders impact [--account <id>] --body-file <path>

Streaming

questrade stream quotes --ids 8049,9292
questrade stream notifications

Streams output one JSON object per line (JSONL). Runs until interrupted.

Warning: Streaming quotes freezes market data in other Questrade IQ platforms.

Global Flags

| Flag | Description | |---|---| | --format <json\|table\|csv> | Output format (default: json) | | --profile <name> | Config profile (default: "default") | | --account <id> | Account number | | --help | Show help | | --version | Show version |

Environment Variables

| Variable | Purpose | |---|---| | QUESTRADE_REFRESH_TOKEN | Auto-login without auth login | | QUESTRADE_ACCOUNT_ID | Default account for account-scoped commands | | QUESTRADE_PRACTICE | 1 = use practice/demo server | | QUESTRADE_PROFILE | Same as --profile |

Exit Codes

| Code | Meaning | |---|---| | 0 | Success | | 1 | API error | | 2 | Auth error | | 3 | Usage error |

Development

bun install
bun run dev                # run from source
bun run typecheck          # type-check only
bun run build              # bundle to dist/

License

MIT