{"id":18237469,"url":"https://github.com/walmartbaggg/Stock-Prediction","last_synced_at":"2025-04-04T05:33:30.288Z","repository":{"id":258789751,"uuid":"875375798","full_name":"m626zNq/Stock-Prediction","owner":"m626zNq","description":"Machine learning project using LSTM networks to predict stock prices based on historical data from multiple companies.","archived":false,"fork":false,"pushed_at":"2024-10-24T04:51:27.000Z","size":1518,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-05T02:04:35.484Z","etag":null,"topics":["machine-learning","ml","prediction","predictions","python","stock","stock-market","stock-prediction","stock-price-prediction","stock-prices","tensorflow","yfinance"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m626zNq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-19T20:03:10.000Z","updated_at":"2024-10-24T04:51:31.000Z","dependencies_parsed_at":"2024-10-20T22:06:11.245Z","dependency_job_id":null,"html_url":"https://github.com/m626zNq/Stock-Prediction","commit_stats":null,"previous_names":["m626znq/stock-prediction"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m626zNq%2FStock-Prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m626zNq%2FStock-Prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m626zNq%2FStock-Prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m626zNq%2FStock-Prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m626zNq","download_url":"https://codeload.github.com/m626zNq/Stock-Prediction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223100261,"owners_count":17087388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","ml","prediction","predictions","python","stock","stock-market","stock-prediction","stock-price-prediction","stock-prices","tensorflow","yfinance"],"created_at":"2024-11-05T02:04:39.924Z","updated_at":"2025-04-04T05:33:24.921Z","avatar_url":"https://github.com/m626zNq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stock Price Prediction with Machine Learning\n\nThis project uses machine learning to predict stock prices based on historical data. It employs a Long Short-Term Memory (LSTM) neural network model to forecast future stock prices for various companies.\n\n## Features\n\n- Data collection from Yahoo Finance using the `yfinance` library\n- LSTM model for time series prediction\n- Training on multiple stock data to improve generalization\n- Prediction visualization with matplotlib\n- GPU support for faster training (if available)\n\n## Requirements\n\n- Python 3.7+\n- TensorFlow 2.x\n- yfinance\n- pandas\n- numpy\n- matplotlib\n- scikit-learn\n\nYou can install the required packages using:\n```\npip install -r requirements.txt\n```\n\n\n## Usage\n\n### Training the Model\n\u003csub\u003e***The weights are already trained and saved in the repo 'weights' folder for the current version. This is optional.***\u003c/sub\u003e\n\nTo train the model on historical stock data:\n```\npython scripts/train.py\n```\n\nThis script will:\n1. Download historical stock data for predefined tickers\n2. Prepare the data for training\n3. Build and train the LSTM model\n4. Save the trained model as `model.h5` and the scaler as `scaler.npy`\n\n### Making Predictions\n\nTo make predictions using the trained model:\n```\npython scripts/inference.py --stock \u003cstock symbol\u003e --output \u003coutput filename\u003e --epoch \u003cuse model from a specific epoch\u003e\n```\n\n\nBy default, this will predict stock prices for NVIDIA (NVDA) and save the plot as `predictions.png`. You can modify the ticker and output filename by passing the appropriate arguments as shown above.\n\n## How it Works\n\n1. **Data Collection**: Historical stock data is fetched using the `yfinance` library.\n2. **Data Preprocessing**: The data is scaled using MinMaxScaler to normalize the values.\n3. **Model Architecture**: An LSTM-based neural network is used for sequence prediction.\n4. **Training**: The model is trained on multiple stock data to capture general market trends.\n5. **Prediction**: The trained model predicts future stock prices based on recent data.\n6. **Visualization**: Predictions are plotted against actual prices, including a simple trading recommendation.\n\n## Customization\n\n- To train on different stocks, update the list of tickers in `train.py`.\n- Adjust the `time_step` and `future_days` parameters in both scripts to change the input sequence length and prediction horizon.\n\n## License\n\nThis project is released under the GPL-3.0. For more information, see the [LICENSE](LICENSE) file.\n\n## Disclaimer\n\nThis may provide inaccurate predictions. Dont rely on it too much until it is improved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartbaggg%2FStock-Prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwalmartbaggg%2FStock-Prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwalmartbaggg%2FStock-Prediction/lists"}