Skip to content

47thtechcorner/RayCodes_TradingAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Local-Only Stock Swing Trader 🚀

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).

🛠️ Tech Stack

  • 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) and qwen3.5:4b (for quick tasks).

⚙️ Setup & Installation

1. Prerequisites

  • Install Python 3.10 or higher.
  • Install Ollama on your system and ensure the ollama serve process is running.

2. Install Python Dependencies

Open your terminal and install the required libraries:

pip install tradingagents yfinance

3. Create the Custom gemma4-nothink Model

This project uses a specialized local model (gemma4-nothink) built on top of gemma4:e2b to enforce direct reasoning without outputting <think> tags.

  1. Create a file named Modelfile in 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."""
  2. Open your terminal in the same folder and run the following command to register the model in Ollama:
    ollama create gemma4-nothink -f Modelfile

4. Pull Additional Models

You will also need to pull the faster analysis model:

ollama pull qwen3.5:4b

🚀 Usage

Run Full Backtest

Runs 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.py

Run Single Analysis

Check a specific stock for a specific date (Format: YYYY-MM-DD):

python swing_trader.py --ticker RELIANCE.NS --date 2026-04-21

Configuration Options

You can tweak the analysis by editing config.py:

  • TICKERS: Add or remove NSE stocks (always use the .NS suffix).
  • ANALYSIS_DATES: Change dates for historical or recent analysis.
  • LLM_CONFIG: Modify the local models used for reasoning versus quick analysis tasks.

💡 Project Use Cases

  • 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.

🔮 Future Feature Additions

  • Live Broker Integration: Add direct execution capabilities via APIs like Zerodha Kite or Upstox.
  • Technical Indicator Modules: Implement advanced charting libraries (like ta-lib or pandas-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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages