A command line interface for interacting with the Schwab Trader API.
- Market Data: Real-time quotes, options chains, historical data, instrument search, and market movers
- Instrument Search: Search by symbol or description with fundamental data support
- Account Management: View positions, balances, and transaction history
- Order Management: View orders and place simple MARKET/LIMIT orders
- Caching: Redis-backed caching for improved performance
- Node.js >= 20.0.0
- Redis (for caching)
- Schwab API credentials (via huskly.finance)
npm install -g @huskly/cli
git clone https://github.com/huskly/cli.git
cd cli
npm install
npm run build# Login via huskly.finance auth
huskly-cli auth login
# Check authentication status
huskly-cli auth status
# Logout
huskly-cli auth logoutGet current price quotes for one or more symbols.
huskly-cli quote AAPL
huskly-cli quote AAPL MSFT GOOGLSearch for instruments by symbol or description. Supports multiple search modes including fundamental data retrieval.
# Search by symbol prefix (default)
huskly-cli search AAPL
# Search by symbol using regex
huskly-cli search "^AA" --projection symbol-regex
# Search by description
huskly-cli search "Apple" --projection desc-search
# Search description with regex
huskly-cli search "tech.*inc" --projection desc-regex
# Get fundamental data for a symbol
huskly-cli search AAPL --projection fundamentalOptions:
-p, --projection <type>- Search type (default: symbol-search)symbol-search- Search by symbol prefixsymbol-regex- Search by symbol using regex patterndesc-search- Search by description textdesc-regex- Search description using regex patternsearch- General searchfundamental- Get detailed fundamental data (P/E, EPS, market cap, dividends, margins, etc.)
Get the top 10 movers for a specific index or market segment.
# Get top movers for Dow Jones Industrial Average
huskly-cli movers '$DJI'
# Get top movers for S&P 500 sorted by percent change up
huskly-cli movers '$SPX' --sort PERCENT_CHANGE_UP
# Get NASDAQ movers sorted by volume
huskly-cli movers NASDAQ --sort VOLUME
# Get all equity movers with 5-minute frequency
huskly-cli movers EQUITY_ALL --frequency 5Arguments:
<index>- Index symbol:$DJI,$COMPX,$SPX,NYSE,NASDAQ,OTCBB,INDEX_ALL,EQUITY_ALL,OPTION_ALL,OPTION_PUT,OPTION_CALL
Options:
-s, --sort <type>- Sort by:VOLUME,TRADES,PERCENT_CHANGE_UP,PERCENT_CHANGE_DOWN-f, --frequency <minutes>- Frequency in minutes: 0, 1, 5, 10, 30, 60 (default: 0)
Get historical price data for a symbol.
huskly-cli history AAPL
huskly-cli history AAPL --days 30Options:
-d, --days <n>- Number of days of history (default: 10)
Display an ASCII chart of price history.
huskly-cli chart SPY
huskly-cli chart SPY --days 60 --height 20
huskly-cli chart SPY --image # Open image chart in browserOptions:
-d, --days <n>- Number of days of history (default: 30)-h, --height <n>- Chart height in rows (default: 15)-i, --image- Generate image chart and open in browser
Get the current VIX level with sentiment indicator.
huskly-cli vixList available option expiration dates for a symbol.
huskly-cli expiries SPX
huskly-cli expiries SPY --type CALL
huskly-cli expiries AAPL --from 2024-01-01 --to 2024-06-30Options:
-t, --type <type>- Contract type: PUT or CALL (default: PUT)-f, --from <date>- Start date (YYYY-MM-DD)-e, --to <date>- End date (YYYY-MM-DD)
Get the options chain for a symbol and expiration date.
huskly-cli chain SPX
huskly-cli chain SPX 2024-12-20
huskly-cli chain AAPL --around 180 --strikes 5Options:
-a, --around <strike>- Filter strikes around this price (defaults to last price)-s, --strikes <count>- Number of strikes to show above/below center (default: 10)
Show account equity and net liquidation value.
huskly-cli accountShow all account positions, optionally filtered by symbol.
huskly-cli positions
huskly-cli positions AAPLList account transaction history.
huskly-cli transactions
huskly-cli transactions --start 2024-01-01 --end 2024-12-31Options:
-s, --start <date>- Start date (YYYY-MM-DD, defaults to start of year)-e, --end <date>- End date (YYYY-MM-DD, defaults to today)
List account orders with optional filtering.
huskly-cli orders
huskly-cli orders --from 2024-01-01 --to 2024-12-31
huskly-cli orders --status FILLED
huskly-cli orders --max-results 10Options:
-f, --from <date>- From entered time (YYYY-MM-DD, defaults to 30 days ago)-t, --to <date>- To entered time (YYYY-MM-DD, defaults to today)-s, --status <status>- Filter by order status (FILLED, WORKING, CANCELED, etc.)-m, --max-results <n>- Maximum number of orders to retrieve
Place an order for equities.
# Market order to buy 10 shares of AAPL
huskly-cli place-order AAPL 10 BUY
# Limit order to buy 5 shares of MSFT at $400
huskly-cli place-order MSFT 5 BUY --type LIMIT --price 400
# Market order to sell 20 shares
huskly-cli place-order GOOGL 20 SELL
# Sell short with Good Till Cancel duration
huskly-cli place-order SPY 100 SELL_SHORT --duration GOOD_TILL_CANCELArguments:
<symbol>- Stock symbol to trade<quantity>- Number of shares<instruction>- Order instruction: BUY, SELL, BUY_TO_COVER, SELL_SHORT
Options:
-t, --type <type>- Order type: MARKET or LIMIT (default: MARKET)-p, --price <price>- Limit price (required for LIMIT orders)-s, --session <session>- Trading session: NORMAL, AM, PM, SEAMLESS (default: NORMAL)-d, --duration <duration>- Order duration: DAY, GOOD_TILL_CANCEL, FILL_OR_KILL, IMMEDIATE_OR_CANCEL (default: DAY)
Start an interactive REPL to run multiple commands without re-authenticating.
huskly-cli replsrc/
├── auth/ # Authentication (huskly.finance device auth)
├── cli/ # CLI commands
├── schwab/ # Schwab API integration
├── types.ts # TypeScript type definitions
├── cache.ts # Redis caching layer
├── helpers.ts # Utility functions
├── logger.ts # Logging configuration
└── marketDataSource.ts # Market data abstraction
LOG_LEVEL- Set logging level (trace, debug, info, warn, error)REDIS_URL- Redis connection URL (defaults to localhost:6379)
MIT © Huskly Finance