Skip to content

krishsharma5169/FinSight

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FinSight - Agentic Financial Research System

A multi-agent AI pipeline that autonomously researches any stock, runs machine learning price prediction, analyzes live news sentiment, and produces a structured investment risk report with a buy/hold/sell recommendation.

Built as a learning project covering TensorFlow, LangGraph, FinBERT, and GPT-4o-mini across a 4-week development sprint.


What It Does

You enter a stock ticker and company name. FinSight runs a full pipeline of specialized AI agents, each doing a distinct job, and returns a structured risk report with a final recommendation in about 60-90 seconds.

It works for any publicly traded stock on major exchanges. AAPL, TSLA, NVDA, MSFT, GOOGL, or any other ticker you want to research.


The Agent Pipeline

User Input (ticker + company name)
        |
  Data Agent         - pulls 5 years of OHLCV data, computes RSI, MACD,
                       Bollinger Bands via yfinance
        |
  ML Agent           - runs a trained TensorFlow LSTM model to predict
                       5-day price direction
        |
  News Agent         - fetches recent headlines via NewsAPI, scores
                       each one with FinBERT sentiment analysis
        |
  Synthesizer Agent  - GPT-4o-mini reasons over all signals and produces
                       a structured risk report
        |
  Critic Agent       - validates the report logic, rejects and retries
                       up to 2 times if reasoning is inconsistent
        |
  Final Report       - signal summary, conflict analysis, risk level,
                       recommendation

Tech Stack

Layer Technology
Price Prediction TensorFlow, Keras, LSTM
Data Pipeline yfinance, pandas, scikit-learn
Sentiment Analysis FinBERT (ProsusAI), HuggingFace Transformers
News Data NewsAPI
Agent Orchestration LangGraph
LLM Reasoning OpenAI GPT-4o-mini
Experiment Tracking MLflow
Frontend Streamlit, Plotly

How to Run

1. Clone the repo

git clone https://github.com/krishsharma5169/FinSight.git
cd FinSight

2. Create a virtual environment

python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # Mac/Linux

3. Install dependencies

pip install -r requirements.txt

4. Set up environment variables

Create a .env file in the project root:

OPENAI_API_KEY=your_openai_key_here
NEWS_API_KEY=your_newsapi_key_here

Get your OpenAI key at platform.openai.com. Get your NewsAPI key at newsapi.org. The free tier is sufficient.

5. Train the LSTM model

python models/lstm_model.py

This pulls 5 years of AAPL data, trains the LSTM, and saves the model and scaler to the models/ directory. Takes 1-2 minutes on CPU.

6. Launch the dashboard

streamlit run frontend/app.py

Open your browser at localhost:8501.


Using FinSight

On the dashboard you will see two input fields at the top.

  • Enter Stock Ticker: the market ticker symbol. Examples: AAPL, TSLA, NVDA, MSFT, GOOGL, META, AMZN

  • Company Name: the full company name. Examples: Apple, Tesla, Nvidia, Microsoft, Google, Meta, Amazon

The company name drives the NewsAPI headline search. Always use the full company name rather than the ticker abbreviation for better and more relevant news coverage. For example, type "Nvidia" in the company name field, not "NVDA".

Hit Run FinSight Analysis and the pipeline runs automatically. Results appear in about 60-90 seconds depending on your connection speed.


Project Structure

FinSight/
  agents/
    state.py              - shared state definition for LangGraph
    data_agent.py         - fetches and processes market data
    ml_agent.py           - runs LSTM inference
    news_agent.py         - fetches headlines and runs FinBERT
    synthesizer_agent.py  - GPT-4o-mini risk report generation
    critic_agent.py       - validates and challenges the report
  data/
    fetch_data.py         - yfinance data pipeline
    features.py           - RSI, MACD, Bollinger Bands
    preprocess.py         - sequence creation, train/test split, scaling
    news_fetcher.py       - NewsAPI integration
    sentiment.py          - FinBERT sentiment scoring
    sentiment_features.py - merges sentiment with price data
  models/
    lstm_model.py         - LSTM architecture, training, MLflow logging
  pipeline/
    graph.py              - LangGraph state graph and routing logic
  frontend/
    app.py                - Streamlit dashboard

Limitations

This is a research-grade decision support tool, not a trading bot. The LSTM model achieves approximately 55% directional accuracy on held-out data, which is consistent with academic literature on technical-indicator- only models. No financial decision should be made solely on FinSight's output.

NewsAPI free tier returns headlines from the last 30 days only, which means sentiment reflects recent market mood rather than historical context.


What I Learned

  • Time-series modeling with TensorFlow LSTM on real financial data
  • Transfer learning with FinBERT for domain-specific NLP
  • Multi-agent orchestration with LangGraph state graphs
  • Experiment tracking with MLflow across model iterations
  • Building interactive ML dashboards with Streamlit

About

Multi-agent AI system for financial research combining TensorFlow LSTM price prediction, FinBERT sentiment analysis, and GPT-4o-mini reasoning via LangGraph.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages