Latest / AI Fire Daily / #205 Max: How I Built a Stock Analyst AI Agent With No Code (Complete n8n Tutorial)
Transcript
- 0:00Imagine this. You send a quick message, maybe
- 0:02on Telegram, maybe Slack, and just seconds later,
- 0:05you get back a really detailed professional technical
- 0:09stock analysis. Yeah, like full breakdown, mass
- 0:12CD, support, resistance lines, even the actual
- 0:16chart image right there on your phone. Exactly.
- 0:18It sounds like something you'd need, I don't
- 0:19know, expensive financial software for. Right.
- 0:22But here's the kicker. This whole thing, this
- 0:25advanced agent system, it was built in just a
- 0:27few hours. And get this completely no code. Wow.
- 0:31Yeah, it's not just some simple chatbot fetching
- 0:33a price. It's a proper AI agent. It's even running
- 0:37a pretty sophisticated dual model strategy. Welcome
- 0:39to the deep dive. So today we're going to open
- 0:42up the hood on that exact system, the personal
- 0:44AI stock analyst. Our mission really is to get
- 0:47our heads around the architecture. This two part.
- 0:50two AI models set up that makes it all tick.
- 0:52Yeah, we'll map out what it can actually do,
- 0:54you know, memory comparisons, that kind of stuff.
- 0:56Then we'll really dig into that core idea, the
- 0:59brain versus the specialist separation. And crucially,
- 1:03you'll see why they picked two totally different
- 1:06AI models. You know, one that's great for reasoning,
- 1:09the thinking part, and another one completely
- 1:11separate that's amazing at visual stuff, like
- 1:14reading those charts. All right, let's dive in.
- 1:16Let's do it. okay so let's unpack what this system
- 1:19actually does day to day it seems to handle three
- 1:23main things that make it feel like a proper agent
- 1:25not just you know a simple script right the first
- 1:28one's pretty straightforward single stock analysis
- 1:31you feed it a ticker symbol like uh NASDAQ .UXU
- 1:35or whatever. Exactly. And you get back a full
- 1:37professional style report. Trend health, key
- 1:40price levels, mass D analysis, volume. Yeah.
- 1:43The whole nine yards. That's kind of the baseline.
- 1:45Yeah. Yeah. But the second function, comparative
- 1:47analysis, that's where this split architecture
- 1:50really starts to shine, I think. How so? Well,
- 1:53you can ask it to compare two stocks, say Alphabet
- 1:55versus Microsoft. Yeah. Like in the example,
- 1:58it doesn't just give you two separate reports.
- 2:00It runs the entire technical breakdown for both,
- 2:03generates the charts for each one, and then,
- 2:05this is the cool part, it performs this higher
- 2:09level reasoning to give you a final summary comparing
- 2:11them side by side. Ah, so it synthesizes the
- 2:14information. It doesn't just fetch it. Precisely.
- 2:17And that leads to the third really key function,
- 2:20smart memory. Right. The conversational aspect.
- 2:22Yeah. So if you just ask for that alphabet analysis,
- 2:25you can immediately follow up with something
- 2:27simple like, OK, now compare that to Microsoft.
- 2:29And it knows what that. refers to. Exactly. It
- 2:32remembers the last, say, five messages in the
- 2:34conversation. So you don't have to repeat the
- 2:36ticker. You don't waste time or API credits reanalyzing
- 2:41the first doc. It just picks up where you left
- 2:43off. That makes sense. And I guess that complexity
- 2:45needing memory, needing to synthesize comparisons,
- 2:47that's what drives this dual architecture idea.
- 2:51You got it. Separating the manager from the doer.
- 2:53So part one is the AI agent brain. Think of it
- 2:57like the CEO. This is the main workflow. probably
- 3:00built in something like NADN. It handles the
- 3:03chat, keeps track of the conversation history,
- 3:05that memory decides when it needs help from a
- 3:08specialist, and then takes the specialist output
- 3:10and formats the nice final report for you. And
- 3:13part two is? Part two, the technical analysis
- 3:16tool. The specialist. This is a totally separate,
- 3:20smaller workflow. A sub -workflow. Okay, a sub
- 3:23-workflow. Let's define that quickly. Sure. A
- 3:25sub workflow is basically like a dedicated mini
- 3:27program the main system can call up whenever
- 3:29it needs a specific task done. Like calling a
- 3:32consultant for a specific job. Exactly like that.
- 3:35This specialist one, it does one thing. Perfectly.
- 3:37Takes a stock ticker, calls an outside service
- 3:40and API to generate the chart image, and then
- 3:42does the raw technical analysis on that chart.
- 3:45OK, but I have to ask, doesn't splitting it into
- 3:48a CEO and a specialist make things more complex,
- 3:51like harder to build and manage, especially in
- 3:53a no code setup? Why not just cram it all into
- 3:56one big workflow? That's a great question. It
- 3:59seems counterintuitive, right? But actually,
- 4:01it makes things way less complex in the long
- 4:03run. Really? By separating them. The main CEO
- 4:06system stays really clean and focused just on
- 4:08managing the conversation and logic. It's modular.
- 4:11So let's say tomorrow you want to add a tool
- 4:13that analyzes, I don't know, options data. You
- 4:17just build a new separate specialist sub -workflow
- 4:20for options, tell the CEO about it, and plug
- 4:22it in. The core brain doesn't get cluttered.
- 4:25It makes the whole system much easier to manage
- 4:27and scale up with new tools later. Ah, I see.
- 4:30So that separation actually promotes clarity
- 4:33and makes it easier to add more capabilities
- 4:36down the road. Precisely. Scalable clarity. That's
- 4:39the goal. Okay, so we've got the CEO of the brain.
- 4:41Now, which AI model do you actually pick for
- 4:44that role? It used to be, you know, you'd just
- 4:46go with the biggest name or whatever was hyped
- 4:48that week. Right, whatever was trending on Twitter.
- 4:50Exactly. Yeah. But for something like financial
- 4:52analysis, you need proof it actually performs
- 4:54under pressure. The source material mentions
- 4:57this platform, mouse1 .ai, that runs something
- 5:00called the Alpha Arena. The Alpha Arena. What
- 5:03is that exactly? Sounds intense. It kind of is.
- 5:05It's basically this live high stakes competition
- 5:08for different AI models. They compete in this
- 5:11real time streaming environment designed to simulate,
- 5:15you know, dynamic market conditions. So it tests
- 5:18how well they reason and how reliable they are
- 5:21when things are constantly changing, like in
- 5:22actual trading. You got it. It's about battle
- 5:25-tested performance, not just benchmark scores
- 5:27or, you know, how fast it spits out tokens. Okay,
- 5:30so based on that kind of testing, which model
- 5:33did they choose for the brain? The data apparently
- 5:36pointed towards using DeepSeq v3 .1 chat. That
- 5:41became the core reasoning engine, the CEO brain.
- 5:43DeepSeq. Okay. And how do you actually connect
- 5:45to it? They used OpenRouter. Right, OpenRouter.
- 5:48Let's quickly define that too. Yeah, simple one.
- 5:50OpenRouter is just an aggregator that lets you
- 5:52access lots of different AI models using just
- 5:54one API key. Super flexible. Gives you options
- 5:57if you want to swap models later. Exactly. Now,
- 6:00critical for this brain, remember that smart
- 6:02memory we talked about? Yeah, remembering the
- 6:04last five messages. Right. The absolute crucial
- 6:07setup step there, and this is the bit people
- 6:10apparently mess up all the time, is you must
- 6:12tie that memory to the specific chat ID coming
- 6:15from the Telegram trigger. Ah, okay. So the memory
- 6:18is unique to each user conversation. What happens
- 6:21if you forget that link? What's the failure mode?
- 6:23Oh, it's instant chaos. Utter chaos. Imagine
- 6:27you're asking about Apple, right? And someone
- 6:30else in a totally separate chat just asked about
- 6:33Tesla. Uh -oh. Yeah. Suddenly you might start
- 6:36getting the Tesla analysis popping up in your
- 6:38Apple chat. The conversation memory gets completely
- 6:40crossed. It just obliterates the user experience.
- 6:43You have to link it to that unique chat ID. Got
- 6:45it. Okay. So you've picked the model based on
- 6:47performance. You've set up the memory correctly.
- 6:49Right. What's next? Defining what the agent should
- 6:51actually do. Exactly. You need to give it its
- 6:53job description, its personality, its rules,
- 6:56and that's done via the system prompt. The prompt.
- 6:58Okay. And the sources mention this needs to be
- 7:01really structured, not just a paragraph of text.
- 7:03Absolutely. That structure is like your defense
- 7:07against prompt drift, where the AI starts forgetting
- 7:11its instructions over time or gets sidetracked.
- 7:13Makes sense. So what's the structure look like?
- 7:15It starts with an overview, basically telling
- 7:17the AI who it is, like you are an expert technical
- 7:20stock analyst. Then comes context listing the
- 7:23tools it has access to. like our chart specialist,
- 7:26and maybe what data sources it can use. After
- 7:29that, step -by -step instructions on how to handle
- 7:31requests. Okay, overview, context, instructions,
- 7:34what else? Then, importantly, detailed tool descriptions.
- 7:38So, explicitly naming the get chart tool and
- 7:40maybe explaining what it does. And finally, SOPs
- 7:43as standard operating procedures. This is where
- 7:46you repeat the absolute most critical rules,
- 7:48like the big one. Do not give explicit financial
- 7:50advice. You hammer that home. That structured
- 7:53approach seems vital. Oh, it is, honestly. I
- 7:55still wrestle with prompt drift myself sometimes.
- 7:58Keeping things tightly structured like this,
- 7:59especially with those SOPs, is pretty essential
- 8:01for keeping the agent reliable and focused query
- 8:04after query. So let's connect that back. If we're
- 8:07building this scalable no -code system, Why is
- 8:10going through the trouble of using something
- 8:11like the Alpha Arena to pick maybe a less common
- 8:14model like DeepSeek V3 .1 so important? Why not
- 8:18just default to, say, GPT -4 or Claude, which
- 8:21everyone knows? Yeah, good question. It comes
- 8:23back to that performance under pressure idea.
- 8:26The Alpha Arena helps select the model that's
- 8:28proven to be most reliable and accurate specifically
- 8:31for this kind of dynamic reasoning task. In finance,
- 8:35you know, that reliability, that accuracy when
- 8:37things get volatile, that trumps familiarity
- 8:39every single time. You want the best cool for
- 8:41that specific brain function. OK, so the CEO
- 8:43brain running on DeepSeek decides it needs a
- 8:46chart and some analysis for, say, Apple. How
- 8:48does it actually hand off that specific task
- 8:50to the specialist tool, that sub workflow? Right.
- 8:53So the brain basically calls the specialist.
- 8:55tool using its unique url that call triggers
- 8:58the sub workflow to start running like dialing
- 9:01its direct number kind of yeah and the absolute
- 9:04key detail here for setup is the naming the name
- 9:07you give the sub workflow in your no code tool
- 9:10Let's say you call it get chart. That name has
- 9:13to exactly match the tool name you defined back
- 9:16in the brain system prompt. Exactly match, like
- 9:18capitalization and everything. Everything. Case
- 9:20sensitive, spaces, underscores, whatever. If
- 9:23it's off by even one character, the brain basically
- 9:26says, I don't know what tool you're talking about.
- 9:28And the whole process breaks down. Connection
- 9:30failed. Okay, meticulous naming is critical.
- 9:33So the specialist gets the call. Its first job
- 9:36is getting the actual chart image, right? It
- 9:38uses that free service chart IMG ATI. Yep, that's
- 9:42the one. And the sources pointed out a really
- 9:44neat efficiency trick here for setting up that
- 9:46API call in NANN. Ah, yeah, they called it the
- 9:48pro gamer move using the CRL import method. Uh
- 9:51-huh, yeah, that's the one. And it's genuinely
- 9:54a massive time saver. So what does that trick
- 9:56actually do for the person? Building this. How
- 9:59does it simplify things? Well, instead of manually
- 10:01setting up every single parameter for the API
- 10:03call, you know, the headers, the request body,
- 10:06the authentication method, which can be super
- 10:09tedious and error prone. Right. Fiddling with
- 10:11JSON and stuff. Exactly. You just find the example
- 10:13CRL command in the chart IMG API documentation.
- 10:16It's usually just a snippet of text. You copy
- 10:19it and you paste it into this specific import
- 10:21function in the NNN HTTP request node. And then?
- 10:25Bam. And it automatically configures the entire
- 10:27node for you. So that's all the headers, parameters,
- 10:29everything based on that URL command. It literally
- 10:32turns what could be hours of debugging into like
- 10:3510 seconds of copy paste. Wow. Okay. That is
- 10:39a huge shortcut. So when configuring that API
- 10:42request to chart IMG, what are the key settings?
- 10:45Two main things mentioned. First, using storage
- 10:47in the API's URL path. That tells Chart .img
- 10:50to generate the chart and give you back a public
- 10:53URL link to the image file, which is what we
- 10:55need. Okay, so you get a link to the picture.
- 10:57Yep. And second, you need to dynamically insert
- 10:59the stock ticker the user actually asked for.
- 11:02Use an N8N expression for that, something like
- 11:04trainison .query. That pulls the ticker, say
- 11:07NASDAQ key geog, from the data the brain sent
- 11:10over and sticks it into the API call. Got it.
- 11:13So the chart gets generated. We get a URL back.
- 11:16What's step three? Step three is actually downloading
- 11:18that image. You need the image file, not just
- 11:21the link, to feed to the Vision AI later. So
- 11:24that requires a second HTTP request node. Another
- 11:27API call. Yeah, this one just takes the URL from
- 11:29step two and fetches the actual image data. And
- 11:33the crucial setting here is you have to set the
- 11:35response format to binary. Binary. Okay, what
- 11:38exactly is binary data here? Think of binary
- 11:40data as the raw file format for the image itself,
- 11:43the actual pixels and colors that an AI vision
- 11:45model can understand. Not text. Right. If you
- 11:48forget to set it to binary, the node just downloads
- 11:50the image link as text, and when you pass that
- 11:52text to the vision AI, well, it can't see text.
- 11:55It needs the picture. Analysis fails instantly.
- 11:58Okay, binary format is key for the image download.
- 12:01And that brings us to step four, the actual specialized
- 12:04analysis using AI vision. And this is where that
- 12:08dual AI strategy really comes into play, right?
- 12:10Exactly. Because even though our brain is deep
- 12:13seek, for this specific task, analyzing the visual
- 12:15chart, we switch models, we use GPT -4O. Ah,
- 12:19interesting. Why the switch? Because, well...
- 12:22Currently, GPT -4 is generally considered the
- 12:24best model out there, specifically for visual
- 12:26analysis, for understanding images. So you're
- 12:29using the best tool for each distinct job, DeepSeq
- 12:32for reasoning and managing, GPT -4 for seeing.
- 12:35Precisely. We're essentially paying a bit more
- 12:37maybe for that specific vision step, but we're
- 12:39outsourcing that really critical high -value
- 12:41task, interpreting the candlestick patterns,
- 12:43the Mali lines, the volume bars visually to the
- 12:46absolute best specialist model available for
- 12:49that job. That makes a lot of sense. Pick the
- 12:51expert for the specific task. It really demonstrates
- 12:53the power of this modular approach. Whoa. Just
- 12:58imagine scaling this kind of architecture, like
- 13:00across a huge company, using the absolute best
- 13:04AI model for every single tiny step in a really
- 13:07complex business workflow. That feels like the
- 13:10future of building AI agents, doesn't it? It
- 13:12really does. So when you feed that downloaded
- 13:14chart image to GPT -40, what do you ask it to
- 13:16look for? The prompt must be pretty specific.
- 13:19Oh, yeah. Super specific. You don't just say
- 13:20analyze this chart. You instruct it to perform
- 13:22distinct types of analysis. Yeah. Detailed candlestick
- 13:26pattern analysis, MCG analysis, like is it crossing
- 13:29over? Volume analysis, are there spikes? And
- 13:32crucially, to identify and map the key support
- 13:35and resistance levels directly onto what's understanding
- 13:37the chart. So you're forcing it to act like a
- 13:39real technical analyst, looking for those specific
- 13:41indicators, not just describing the picture.
- 13:43Exactly. You want a professional readout, actionable
- 13:46insights derived from the visual data. So drilling
- 13:48down on that, what is the biggest advantage then
- 13:50of using an AI vision model to look at the chart
- 13:53image compared to just feeding a regular text
- 13:56-based AI model the raw price and volume data
- 13:59in tables? Great question. It's about pattern
- 14:02recognition, really. The vision model can instantly
- 14:05see complex visual patterns like a bullish engulfing
- 14:08candlestick pattern or the specific shape of
- 14:11a Mackie divergence or a sudden volume spike
- 14:13coinciding with a price move. It can recognize
- 14:16these holistic visual signals. much faster and
- 14:18often more reliably than a text model trying
- 14:21to infer those same patterns just from raw numbers
- 14:24in a table. It literally sees the picture the
- 14:26way a human analyst would. So we put it all together.
- 14:29User sends a message on Telegram. The brain,
- 14:31deep -seek, figures out what's needed, maybe
- 14:33calls a specialist sub -workflow. The specialist,
- 14:35using chart IMG API, generates the chart image
- 14:39URL, then downloads the binary image data. Right.
- 14:42Then that image is sent to the vision AI, GPT
- 14:45-4, with specific analysis instructions. GPT
- 14:48-4 sends back the detailed text analysis. Which
- 14:50goes back to the specialist, then back up to
- 14:53the brain. The brain takes that analysis, maybe
- 14:56combines it with conversation history or other
- 14:58analysis if it was a comparison request. And
- 15:01finally formats it all into a nice message and
- 15:03sends it back to the user on Telegram. Exactly.
- 15:06And the amazing thing is that whole round trip.
- 15:09Apparently it takes only about 10 to 20 seconds.
- 15:11Wow, that's remarkably fast for that much processing
- 15:14and multiple AI calls. It really is. And that
- 15:17architecture really proves its worth with that
- 15:19multi -stock comparison feature we talked about
- 15:21earlier. Right, comparing Alphabet and Microsoft.
- 15:24Yeah. The brain is smart enough to recognize
- 15:26this needs two separate analyses. So it calls
- 15:29a socialist tool twice, once for each stock.
- 15:32Gets back two sets of chart analysis texts from
- 15:35GPT -4. And then... The brain performs that high
- 15:39-level reasoning itself using DeepSeq to synthesize
- 15:42those two reports into that final comparative
- 15:44summary for the user. It's a real orchestration
- 15:47feat, managing that flow. Definitely sounds like
- 15:49it. Now, are there any limitations or things
- 15:52to watch out for with this specific build? Yeah,
- 15:55a couple of key ones mentioned. First, that free
- 15:57chart IMG API they used. It's limited. It only
- 16:00works for NASDAQ -listed securities. Ah, okay.
- 16:03So if you ask for a stock on the London Stock
- 16:06Exchange or something. The sub -workflow will
- 16:08probably just fail, hopefully gracefully, but
- 16:11you won't get a chart or analysis back. That's
- 16:14a limitation of that specific free tool. Good
- 16:17to know. What about common mistakes people make
- 16:19when trying to build something like this? Two
- 16:21big ones were highlighted. And they're easy traps
- 16:23to fall into. First, we mentioned it, but it's
- 16:26worth repeating. The tool name. The name you
- 16:30give your specialist workflow, like GetChart
- 16:32in your no -code platform, must perfectly, exactly
- 16:35match the tool name you wrote in the brain system
- 16:38prompt. Case -sensitive spaces, the whole deal.
- 16:40Got it. Get it wrong, and the brain can't call
- 16:43the specialist dead end. Nah. The second big
- 16:45one, and we also touched on this, is ensuring
- 16:47the chat ID variable. From Telegram. Yes, making
- 16:50absolute sure it's correctly mapped not just
- 16:52to the memory node, but also to all the Telegram
- 16:54send nodes that reply back to the user. Why all
- 16:57the send nodes too? Because if you only link
- 17:00it to memory, but not the reply node, the agent
- 17:03might remember the right conversation, but it
- 17:05could still accidentally send the reply to the
- 17:07wrong user's chat window. You need that chat
- 17:10ID guiding both memory and replies to keep everything
- 17:13strictly tied to the right conversation. Missing
- 17:16that is how you get those frustrating crossed
- 17:17messages. Okay, so map the chat ID everywhere
- 17:21it relates to a specific user interaction, memory,
- 17:24and sending messages back. Bingo. Nail those
- 17:27two things, exact tool names and consistent chat
- 17:29ID mapping, and you avoid probably... 80 % of
- 17:33the common frustrations. And all this efficiency,
- 17:35this complex orchestration, it really brings
- 17:38us back to the power of no -code advantage, doesn't
- 17:40it? Absolutely. I mean, think about it. This
- 17:42system connects multiple different APIs, manages
- 17:45conversational state with memory, strategically
- 17:48swaps between different best -in -class AI models
- 17:50for different tasks. And delivers results in
- 17:53seconds. Yeah. And it was all built. Visually,
- 17:55in maybe a few hours, on a platform like NAN,
- 17:58a traditional software developer trying to code
- 18:01this from scratch, setting up the servers, the
- 18:03API integrations, the state management, the model
- 18:06switching logic, that could easily be a multi
- 18:09-week, maybe even multi -month project. It really
- 18:11lowers the barrier to creating sophisticated
- 18:13AI tools. Fundamentally. It democratizes the
- 18:16ability to build these complex, specialized AI
- 18:19agents. That's the real power here. Hashtag,
- 18:22hashtag, hashtag outro. So reflecting on this
- 18:24whole project, it feels like it demonstrates
- 18:25three really critical ideas for building advanced
- 18:28AI systems now. First, that separation of concerns.
- 18:32Using that brain specialist architecture, the
- 18:34CEO and the expert consultant model, it just
- 18:37makes systems cleaner, more modular and much
- 18:39easier to scale later on. Yeah, definitely. Second
- 18:42big takeaway, AI vision is a game changer. The
- 18:44ability for AI to actually analyze images like
- 18:47these stock charts unlocks totally new possibilities.
- 18:49It lets the agent see the market in a way text
- 18:51alone can't capture. It moves beyond just processing
- 18:55numbers. And third, it highlights that tools
- 18:57make the agent. An AI agent isn't just defined
- 19:00by its conversational ability anymore. It's defined
- 19:03by the specialized tools it can connect to and
- 19:05use effectively to perform complex multi -step
- 19:08actions out in the world. That's so true. And,
- 19:10you know, this specific brain plus specialist.
- 19:13tool architecture. It's not just for stocks.
- 19:15You can adapt this exact model for countless
- 19:18other specialized uses. Like what? Oh, I don't
- 19:21know. Maybe a financial advisor tool that pulls
- 19:23specific compliance documents or a trading education
- 19:26bot that can analyze user submitted practice
- 19:28trades or even hyper -focused content creation
- 19:31tools for any niche industry where you have specialized
- 19:34data sources or analysis steps. The pattern is
- 19:37reusable. That's a really powerful idea. So maybe
- 19:40the final thought for everyone listening is this.
- 19:42If you can build an expert technical stock analyst
- 19:45with no code. What other specialized tools, unique
- 19:48data sources, or expert processes exist in your
- 19:51field? Yeah, what could you connect an AI agent
- 19:54brain to? Because the future here seems to be
- 19:56less about just building a better chatbot and
- 19:58more about building better connections, orchestrating
- 20:01these specialized tools to achieve complex, valuable
- 20:04tasks. It's about connection and action, not
- 20:07just conversation.