collection of standalone Python scripts for financial analysis, stock forecasting, trading strategy development, and optimization
Python
1
20 commits
updated Oct 25, 2025
This repository contains a collection of standalone Python scripts for financial analysis, stock forecasting, trading strategy development, and optimization. These scripts are inspired by agent-based workflows and combine data sourcing, LLM-assisted analysis, and backtesting tools.
The scripts focus on stock market data for companies like Tesla (TSLA), Apple (AAPL), Microsoft (MSFT), etc., and use libraries for data sourcing (YFinance, FinnHub), visualization (matplotlib, mplfinance), LoRA and LLMs for forecasts and strategy suggestions, and backtesting libraries.
requirements.txt file (generate it via pip freeze > requirements.txt after installing dependencies).Core dependencies include:
torch (for LLM inference)transformers and peft (for Hugging Face models and LoRA)pandas, numpy, matplotlib, mplfinance (data handling and plotting)fpdf (PDF generation)backtrader (backtesting in some scripts)yfinance, finnhub-python (data sources; note: finrobot is a custom module in some scripts—see notes below)autogen (for the Ollama-based script)requests, PyPDF2 (for PDF handling in analysis scripts)Note on finrobot: Some scripts reference finrobot.utils and finrobot.data_source. This is a custom helper library for API key registration and data fetching. If not available, you can replace those helpers with direct calls to yfinance or finnhub-python.
For LLM models:
meta-llama/Llama-2-7b-chat-hf, FinGPT/fingpt-forecaster_dow30_llama2-7b_lora).For the Ollama script:
git clone https://github.com/overcrash66/stock-market-playground.git
cd stock-market-playground
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Many scripts fetch data from FinnHub or YFinance. For FinnHub:
config_api_keys JSON file with your keys (e.g., {"FINNHUB": "your_api_key"}).register_keys_from_json("config_api_keys").YFinance is free but rate-limited.
Each script is standalone and can be run directly (e.g., python script_name.py). They output to directories like stock_analysis, annual_report, etc., with PDFs, plots, and data.
company, ticker, dates.stock_analysis_report.pdf, chart.png.company, ticker.apple_stock_report.pdf, plots.COMPANY, FYEAR, TICKER, PDF_URL.{company}_annual_report_{fyear}.pdf, plots.company, dates, ticker.trade_strategy_report.pdf, strategy.py, backtest_plot.png.company, dates, ticker.sma_optimization_report.pdf, charts and backtest plots per iteration.year, company.../result code plot (relative path; adjust as needed).This repository includes a React-based front-end located at Web-App/Web-App. The Web App is a separate single-page application built with Create React App that provides a user-friendly interface to explore stock data, view charts, and preview reports generated by the Python scripts.
What you'll find here:
Web-App/Web-App (run commands from that directory).package.json for exact dependencies).Quick start (Web App):
cd Web-App/Web-App
npm install
npm start
Open http://localhost:3000 in a browser.
Build for production:
npm run build
The production-ready files will be in Web-App/Web-App/build and can be served by any static hosting (Netlify, Vercel, GitHub Pages, S3, etc.).
Environment variables and API integration:
.env file in Web-App/Web-App with keys prefixed with REACT_APP_ (example: REACT_APP_API_BASE_URL=http://localhost:8000).Suggested backend integration
/plots/{ticker}.png/reports/{report_name}.pdf/api/prices?ticker=TSLA&start=2024-01-01REACT_APP_API_BASE_URL to point to that backend and call it from the React app.Structure overview (common CRA layout):
src/ — main React source filessrc/components/ — reusable componentssrc/App.js — app rootpublic/ — static assets and index.htmlNotes and suggestions:
Web-App/Web-App/README.md contains the default Create React App guidance — check it for standard CRA commands.REACT_APP_API_BASE_URL to point to that API.python lmm_agent_mplfinance.py
export COMPANY="Tesla"
export TICKER="TSLA"
export PDF_URL="https://example.com/tesla-annual-report.pdf"
python AllInOne-FinGPT-Compagny-analysis.py
Web-App/Web-App):npm install
npm start
stock_analysis/).Warnings:
Pull requests welcome! Add new scripts, improve the web UI, fix bugs, or improve documentation. For changes to the Web App, open PRs that include build/test steps and any API contract changes.
If you'd like me to prepare a focused PR just for README updates (or also to add a small example backend integration), tell me which branch name you'd like or I'll suggest one and include a clear commit message.
MIT License. See LICENSE for details.
If you find this repo useful, star it or share your improvements!
collection of standalone Python scripts for financial analysis, stock forecasting, trading strategy development, and optimization
Python
1
20 commits
updated Oct 25, 2025
This repository contains a collection of standalone Python scripts for financial analysis, stock forecasting, trading strategy development, and optimization. These scripts are inspired by agent-based workflows and combine data sourcing, LLM-assisted analysis, and backtesting tools.
The scripts focus on stock market data for companies like Tesla (TSLA), Apple (AAPL), Microsoft (MSFT), etc., and use libraries for data sourcing (YFinance, FinnHub), visualization (matplotlib, mplfinance), LoRA and LLMs for forecasts and strategy suggestions, and backtesting libraries.
requirements.txt file (generate it via pip freeze > requirements.txt after installing dependencies).Core dependencies include:
torch (for LLM inference)transformers and peft (for Hugging Face models and LoRA)pandas, numpy, matplotlib, mplfinance (data handling and plotting)fpdf (PDF generation)backtrader (backtesting in some scripts)yfinance, finnhub-python (data sources; note: finrobot is a custom module in some scripts—see notes below)autogen (for the Ollama-based script)requests, PyPDF2 (for PDF handling in analysis scripts)Note on finrobot: Some scripts reference finrobot.utils and finrobot.data_source. This is a custom helper library for API key registration and data fetching. If not available, you can replace those helpers with direct calls to yfinance or finnhub-python.
For LLM models:
meta-llama/Llama-2-7b-chat-hf, FinGPT/fingpt-forecaster_dow30_llama2-7b_lora).For the Ollama script:
git clone https://github.com/overcrash66/stock-market-playground.git
cd stock-market-playground
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Many scripts fetch data from FinnHub or YFinance. For FinnHub:
config_api_keys JSON file with your keys (e.g., {"FINNHUB": "your_api_key"}).register_keys_from_json("config_api_keys").YFinance is free but rate-limited.
Each script is standalone and can be run directly (e.g., python script_name.py). They output to directories like stock_analysis, annual_report, etc., with PDFs, plots, and data.
company, ticker, dates.stock_analysis_report.pdf, chart.png.company, ticker.apple_stock_report.pdf, plots.COMPANY, FYEAR, TICKER, PDF_URL.{company}_annual_report_{fyear}.pdf, plots.company, dates, ticker.trade_strategy_report.pdf, strategy.py, backtest_plot.png.company, dates, ticker.sma_optimization_report.pdf, charts and backtest plots per iteration.year, company.../result code plot (relative path; adjust as needed).This repository includes a React-based front-end located at Web-App/Web-App. The Web App is a separate single-page application built with Create React App that provides a user-friendly interface to explore stock data, view charts, and preview reports generated by the Python scripts.
What you'll find here:
Web-App/Web-App (run commands from that directory).package.json for exact dependencies).Quick start (Web App):
cd Web-App/Web-App
npm install
npm start
Open http://localhost:3000 in a browser.
Build for production:
npm run build
The production-ready files will be in Web-App/Web-App/build and can be served by any static hosting (Netlify, Vercel, GitHub Pages, S3, etc.).
Environment variables and API integration:
.env file in Web-App/Web-App with keys prefixed with REACT_APP_ (example: REACT_APP_API_BASE_URL=http://localhost:8000).Suggested backend integration
/plots/{ticker}.png/reports/{report_name}.pdf/api/prices?ticker=TSLA&start=2024-01-01REACT_APP_API_BASE_URL to point to that backend and call it from the React app.Structure overview (common CRA layout):
src/ — main React source filessrc/components/ — reusable componentssrc/App.js — app rootpublic/ — static assets and index.htmlNotes and suggestions:
Web-App/Web-App/README.md contains the default Create React App guidance — check it for standard CRA commands.REACT_APP_API_BASE_URL to point to that API.python lmm_agent_mplfinance.py
export COMPANY="Tesla"
export TICKER="TSLA"
export PDF_URL="https://example.com/tesla-annual-report.pdf"
python AllInOne-FinGPT-Compagny-analysis.py
Web-App/Web-App):npm install
npm start
stock_analysis/).Warnings:
Pull requests welcome! Add new scripts, improve the web UI, fix bugs, or improve documentation. For changes to the Web App, open PRs that include build/test steps and any API contract changes.
If you'd like me to prepare a focused PR just for README updates (or also to add a small example backend integration), tell me which branch name you'd like or I'll suggest one and include a clear commit message.
MIT License. See LICENSE for details.
If you find this repo useful, star it or share your improvements!