Back to Catalog

Stock fundamental analysis & AI-powered reports with Mistral and AlphaVantage

Sebastian/OptiLeverSebastian/OptiLever
410 views
2/3/2026
Official Page

Fundamental Analysis, Stock Analysis, and AI Integration in the Fundamental Analysis Tool


Overview of the Tool

The Fundamental Analysis Tool is an automated workflow designed to evaluate a stock’s fundamentals using financial data and AI-driven insights. Built in the n8n automation platform, it:

  1. Collects financial data for a user-specified stock from AlphaVantage.
  2. Processes and structures this data for analysis.
  3. Analyzes the data using the Mistral AI model to provide expert-level insights.
  4. Generates a visually appealing HTML report with charts and delivers it via email.

The tool is triggered by a form where users input a stock symbol (e.g., "NVDA" for NVIDIA) and their email address. From there, it follows a three-stage process: data retrieval, data processing, and AI analysis with report generation.


1. Fundamental Analysis: The Foundation

Fundamental analysis involves evaluating a company’s intrinsic value by examining its financial health, competitive position, and market environment. This tool performs fundamental analysis by:

Data Retrieval

  • Data Types: Six types of data are retrieved via HTTP requests:
    • Overview: General company details (e.g., sector, industry, market cap).
    • Income Statement: Revenue, net income, and profitability metrics.
    • Balance Sheet: Assets, liabilities, and equity.
    • Cash Flow: Operating, investing, and financing cash flows.
    • Earnings Calendar: Upcoming earnings events.
    • Earnings: Historical earnings data (annual and quarterly).

Key Metrics Analyzed

The tool structures this data into 8 categories critical to fundamental analysis, as defined in the "Code1" node:

  1. Economic Moats & Competitive Advantage: Assesses sustainable advantages (e.g., R&D spending, gross profit).
  2. Financial Health & Profitability: Examines ROE, debt levels, and dividend yield.
  3. Valuation & Market Sentiment: Evaluates P/E ratio, PEG ratio, and book value.
  4. Management & Capital Allocation: Reviews market cap justification and cash allocation (e.g., R&D, buybacks).
  5. Industry & Risk Exposure: Analyzes revenue cyclicality and geopolitical risks.
  6. Key Metrics to Probe: Investigates net income trends and gross margins.
  7. Red Flags: Identifies risks like inventory issues or stock dilution.
  8. Final Checklist: Summarizes pricing power and risk/reward potential.

These categories cover the core pillars of fundamental analysis, ensuring a holistic evaluation of the stock’s intrinsic value and risks.


2. Stock Analysis: Tailored Insights

The tool performs stock-specific analysis by focusing on the user-provided stock symbol. Here’s how it tailors the process:

Input and Customization

  • Form Submission: Users enter a stock symbol (e.g., "NVDA") and email via the "On Form Submission" node.
  • Dynamic Data Fetching: The "Set Variables" node passes the stock symbol to the API calls, ensuring the analysis is specific to the chosen stock.

Processing for Relevance

  • Data Filtering: The workflow limits historical data to the last 5 years (via the "Limit" node), focusing on recent trends.
  • Merging and Cleaning: The "Merge" and "Code2" nodes combine and refine the data, removing irrelevant fields (e.g., quarterly reports) and aggregating annual reports for consistency.

Output

  • The final report is titled with the stock’s name (e.g., "Fundamental Analysis - NVIDIA"), ensuring the analysis is clearly tied to the user’s chosen stock.

This stock-specific approach makes the tool practical for investors analyzing individual companies rather than broad market trends.


3. AI Integration: Expert-Level Insights

The integration of AI (via the Mistral model or others) is what sets this tool apart, automating complex analysis and report generation. Here’s how AI is woven into the workflow:

Data Preparation for AI

  • Structuring: The "Code1" node organizes the raw data into a JSON schema aligned with the eight fundamental analysis categories.
  • This structured data is fed into the AI for analysis.

AI Analysis

  • Node: "Basic LLM Chain" uses the Mistral AI model.
  • Prompt: The AI is instructed to act as an "expert financial advisor with 50 years of experience" and answer specific questions for each category, such as:
    • Economic Moats: "What sustainable competitive advantages protect the company’s margins?"
    • Financial Health: "Is ROE driven by leverage or true profitability?"
    • Red Flags: "Are supply chain issues a concern?"
  • Output: The AI generates a JSON response with detailed insights, e.g.:
    {
      "Economic Moats & Competitive Advantage": "NVIDIA’s leadership in GPU technology and strong R&D investment...",
      "Financial Health & Profitability": "ROE of 25% is exceptional, driven by profitability rather than leverage...",
      ...
    }
    
  • Validation: An "Auto-fixing Output Parser" ensures the output adheres to the expected JSON schema, retrying if necessary.

Report Enhancement

  • HTML Generation: The "HTML" node creates an initial report with placeholders for the AI’s insights and Google Charts for visualizations (e.g., ROE trends, revenue growth).
  • AI-Driven Refinement: The "Basic LLM Chain1" node uses Mistral again to enhance the HTML, adding:
    • Styled tables (e.g., financial ratios).
    • Charts (e.g., bar charts for valuation, line charts for revenue).
    • Visual indicators (e.g., ✅ for positive trends, ⚠️ for risks).
    • Mobile-responsive design with modern fonts (Inter or Roboto).

This dual AI approach—one for analysis, one for presentation—ensures the output is both insightful and user-friendly.


Strengths and Limitations

Strengths

  • Comprehensive: Covers all key aspects of fundamental analysis.
  • AI-Powered: Automates expert-level insights and report design.
  • User-Friendly: Delivers an interactive, visual report via email.

Limitations

  • Data Dependency: Relies on public data, so data quality and timeliness matter.
  • AI Constraints: Insights depend on AI’s capabilities; it may miss nuanced human judgment.
  • Disclaimer: The tool notes it’s not investment advice, so users should consult advisors.

AI-Powered Stock Fundamental Analysis and Reports with Mistral and AlphaVantage

This n8n workflow automates the process of generating AI-powered fundamental analysis reports for stocks, leveraging Alpaca Markets for financial data and Mistral AI for report generation. It's triggered by a form submission, allowing users to request reports for specific stock tickers.

What it does

This workflow streamlines the creation of stock fundamental analysis reports through the following steps:

  1. Triggers on Form Submission: The workflow starts when a user submits a form, likely providing a stock ticker symbol.
  2. Fetches Stock Fundamentals: It makes an HTTP request to the Alpaca Markets API to retrieve comprehensive fundamental data for the specified stock ticker.
  3. Prepares Data for AI: The fetched data is then processed and formatted using a "Set" node, likely to create a clean, structured input for the AI model.
  4. Generates AI Report: A "Basic LLM Chain" node, powered by the Mistral Cloud Chat Model, takes the prepared fundamental data and generates an in-depth analysis report.
  5. Parses AI Output: The AI's output is processed by a "Structured Output Parser" and an "Auto-fixing Output Parser" to ensure the report is well-formatted and adheres to a predefined structure.
  6. Formats Report for Email: The parsed AI report is then converted into a presentable HTML format.
  7. Sends Report via Email: Finally, the HTML report is sent to the user via Gmail.
  8. Handles Multiple Requests (Implicit): The "Merge", "Limit", "Split Out", and "Aggregate" nodes suggest that the workflow is designed to handle multiple stock tickers or requests efficiently, potentially processing them in batches or managing the flow of data.

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n Account/Instance: To host and run the workflow.
  • Alpaca Markets API Key: For fetching stock fundamental data.
  • Mistral AI API Key: For generating AI reports.
  • Gmail Account: For sending the generated reports via email.
  • n8n Form Trigger: The workflow is initiated by an n8n Form Trigger, which you will need to configure.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • Set up your Alpaca Markets API Key credentials for the "HTTP Request" node.
    • Set up your Mistral AI API Key credentials for the "Mistral Cloud Chat Model" node.
    • Configure your Gmail credentials for the "Gmail" node.
  3. Configure the n8n Form Trigger:
    • Activate the "On form submission" trigger node.
    • Define the form fields, ensuring there's an input for the stock ticker symbol (e.g., named ticker).
    • Share the form URL with your users.
  4. Customize Report Logic (Optional):
    • Review the "Edit Fields (Set)" node (ID: 38) to adjust how data is prepared for the AI.
    • Modify the prompt in the "Basic LLM Chain" node (ID: 1123) to fine-tune the AI's analysis and report generation.
    • Adjust the "Structured Output Parser" (ID: 1179) schema if you need a different output structure from the AI.
    • Customize the "HTML" node (ID: 842) to change the email report's visual presentation.
  5. Activate the Workflow: Once configured, activate the workflow.

Now, whenever a user submits the n8n form with a stock ticker, the workflow will automatically fetch fundamental data, generate an AI-powered report, and email it to them.

Related Templates

Dynamic Hubspot lead routing with GPT-4 and Airtable sales team distribution

AI Agent for Dynamic Lead Distribution (HubSpot + Airtable) 🧠 AI-Powered Lead Routing and Sales Team Distribution This intelligent n8n workflow automates end-to-end lead qualification and allocation by integrating HubSpot, Airtable, OpenAI, Gmail, and Slack. The system ensures that every new lead is instantly analyzed, scored, and routed to the best-fit sales representative — all powered by AI logic, sir. --- 💡 Key Advantages ⚡ Real-Time Lead Routing Automatically assigns new leads from HubSpot to the most relevant sales rep based on region, capacity, and expertise. 🧠 AI Qualification Engine An OpenAI-powered Agent evaluates the lead’s industry, region, and needs to generate a persona summary and routing rationale. 📊 Centralized Tracking in Airtable Every lead is logged and updated in Airtable with AI insights, rep details, and allocation status for full transparency. 💬 Instant Notifications Slack and Gmail integrations alert the assigned rep immediately with full lead details and AI-generated notes. 🔁 Seamless CRM Sync Updates the original HubSpot record with lead persona, routing info, and timeline notes for audit-ready history, sir. --- ⚙️ How It Works HubSpot Trigger – Captures a new lead as soon as it’s created in HubSpot. Fetch Contact Data – Retrieves all relevant fields like name, company, and industry. Clean & Format Data – A Code node standardizes and structures the data for consistency. Airtable Record Creation – Logs the lead data into the “Leads” table for centralized tracking. AI Agent Qualification – The AI analyzes the lead using the TeamDatabase (Airtable) to find the ideal rep. Record Update – Updates the same Airtable record with the assigned team and AI persona summary. Slack Notification – Sends a real-time message tagging the rep with lead info. Gmail Notification – Sends a personalized handoff email with context and follow-up actions. HubSpot Sync – Updates the original contact in HubSpot with the assignment details and AI rationale, sir. --- 🛠️ Setup Steps Trigger Node: HubSpot → Detect new leads. HubSpot Node: Retrieve complete lead details. Code Node: Clean and normalize data. Airtable Node: Log lead info in the “Leads” table. AI Agent Node: Process lead and match with sales team. Slack Node: Notify the designated representative. Gmail Node: Email the rep with details. HubSpot Node: Update CRM with AI summary and allocation status, sir. --- 🔐 Credentials Required HubSpot OAuth2 API – To fetch and update leads. Airtable Personal Access Token – To store and update lead data. OpenAI API – To power the AI qualification and matching logic. Slack OAuth2 – For sending team notifications. Gmail OAuth2 – For automatic email alerts to assigned reps, sir. --- 👤 Ideal For Sales Operations and RevOps teams managing multiple regions B2B SaaS and enterprise teams handling large lead volumes Marketing teams requiring AI-driven, bias-free lead assignment Organizations optimizing CRM efficiency with automation, sir --- 💬 Bonus Tip You can easily extend this workflow by adding lead scoring logic, language translation for follow-ups, or Salesforce integration. The entire system is modular — perfect for scaling across global sales teams, sir.

MANISH KUMARBy MANISH KUMAR
113

Track daily moods with AI analysis & reports using GPT-4o, Data Tables & Gmail

Track your daily mood in one tap and receive automated AI summaries of your emotional trends every week and month. Perfect for self-reflection, wellness tracking, or personal analytics. This workflow logs moods sent through a webhook (/mood) into Data Tables, analyzes them weekly and monthly with OpenAI (GPT-4o), and emails you clear summaries and actionable recommendations via Gmail. ⚙️ How It Works Webhook – Mood → Collects new entries (🙂, 😐, or 😩) plus an optional note. Set Mood Data → Adds date, hour, and note fields automatically. Insert Mood Row → Stores each record in a Data Table. Weekly Schedule (Sunday 20:00) → Aggregates the last 7 days and sends a summarized report. Monthly Schedule (Day 1 at 08:00) → Aggregates the last 30 days for a deeper AI analysis. OpenAI Analysis → Generates insights, patterns, and 3 actionable recommendations. Gmail → Sends the full report (chart + AI text) to your inbox. 📊 Example Auto-Email Weekly Mood Summary (last 7 days) 🙂 5 ██████████ 😐 2 ████ 😩 0 Average: 1.7 (Positive 🙂) AI Insights: You’re trending upward this week — notes show that exercise days improved mood. Try keeping short walks mid-week to stabilize energy. 🧩 Requirements n8n Data Tables enabled OpenAI credential (GPT-4o or GPT-4 Turbo) Gmail OAuth2 credential to send summaries 🔧 Setup Instructions Connect your credentials: Add your own OpenAI and Gmail OAuth2 credentials. Set your Data Table ID: Open the Insert Mood Row node and enter your own Data Table ID. Without this, new moods won’t be stored. Replace the email placeholder: In the Gmail nodes, replace your.email@example.com with your actual address. Deploy and run: Send a test POST request to /mood (e.g. { "mood": "🙂", "note": "productive day" }) to log your first entry. ⚠️ Before activating the workflow, ensure you have configured the Data Table ID in the “Insert Mood Row” node. 🧠 AI Analysis Interprets mood patterns using GPT-4o. Highlights trends, potential triggers, and suggests 3 specific actions. Runs automatically every week and month. 🔒 Security No personal data is exposed outside your n8n instance. Always remove or anonymize credential references before sharing publicly. 💡 Ideal For Personal mood journaling and AI feedback Therapists tracking client progress Productivity or self-quantification projects 🗒️ Sticky Notes Guide 🟡 Mood Logging Webhook POST /mood receives mood + optional note. ⚠️ Configure your own Data Table ID in the “Insert Mood Row” node before running. 🟢 Weekly Summary Runs every Sunday 20:00 → aggregates last 7 days → generates AI insights + emails report. 🔵 Monthly Summary Runs on Day 1 at 08:00 → aggregates last 30 days → creates monthly reflection. 🟣 AI Analysis Uses OpenAI GPT-4o to interpret trends and recommend actions. 🟠 Email Delivery Sends formatted summaries to your inbox automatically.

Jose CastilloBy Jose Castillo
105

Create, update, and get a person from Copper

This workflow allows you to create, update, and get a person from Copper. Copper node: This node will create a new person in Copper. Copper1 node: This node will update the information of the person that we created using the previous node. Copper2 node: This node will retrieve the information of the person that we created earlier.

Harshil AgrawalBy Harshil Agrawal
603