A comprehensive, interactive terminal-based stock predictor written in Rust that fetches historical data from Yahoo Finance, performs analysis, and provides price predictions with a user-friendly TUI (Terminal User Interface).
- Interactive TUI: Full-screen terminal user interface with navigation and detailed views
- Stock Analysis: Fetches historical stock data from Yahoo Finance and calculates:
- Simple Moving Average (SMA) 10/50-day
- Exponential Moving Average (EMA) 20-day
- Recent trend percentage
- Price predictions for next days
- Multiple Time Ranges: View charts with different time ranges (1D, 5D, 1M, 6M)
- Detailed View: Rich detail view on stock selection with:
- Price chart with Y-axis labels
- Stock metrics and additional information
- Stock symbol displayed prominently
- Persistent Configuration: Automatically persists stock configurations across app restarts
- Configurable Stocks: Load from persistent storage or specify via CLI
- Stock Management: Edit stocks using the 'e' key:
- Add new stock symbols
- Remove existing symbols
- Save changes to persistent config
- Automatic refresh after saving
There are two ways to install bstock:
cargo install --git https://github.com/Not-Buddy/bstockOr if published to crates.io:
cargo install bstock- Ensure you have Rust installed (1.70 or later)
- Clone the repository:
git clone <repository-url> cd bstock
# Use the default persistent configuration
cargo run
# Specify stocks and period via command line
cargo run -- -s AAPL GOOGL MSFT -p 90-s, --symbols: Specify stock symbols to analyze (e.g.,AAPL GOOGL)-p, --period: Set analysis period in days (default: 90)
- Left/Right Arrow Keys: Navigate between stocks
- Up/Down Arrow Keys: Change time range in main view, navigate in edit mode
- Enter: View detailed stock information
- Escape: Return to main view from detail view
- 'e' Key: Enter stock editing mode
- 'q' or Ctrl+C: Quit the application
When in editing mode (press 'e'):
- Type stock symbol and press Enter to add
- Use Up/Down arrows to select existing symbols
- Press Delete to remove selected symbol
- Press Ctrl+S to save changes to persistent config
- Press Escape to exit editing mode
- The app automatically refreshes with new stocks after saving
Stocks are managed through a persistent configuration system that stores settings in your system's standard config directory (as an internal JSON file):
- On Linux:
~/.config/bstock/config.json - On macOS:
~/Library/Application Support/com.bstock.bstock/config.json - On Windows:
C:\Users\<username>\AppData\Roaming\bstock\config.json
The application automatically manages this configuration file. You can modify stocks through:
- Command-line arguments when launching the application
- The built-in editor (press 'e' key while running)
The default configuration includes these stock symbols:
PLTR, NBIS, GOOGL, NVDA, MSFT, TSLA, SLDP, IREN
Command-line options will override the persistent config temporarily, but changes made in the editor will update the saved configuration.
- Rust 1.70+
- Internet connection (to fetch stock data from Yahoo Finance)
- Terminal that supports color output
The application is structured as:
- Main Application: Core logic and state management
- UI Module: TUI rendering with ratatui
- Data Module: Time range handling and data processing
- Event System: Asynchronous stock data fetching
- Config Module: Stock configuration management
- Persistence Module: Persistent configuration storage across app restarts
- Analysis Module: Technical analysis calculations
ratatui: Terminal user interface frameworkcrossterm: Cross-platform terminal handlingtokio: Async runtime for concurrent data fetchingserde_json: JSON configuration handlingclap: Command line argument parsingyahoo_finance_api: Yahoo Finance data fetchingdirectories: Cross-platform config directory managementndarray: Numerical computations for predictions
- Async data fetching for all configured stocks
- Efficient terminal rendering
- Responsive UI with non-blocking operations
- Automatic refresh after configuration changes
- Persistent configuration reduces startup time
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.


