A comprehensive, fully local multi-agent system for analyzing Indian NSE stocks. Built using the TradingAgents framework and powered entirely by local LLMs via Ollama, this tool performs financial analysis utilizing fundamental data, news, and technical indicators for free via Yahoo Finance (yfinance).
- Python 3.10+ - Core language.
- TradingAgents - Multi-agent financial reasoning framework.
- Ollama - Local LLM inference engine.
- yfinance - Free financial & market data source.
- Local Models:
gemma4-nothink(custom model for complex reasoning) andqwen3.5:4b(for quick tasks).
- Install Python 3.10 or higher.
- Install Ollama on your system and ensure the
ollama serveprocess is running.
Open your terminal and install the required libraries:
pip install tradingagents yfinanceThis project uses a specialized local model (gemma4-nothink) built on top of gemma4:e2b to enforce direct reasoning without outputting <think> tags.
- Create a file named
Modelfilein your project folder with the following exact content:FROM gemma4:e2b SYSTEM """You are an expert, direct assistant. You must provide the final answer immediately. DO NOT use <think> tags, DO NOT output internal reasoning, and DO NOT brainstorm before answering. Output only the final response."""
- Open your terminal in the same folder and run the following command to register the model in Ollama:
ollama create gemma4-nothink -f Modelfile
You will also need to pull the faster analysis model:
ollama pull qwen3.5:4bRuns the strategy for all tickers and dates listed in config.py. Results will be saved as a markdown table in results.md.
python swing_trader.pyCheck a specific stock for a specific date (Format: YYYY-MM-DD):
python swing_trader.py --ticker RELIANCE.NS --date 2026-04-21You can tweak the analysis by editing config.py:
- TICKERS: Add or remove NSE stocks (always use the
.NSsuffix). - ANALYSIS_DATES: Change dates for historical or recent analysis.
- LLM_CONFIG: Modify the local models used for reasoning versus quick analysis tasks.
- Completely Private Financial Analysis: Perform stock evaluations without sending your data or portfolio information to third-party cloud APIs.
- Automated Screener: Rapidly filter through multiple stocks to find ideal swing trading opportunities based on aggregated news and fundamentals.
- Educational Tool: Learn how multi-agent architectures debate and reason over financial scenarios without API rate limits or costs.
- Algorithmic Trading Foundation: Serve as a core evaluation engine that can be hooked up to paper trading or live execution APIs.
- Live Broker Integration: Add direct execution capabilities via APIs like Zerodha Kite or Upstox.
- Technical Indicator Modules: Implement advanced charting libraries (like
ta-liborpandas-ta) to provide the agents with mathematically rigorous signals. - Expanded Asset Classes: Support for crypto, forex, and US market stocks alongside NSE.
- Web Dashboard: Build a minimal Streamlit or Gradio UI to visualize the agent debates and track performance history over time.
- Automated Scheduled Runs: Integrate a cron-job equivalent to run analysis daily before the market opens and deliver an email summary.