Build an AI-Powered Stock Analysis Dashboard with ChatGPT and EODHD Financial API

Build an AI-Powered Stock Analysis Dashboard with ChatGPT and EODHD Financial API

“The stock market is a device for transferring money from the impatient to the patient.” — Warren Buffett

The Problem: Drowning in Financial Data

If you’re an investor today, you’re overwhelmed.

  • Dozens of indicators: P/E ratios, dividends, RSI, moving averages…
  • Endless reports: earnings calls, SEC filings, corporate actions.
  • Manual analysis: flipping between Yahoo Finance, TradingView, and spreadsheets.

Even for experienced traders, turning raw numbers into actionable insights is time-consuming. For beginners? It’s almost impossible.

Losing Opportunities

I’ll be honest: In 2024, I missed a major breakout on a stock I’d been tracking for months. The signals were there: dividends were rising, RSI was flashing oversold, moving averages were converging… but by the time I put it all together, the move had already happened.

“He who lives by the golden rule makes the golden rules.” — Ray Dalio

That was the turning point. I needed a system to do the heavy lifting — one that could:

  • Pull live financial data (fundamentals, dividends, technicals).
  • Process signals instantly (RSI, moving averages).
  • Summarize everything in plain English (is it a good entry? where to set stops?).

The Solution: An AI-Powered Investor Dashboard

So I built it.

A Streamlit dashboard that combines:

  • EODHD Financial API → for real-time fundamentals, dividends, historical prices.
  • Technical Analysis → RSI, 50/200-day moving averages.
  • ChatGPT → to generate AI-powered summaries: attractiveness score (1–10), suggested entry points, stop loss, and take profit levels.

“Know what you own, and know why you own it.” — Peter Lynch

And it doesn’t just crunch numbers — it explains them like a seasoned analyst.

Step 1: Test the EODHD API

Before building the dashboard, we test our endpoints.

Code to check fundamentals, dividends, and historical prices:

import requests, json

API_KEY = "67c1af0e6f0185.67184735"
TICKER = "AAPL.US"

# Fundamentals
fund_url = f"https://eodhd.com/api/fundamentals/{TICKER}?api_token={API_KEY}&fmt=json"
fund_data = requests.get(fund_url).json()
print("Fundamentals sample:", json.dumps(fund_data.get('General', {}), indent=2))

# Dividends
div_url = f"https://eodhd.com/api/div/{TICKER}?api_token={API_KEY}&fmt=json"
div_data = requests.get(div_url).json()
print("Dividends sample:", div_data[:3])

# Historical Prices
eod_url = f"https://eodhd.com/api/eod/{TICKER}?api_token={API_KEY}&fmt=json&period=6mo"
eod_data = requests.get(eod_url).json()
print("Price sample:", eod_data[:3])        

For fundamental data, you get

fundamentals sample: {
  "Code": "AAPL",
  "Type": "Common Stock",
  "Name": "Apple Inc",
  "Exchange": "NASDAQ",
  "CurrencyCode": "USD",
  "CurrencyName": "US Dollar",
  "CurrencySymbol": "$",
  "CountryName": "USA",
  "CountryISO": "US",
  "OpenFigi": "BBG000B9XRY4",
  "ISIN": "US0378331005",
  "LEI": "HWUPKR0MPOU8FGXBT394",
  "PrimaryTicker": "AAPL.US",
  "CUSIP": "037833100",
  "CIK": "0000320193",
  "EmployerIdNumber": "94-2404110",
  "FiscalYearEnd": "September",
  "IPODate": "1980-12-12",
  "InternationalDomestic": "International/Domestic",
  "Sector": "Technology",
  "Industry": "Consumer Electronics",
  "GicSector": "Information Technology",
  "GicGroup": "Technology Hardware & Equipment",
  "GicIndustry": "Technology Hardware, Storage & Peripherals",
  "GicSubIndustry": "Technology Hardware, Storage & Peripherals",
  "HomeCategory": "Domestic",
  "IsDelisted": false,
  "Description": "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. The company offers iPhone, a line of smartphones; Mac, a line of personal computers; iPad, a line of multi-purpose tablets; and wearables, home, and accessories comprising AirPods, Apple TV, Apple Watch, Beats products, and HomePod. It also provides AppleCare support and cloud services; and operates various platforms, including the App Store that allow customers to discover and download applications and digital content, such as books, music, video, games, and podcasts, as well as advertising services include third-party licensing arrangements and its own advertising platforms. In addition, the company offers various subscription-based services, such as Apple Arcade, a game subscription service; Apple Fitness+, a personalized fitness service; Apple Music, which offers users a curated listening experience with on-demand radio stations; Apple News+, a subscription news and magazine service; Apple TV+, which offers exclusive original content; Apple Card, a co-branded credit card; and Apple Pay, a cashless payment service, as well as licenses its intellectual property. The company serves consumers, and small and mid-sized businesses; and the education, enterprise, and government markets. It distributes third-party applications for its products through the App Store. The company also sells its products through its retail and online stores, and direct sales force; and third-party cellular network carriers, wholesalers, retailers, and resellers. Apple Inc. was founded in 1976 and is headquartered in Cupertino, California.",
  "Address": "One Apple Park Way, Cupertino, CA, United States, 95014",
  "AddressData": {
    "Street": "One Apple Park Way",
    "City": "Cupertino",
    "State": "CA",
    "Country": "United States",
    "ZIP": "95014"
  },
  "Listings": {
    "0": {
      "Code": "0R2V",
      "Exchange": "LSE",
      "Name": "Apple Inc."
    },
    "1": {
      "Code": "AAPL",
      "Exchange": "BA",
      "Name": "Apple Inc DRC"
    },
    "2": {
      "Code": "AAPL34",
      "Exchange": "SA",
      "Name": "Apple Inc"
    }
  },
  "Officers": {
    "0": {
      "Name": "Mr. Timothy D. Cook",
      "Title": "CEO & Director",
      "YearBorn": "1961"
    },
    "1": {
      "Name": "Mr. Kevan  Parekh",
      "Title": "Senior VP & CFO",
      "YearBorn": "1972"
    },
    "2": {
      "Name": "Molly  Thompson",
      "Title": "Head of Documentaries for Apple TV+",
      "YearBorn": "NA"
    },
    "3": {
      "Name": "Mr. Matthew  Cherniss",
      "Title": "Head of Programming for Apple TV+",
      "YearBorn": "1973"
    },
    "4": {
      "Name": "Ashish  Chowdhary",
      "Title": "Head of Indian Business",
      "YearBorn": "NA"
    },
    "5": {
      "Name": "Mr. Roger  Rosner",
      "Title": "Vice President of Applications",
      "YearBorn": "NA"
    },
    "6": {
      "Name": "Mr. Kevin M. Lynch",
      "Title": "Vice President of Technology",
      "YearBorn": "1967"
    },
    "7": {
      "Name": "Mr. Wyatt  Mitchell",
      "Title": "Director of App Design",
      "YearBorn": "NA"
    },
    "8": {
      "Name": "Ms. Jennifer  Bailey",
      "Title": "Vice President of Pay",
      "YearBorn": "1963"
    },
    "9": {
      "Name": "Ms. Ann  Thai",
      "Title": "Director of Product Management for the App Store",
      "YearBorn": "NA"
    }
  },
  "Phone": "(408) 996-1010",
  "WebURL": "https://www.apple.com",
  "LogoURL": "/img/logos/US/aapl.png",
  "FullTimeEmployees": 164000,
  "UpdatedAt": "2025-07-31"
}        

For dividends data, you get

Dividends sample: [{'date': '1987-05-11', 'declarationDate': None, 'recordDate': None, 'paymentDate': None, 'period': None, 'value': 0.00054, 'unadjustedValue': 0.12096, 'currency': 'USD'}, {'date': '1987-08-10', 'declarationDate': None, 'recordDate': None, 'paymentDate': None, 'period': None, 'value': 0.00054, 'unadjustedValue': 0.06048, 'currency': 'USD'}, {'date': '1987-11-17', 'declarationDate': None, 'recordDate': None, 'paymentDate': None, 'period': None, 'value': 0.00071, 'unadjustedValue': 0.07952, 'currency': 'USD'}]        

For historical data, you get

Price sample: [{'date': '1980-12-12', 'open': 28.7392, 'high': 28.8736, 'low': 28.7392, 'close': 28.7392, 'adjusted_close': 0.0986, 'volume': 469033600}, {'date': '1980-12-15', 'open': 27.3728, 'high': 27.3728, 'low': 27.2608, 'close': 27.2608, 'adjusted_close': 0.0935, 'volume': 175884800}, {'date': '1980-12-16', 'open': 25.3792, 'high': 25.3792, 'low': 25.2448, 'close': 25.2448, 'adjusted_close': 0.0866, 'volume': 105728000}]        

Step 2: Build the AI Dashboard

Here’s the core idea:

  1. Pull data → EODHD for fundamentals, dividends, historical prices.
  2. Compute technicals → RSI, MA50, MA200 using Pandas.
  3. Generate insight → Send this data to ChatGPT, which summarizes it for an investor

The Full Python Code

We’ll use Streamlit for the interface and Plotly for interactive charts:

import requests
import streamlit as st
import openai
import plotly.graph_objects as go
import pandas as pd

# --- API KEYS ---
EODHD_API_KEY = "YOUR_API_KEY"
openai.api_key = OPENAI_API_KEY

# --- API Functions ---
def get_fundamentals(ticker):
    url = f"https://eodhd.com/api/fundamentals/{ticker}?api_token={EODHD_API_KEY}&fmt=json"
    r = requests.get(url)
    return r.json() if r.status_code == 200 else {}

def get_dividends(ticker):
    url = f"https://eodhd.com/api/div/{ticker}?api_token={EODHD_API_KEY}&fmt=json"
    r = requests.get(url)
    return r.json() if r.status_code == 200 else {}

def get_eod_data(ticker, period="6mo"):
    url = f"https://eodhd.com/api/eod/{ticker}?api_token={EODHD_API_KEY}&fmt=json&period={period}"
    r = requests.get(url)
    return r.json() if r.status_code == 200 else []

# --- Technical calculations ---
def calculate_technicals(df):
    df = pd.DataFrame(df)
    df['date'] = pd.to_datetime(df['date'])
    df['close'] = df['close'].astype(float)
    df.sort_values('date', inplace=True)

    df['MA50'] = df['close'].rolling(window=50).mean()
    df['MA200'] = df['close'].rolling(window=200).mean()
    delta = df['close'].diff()
    gain = delta.where(delta > 0, 0)
    loss = -delta.where(delta < 0, 0)
    avg_gain = gain.rolling(window=14).mean()
    avg_loss = loss.rolling(window=14).mean()
    rs = avg_gain / avg_loss
    df['RSI'] = 100 - (100 / (1 + rs))
    return df

# --- ChatGPT summarizer ---
def summarize_with_gpt(ticker, fundamentals, dividends, techs):
    key_data = {
        "Market Cap": fundamentals.get("General", {}).get("MarketCapitalization"),
        "P/E Ratio": fundamentals.get("Highlights", {}).get("PERatio"),
        "Dividend Yield": fundamentals.get("Highlights", {}).get("DividendYield"),
        "Beta": fundamentals.get("Highlights", {}).get("Beta"),
        "52W High": fundamentals.get("Technicals", {}).get("52WeekHigh"),
        "52W Low": fundamentals.get("Technicals", {}).get("52WeekLow")
    }
    rsi = round(techs['RSI'].iloc[-1], 2) if 'RSI' in techs else None
    ma50 = round(techs['MA50'].iloc[-1], 2) if 'MA50' in techs else None
    ma200 = round(techs['MA200'].iloc[-1], 2) if 'MA200' in techs else None

    prompt = f"""
    Analyze {ticker} for an investor.
    Key fundamentals: {key_data}
    Latest RSI: {rsi}, MA50: {ma50}, MA200: {ma200}
    Recent dividends: {dividends[:3]}.
    Give:
    1. Attractiveness score (1-10).
    2. Suggested entry price, stop loss, take profit levels.
    3. A brief analysis of trend (bullish/bearish/neutral).
    4. Explain your reasoning in simple terms.
    """

    response = openai.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "system", "content": "You are a financial analyst providing clear, actionable insights."},
                  {"role": "user", "content": prompt}],
        max_tokens=500
    )
    return response.choices[0].message.content

# --- Streamlit UI ---
st.set_page_config(page_title="Investor AI Dashboard", layout="wide")
st.title("📊 Investor AI Dashboard")
st.write("Real-time **EODHD** data + **ChatGPT** insights for smarter investing.")

# Sidebar inputs
ticker = st.sidebar.text_input("Enter Ticker (e.g., AAPL.US):", value="AAPL.US")
period = st.sidebar.selectbox("Select Period:", ["1mo", "3mo", "6mo", "ytd", "1y", "2y"])

if st.sidebar.button("Fetch Data"):
    with st.spinner("Fetching data..."):
        fundamentals = get_fundamentals(ticker)
        dividends = get_dividends(ticker)
        eod_data = get_eod_data(ticker, period)

    if eod_data:
        df = calculate_technicals(eod_data)

        # --- Price Chart ---
        fig = go.Figure()
        fig.add_trace(go.Scatter(x=df['date'], y=df['close'], mode='lines', name='Close Price'))
        fig.add_trace(go.Scatter(x=df['date'], y=df['MA50'], mode='lines', name='MA50'))
        fig.add_trace(go.Scatter(x=df['date'], y=df['MA200'], mode='lines', name='MA200'))
        fig.update_layout(title=f"{ticker} Price & Moving Averages", xaxis_title="Date", yaxis_title="Price")
        st.plotly_chart(fig, use_container_width=True)

        # --- KPIs ---
        st.subheader("Key Metrics")
        col1, col2, col3 = st.columns(3)
        col1.metric("Market Cap", fundamentals.get("General", {}).get("MarketCapitalization"))
        col2.metric("P/E Ratio", fundamentals.get("Highlights", {}).get("PERatio"))
        col3.metric("Dividend Yield", fundamentals.get("Highlights", {}).get("DividendYield"))

        col4, col5, col6 = st.columns(3)
        col4.metric("Beta", fundamentals.get("Highlights", {}).get("Beta"))
        col5.metric("52W High", fundamentals.get("Technicals", {}).get("52WeekHigh"))
        col6.metric("52W Low", fundamentals.get("Technicals", {}).get("52WeekLow"))

        # --- Dividends Section ---
        st.subheader("Recent Dividends")
        if dividends:
            st.table(dividends[:5])
        else:
            st.write("No dividend data available.")

        # --- AI Analysis ---
        st.subheader("AI-Powered Investment Insight")
        ai_summary = summarize_with_gpt(ticker, fundamentals, dividends, df)
        st.write(ai_summary)
    else:
        st.warning("No price data available.")        

Feature-by-Feature: How This AI Dashboard Simplifies Stock Analysis

1. Price Chart with Technical Indicators

A dynamic Plotly chart shows the stock’s closing prices along with the 50-day and 200-day moving averages, helping you quickly assess the trend (bullish, bearish, or sideways). This visual layer makes it easy to identify potential support and resistance levels.

Article content

2. Key Metrics at a Glance

The dashboard displays the most important fundamental KPIs in clean, easy-to-read cards:

  • Market Cap: Company size.
  • P/E Ratio: Valuation insight.
  • Dividend Yield: For income investors.
  • Beta: Volatility vs. the market.
  • 52W High/Low: Price extremes of the last year.

Article content

3. Dividends Overview

For dividend investors, there’s a table of the last 5 dividends, including payment dates and amounts. This helps you track income consistency and plan around upcoming payouts.

Article content

4. AI-Powered Summary

This is where the magic happens. ChatGPT analyzes fundamentals, technical indicators, and dividend data to generate a plain-English report that includes:

  • An attractiveness score (1–10) for the stock.
  • Suggested entry price, stop-loss, and take-profit levels.
  • A quick trend analysis (bullish/bearish/neutral) and reasoning in simple terms.

Article content

The Impact

Instead of juggling tools and data sources, you now get:

  • Clear signals in one place.
  • Actionable AI insights (when to enter, where to set stops).
  • A repeatable framework for any stock you track.

“Risk comes from not knowing what you’re doing.” — Warren Buffett

Now you don’t have to guess — your dashboard does the heavy lifting.

Final Thoughts

This project shows how AI + Financial APIs can turn complex data into actionable insights. It’s perfect for traders who want clarity, speed, and confidence.

👉 Try EODHD Financial API (10% off) and supercharge your analysis.

“In investing, what is comfortable is rarely profitable.” — Robert Arnott

To view or add a comment, sign in

Others also viewed

Explore topics