This repository contains several utility and analysis scripts:
- stonky: An LSTM-based stock price prediction script using TensorFlow and Keras. It downloads historical data for a given ticker (e.g.,
NVDA), trains a sequential LSTM model, saves it as.tfmodel.100, and prints price predictions for future time horizons. - stats.py: A command-line statistic calculator. It reads float data points from standard input (stdin) and prints descriptive statistics including Min/Max, Quartiles, Mean, Median, Harmonic Mean, Standard Deviation, Kurtosis, Skew, and Fibonacci levels (23.6%, 38.2%, 61.8%, 78.6%).
- modeltest.py: Evaluates several machine learning classification algorithms (Logistic Regression, Decision Tree, Random Forest, SVM) on a synthetically generated binary classification dataset, reporting cross-validated accuracy, precision, recall, and F1 metrics.
- new_volprice_ema.py: Calculates the price-to-volume ratio along with 25, 50, 100, and 200-day simple moving averages (SMAs) using
ta-libfor a given ticker, displaying them on a matplotlib plot. - ytd_volprice.py: Downloads YTD stock data for a given ticker and plots the close price and volume side-by-side using twin y-axes.
If your IDE reports missing module errors (such as Cannot find module 'yfinance', numpy, matplotlib, or talib), this is because dependencies need to be installed in a virtual environment.
Create and activate a virtual environment, then install the required dependencies:
# Create the virtual environment
python3 -m venv venv
# Activate it
source venv/bin/activate
# Install the packages
pip install numpy pandas scipy scikit-learn yfinance matplotlib seabornNote: ta-lib requires the system TA-Lib C-library headers to be installed. Alternatively, you can run inside Docker where all dependencies are preconfigured.
Once the virtual environment is set up and active, run the test suite using:
python3 -m unittest discover -s testsAll tests use mocked modules for external APIs like yfinance and dependencies like talib and tensorflow, allowing tests to run quickly offline.