UNPKG

vibe-stocks

Version:

Terminal-based stock market viewer with real-time data streaming

87 lines (76 loc) 2.69 kB
#!/usr/bin/env node const { program } = require('commander'); const chalk = require('chalk'); const boxen = require('boxen'); const path = require('path'); // ASCII art logo const logo = ` ${chalk.cyan(` _ _ _ _ _____ _ _ | | | (_) | / ___| | | | | | | |_| |__ ___ \\ \`--.| |_ ___ ___| | _____ | | | | | '_ \\ / _ \\ \`--. \\ __/ _ \\ / __| |/ / __| \\ \\_/ / | |_) | __//\\__/ / || (_) | (__| <\\__ \\ \\___/|_|_.__/ \\___\\____/ \\__\\___/ \\___|_|\\_\\___/ `)} ${chalk.gray('Terminal Stock Market Viewer')} `; // Display welcome message console.log(boxen(logo, { padding: 1, margin: 1, borderStyle: 'round', borderColor: 'cyan' })); program .name('vibe-stocks') .description('Terminal-based stock market viewer with real-time data') .version('1.0.0'); program .command('stream [symbols...]') .description('Stream real-time quotes for specified symbols') .option('-c, --compact', 'Compact display mode') .option('-i, --interval <ms>', 'Update interval', '5000') .action((symbols, options) => { require('../lib/stream').run(symbols, options); }); program .command('market') .description('Interactive market overview with multiple views') .option('-t, --top <number>', 'Number of top stocks to show', '50') .action((options) => { require('../lib/market').run(options); }); program .command('sp500') .description('Track all S&P 500 constituents with extreme mover alerts') .option('-t, --threshold <percent>', 'Alert threshold percentage', '3') .option('-e, --extreme-only', 'Show only extreme movers') .action((options) => { require('../lib/sp500').run(options); }); program .command('quote <symbol>') .description('View comprehensive quote page for a symbol') .action((symbol) => { require('../lib/quote').run(symbol); }); program .command('chart <symbol>') .description('Display ASCII price chart for a symbol') .option('-p, --period <period>', 'Time period (1d, 5d, 1m, 3m, 6m, 1y)', '1m') .option('-h, --height <height>', 'Chart height', '15') .action((symbol, options) => { require('../lib/chart').run(symbol, options); }); // Show help if no command provided if (!process.argv.slice(2).length) { program.outputHelp(); console.log('\n' + chalk.yellow('Examples:')); console.log(chalk.gray(' $ vibe-stocks stream AAPL MSFT GOOGL')); console.log(chalk.gray(' $ vibe-stocks market')); console.log(chalk.gray(' $ vibe-stocks sp500 --threshold 2')); console.log(chalk.gray(' $ vibe-stocks quote TSLA')); console.log(chalk.gray(' $ vibe-stocks chart NVDA --period 1y')); } program.parse(process.argv);