Banner
← Return to Projects

AI Trading Assistant (Discord)

October 2025AIDiscord BotFinanceChatbotDiscord.jsNode.jsRailwayn8nGPT-4oTavily APIFinancial Modeling Prep APIQuickchart API
Project StatusIn Progress
RoleSolo Developer

The summer I became a "Finance Bro" (briefly).

Over the summer, my friends and I got deep into stock trading. We needed an edge; something faster than Googling and smarter than standard bots. I decided to build a custom Discord bot that we could ping in our chat to get real-time analysis using natural language.

This was my first time using the Discord API, and I pushed the limits of what AI Agents can do in n8n.

🏗️ The Hybrid Architecture

Instead of building a massive Node.js application, I designed a hybrid architecture for speed and flexibility.

  1. The Gateway (Node.js on Railway): A lightweight, 24/7 Node.js terminal running discord.js. It listens for pings, packages the message context (user, server, history), and fires it off via webhook.
  2. The Brain (n8n): The actual logic lives in an n8n workflow. This is where the AI decides which tools to use, and formats the response.
Railway terminal logs
The 24/7 Node.js gateway running on Railway.

Thanks to the terminal, the bot runs 24/7 and it's always online on Discord. You can ping it at any time and it will reply instantly.

Discord Bot Online
The bot is always ready.
Discord Bot Profile
The bot's profile

🧠 The n8n "Brain" & The Huge Prompt

I chose n8n because I wanted to get an AI agent running fast and n8n is the perfect tool for that.

The workflow is triggered by the Discord webhook. It uses a massive system prompt to tell GPT-4o exactly how to behave as a financial analyst.

The system prompt in N8N
The Omega Prompt that defines the AI's persona and rules.

The Two-Step Response: Because AI takes time to "think", the bot sends an immediate acknowledgement (e.g., "On it, boss. Checking the charts.") so the user knows it's working, before sending the final detailed analysis.

The complete N8N AI workflow
The n8n workflow. The AI Agent node is the centerpiece.

🛠️ The Agent's Tool Belt

The real power comes from the 5 tools I gave the AI agent access to. It doesn't just hallucinate answers; it fetches real-time data.

  • Financial Data: Uses the Financial Modeling Prep API for real-time prices, company profiles, and historical data.
  • Market Sentiment: Fetches the current Fear & Greed Index.
  • Web Research: Uses Tavily to perform live Google searches and extract content from news articles to understand why a stock is moving.
  • Charting: It can even generatex full graphs in the chat using the quickchart.io API
Fear and Greed
Displaying the Fear & Greed chart
ORB Strategy
With Tavily search, the bot has access to all the information on the internet

🚀 Lessons Learned

This project was a blast.

  • Discord API: Surprisingly straightforward. discord.js makes event handling easy.
  • AI Agents: I've used n8n many times before, but integrating 5 different tools and ensuring the AI chooses the right one required a lot of prompt engineering and testing.

Right now, the bot remains in private beta for me and my friends, but the architecture could be scaled enough to be public someday.

Back to Quest Log