Skip to content

DeGrandis/stock_cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

📈 Stock Price CLI

Command-line tool for getting real-time stock prices, historical data, and market analysis from Yahoo Finance.

📦 Installation

npx skills add DeGrandis/stock_cli

No dependencies required - uses only Node.js built-in modules (https).

Usage

Get Current Price

node index.js price <SYMBOL>

Get Historical Data

node index.js history <SYMBOL> [range]

Available ranges: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max

Output

Price Command

Returns current market data:

  • Current Price: Latest trading price
  • Daily Change: Dollar amount and percentage change
  • Last Update: Timestamp of quote

History Command

Returns comprehensive historical analysis:

  • Summary Statistics: Starting/ending price, total change, period high/low
  • Volatility Metrics: Price range and percentage volatility
  • Volume Analysis: Average daily trading volume
  • Recent Prices Table: Last 10 days with close, high, low, volume

Examples

Current Prices

# Apple stock price 🍎
node index.js price AAPL

# Bitcoin price in USD ₿
node index.js price BTC-USD

# S&P 500 Index 📊
node index.js price ^GSPC

Historical Data

# Apple stock over last month 📅
node index.js history AAPL 1mo
# Output:
# === AAPL Historical Data (1mo) ===
# Period: 1/21/2026 to 2/20/2026
# Data Points: 22 days
# 
# SUMMARY:
# Starting Price: $247.65
# Ending Price:   $264.58
# Change:         +$16.93 (+6.84%)
# Period High:    $280.91
# Period Low:     $244.68
# Volatility:     $36.23 (14.81%)
# Avg Volume:     54.94M shares/day

# Tesla over the past year 🚗
node index.js history TSLA 1y

# Bitcoin 6-month trend ₿
node index.js history BTC-USD 6mo

# S&P 500 year-to-date performance 📈
node index.js history ^GSPC ytd

Supported Symbols

  • Stocks: Use ticker symbols (AAPL, MSFT, GOOGL, etc.)
  • Cryptocurrencies: Use format CRYPTO-USD (BTC-USD, ETH-USD, etc.)
  • Market Indices: Use ^ prefix (^GSPC for S&P 500, ^DJI for Dow Jones)
  • ETFs: Standard ticker symbols (SPY, QQQ, etc.)

Features

  • 📊 Real-time Prices: Current market data with daily changes
  • 📈 Historical Analysis: Price trends with summary statistics
  • 💹 Volatility Metrics: Period highs, lows, and price ranges
  • 📉 Volume Analysis: Trading activity and average volume
  • 🔍 Recent Data Table: Last 10 days of trading with full OHLC data
  • 🌍 Multi-Asset Support: Stocks, crypto, indices, and ETFs
  • Zero Dependencies: Pure Node.js with built-in https module

Use Cases

For LLMs/AI Agents:

  • Trend Analysis 📊: "Has AAPL been going up or down this month?"
  • Comparison ⚖️: "Which is more volatile, TSLA or AAPL?"
  • Pattern Detection 🔍: Identify volume spikes and price drops
  • Investment Advice 💡: Provide context with historical performance
  • Summary Statistics 📝: Quick answers without parsing full data

For Users:

  • Check current stock prices
  • Analyze price trends over time
  • Compare performance across periods
  • Identify trading opportunities
  • Track portfolio performance
  • Research investment options

Technical Details

  • Zero dependencies: Uses only Node.js built-in https module
  • Data Source: Yahoo Finance API (query1.finance.yahoo.com)
  • Update Frequency: Real-time during market hours
  • No authentication required: Public data endpoint
  • LLM-Optimized Output: Summary statistics + tabular data for easy parsing

Notes

  • Prices update in real-time during market hours
  • After-hours data may be delayed
  • Cryptocurrency prices update 24/7
  • Some symbols may require specific formatting (check Yahoo Finance for correct format)

License

MIT

About

Command-line tool for getting real-time stock prices, daily changes, and market data from Yahoo Finance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors