This project predicts stock prices for companies on the Nigerian Stock Exchange using machine learning. Users can select a stock ticker and see price predictions for future days through an easy-to-use web app.
use
- 📈 Predict future stock prices based on historical data
- 🏢 Support for multiple Nigerian companies
- 📊 Interactive charts showing historical prices and predictions
- 📅 Forecasts starting from today for any number of days ahead
- 💹 Detailed prediction tables with dates and prices
We collect Nigerian stock market data with these fields:
- Date
- Open price
- High price
- Low price
- Close price
- Volume
- Percentage change
The data is cleaned by:
- Removing unnecessary columns
- Converting text to proper numbers
- Handling missing values
- Converting volume notations (M for million, K for thousand)
For each company (ticker):
- We split the data into training (80%) and testing (20%) sets
- We train a Linear Regression model using these features:
- Open price
- High price
- Low price
- Trading volume
- Percentage change
- The model learns to predict the closing price
- We save each trained model as a file
Our Streamlit app allows users to:
- Select a company from a dropdown menu
- Choose how many days to predict (1-30)
- Click "Predict" to see future price estimates
- View results as both a chart and a table
- Python 3.7 or higher
- Required packages listed in
requirements.txt
- Clone this repository
git clone <repository-url>
- Install required packages
pip install -r requirements.txt
- Run the Streamlit app
streamlit run app.py
Nigerian Stock Market Price Prediction/
├── data/
│ └── Nigerian_stock_market.csv # Stock market data
├── models/ # Trained models
│ ├── AIICO_model.pkl
│ ├── DANGCEM_model.pkl
│ └── ...
├── app.py # Streamlit web application
|___ Notebooks #Notebook Folder
└── requirements.txt # Project dependencies
- Open the app in your web browser
- Select a stock ticker (e.g., "DANGCEM")
- Use the slider to select how many days to forecast (e.g., 7 days)
- Click "Predict Prices" button
- View the historical data and predictions chart
- Check the detailed forecast table below the chart
- Add more advanced prediction models
- Include more Nigerian stocks
- Add confidence intervals to predictions
- Provide trading signals (buy/sell/hold recommendations)
- Automatic data updates
- Stock data sourced from Nigerian Stock Exchange
- Built with Python, Streamlit, and scikit-learn