A comprehensive tool for analyzing stock market data using various technical indicators, including RSI analysis, confidence intervals, and day trading capabilities.
- 95% Confidence Interval Analysis: Track and analyze stock performance using statistical confidence intervals
- RSI Analysis: Calculate and monitor Relative Strength Index with accuracy metrics
- Database Management: Create and maintain stock databases with flexible ticker management
- Day Trading Module: Paper trading simulation capabilities
- Stock Index Scraper: Automated scraping of major market indices (Dow Jones, S&P 500, NASDAQ 100)
- Moving Average Analysis: Track market trends using various moving average calculations
- Smart Caching: Efficient data management with automatic cache optimization
- Python 3.8 or higher
- Node.js 14 or higher
- Chrome/Chromium browser (for web scraping functionality)
All Python dependencies are specified in requirements.txt
and include:
- alpaca-trade-api (for market data)
- Flask & Flask-CORS (backend server)
- pandas, numpy, scipy (data analysis)
- matplotlib (visualization)
- selenium (web scraping)
- scikit-learn (machine learning components)
- Additional supporting packages
Frontend dependencies are managed through package.json
and include:
- React (UI framework)
- Tailwind CSS (styling)
- Additional development dependencies
- Clone the repository:
git clone [repository-url]
cd Stock_Analysis
- Configure Alpaca API credentials:
Create or modify
config.py
:
import os
os.environ['ALPACA_KEY'] = "your_api_key"
os.environ['ALPACA_SECRET'] = "your_api_secret"
Simply run start.bat
in the root directory. The script will:
- Check for Python and Node.js installations
- Install/update Python requirements automatically
- Install frontend dependencies if needed
- Start both backend and frontend servers
- Open the application in your default browser
To stop the application:
- Press 'Q' in the command window
- All processes will be automatically cleaned up
- Virtual environment will be deactivated
Run start.sh
in the root directory. The script will:
- Verify Python and Node.js installations
- Install/update Python requirements automatically
- Install frontend dependencies if needed
- Start both backend and frontend servers
- Open the application in your default browser
To stop the application:
- Press Ctrl+C in the terminal
- All processes will be automatically cleaned up
- Virtual environment will be deactivated
app.py
: Flask server implementation with API endpointsanalysis.py
: Core analysis functions including RSI and confidence intervalsdatabase.py
: Database management and operationsday_trade.py
: Day trading simulation logicscraper.py
: Web scraping functionality for stock indices
App.js
: Main React application componentConfidenceModule.js
: 95% confidence interval analysis interfaceDatabaseModule.js
: Database management interfaceDayTradeModule.js
: Day trading interfaceSettingsModule.js
: Application settings and cache managementpackage.json
: Node.js dependency specifications
GET /api/databases
: List all available databasesPOST /api/database/<dbname>/create
: Create a new databasePOST /api/database/<dbname>/update
: Update existing databasePOST /api/database/<dbname>/add
: Add ticker to databasePOST /api/database/<dbname>/remove
: Remove ticker from databasePOST /api/database/<dbname>/reset
: Reset databaseGET /api/database/<dbname>/estimate
: Get update time estimate
GET /api/rsi/<ticker>
: Get RSI calculationsGET /api/rsi/accuracy/<ticker>
: Get RSI accuracy metricsGET /api/rsi/turnover/<ticker>
: Get RSI turnover analysisGET /api/rsi/ma/<ticker>
: Get moving average analysis
POST /api/scrape
: Scrape stock symbols from major indices
GET /api/cache/info
: Get cache statusPOST /api/cache/clear
: Clear cache
- Alpaca API calls are limited to 150 requests per minute
- The application implements smart throttling to prevent rate limit issues
- Automatic caching of frequently accessed data
- Cache management through Settings module
- Configurable cache duration and size limits
- Isolated Python environment for consistent dependencies
- Automatic creation and management through startup scripts
- Prevents conflicts with system Python packages
- API keys should be stored securely and never committed to version control
- The application runs in paper trading mode by default for safety
- Virtual environment ensures dependency security
- Always verify API endpoint access and permissions
The application implements comprehensive error handling for:
- API rate limiting
- Network connectivity issues
- Invalid ticker symbols
- Database operations
- File I/O operations
- Dependency management
- Virtual environment issues
-
Virtual Environment Problems
- Delete the
venv
directory and let the startup script recreate it - Ensure Python version compatibility
- Delete the
-
Node.js Dependencies
- Clear
node_modules
and let the startup script reinstall - Check for Node.js version compatibility
- Clear
-
API Rate Limits
- Monitor the Settings module for cache status
- Adjust batch operations timing
- Backend logs are available in the Flask server output
- Frontend development server provides React-related logs
- Check startup script output for dependency issues
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Please ensure:
- Virtual environment is not committed
- Dependencies are properly documented
- API keys and secrets are not included
This project is licensed under the MIT License - see the LICENSE file for details.