Skip to main content
Open In Colab This notebook demonstrates how to build a real-time, LLM-powered stock analysis assistant by combining LlamaIndex with Dappier. It walks through building an β€œExplain This Ticker” app that gives real-time explanations for stock movements, technicals, and valuation. In this notebook, you’ll explore:
  • Dappier: A platform that connects LLMs and agentic AI agents to real-time, rights-cleared data from trusted sources. It delivers verified, prompt-ready information across domains like web search, finance, news, and more.
  • LlamaIndex: A data framework that allows seamless integration of external tools with LLMs. It enables structured workflows for tool use, reasoning, and response generation.
  • OpenAI: An advanced AI model provider used here to power the assistant’s reasoning, planning, and response generation.
This setup offers a practical example of building context-aware applications with real-time data access. It can be easily extended to other domains requiring live insights and AI-driven decision-making.

Watch the Video Guide

If you prefer a visual walkthrough, check out the accompanying video guide below:

Installation

To get started with the stock analyzer, install the required packages:

Setup API Keys

To authenticate and use Dappier and OpenAI, you’ll need valid API keys. You can generate one for free from your Dappier API dashboard.
Python
You can obtain your OpenAI API key from the OpenAI API dashboard.
Python

Dappier Real Time Search Tool

The DappierRealTimeSearchToolSpec enables LLMs to access real-time data across the web, including the latest news, weather updates, and financial information. This tool is ideal for applications requiring up-to-date, context-rich data.

Initialize the Tool

To utilize the real-time search tool, initialize it as follows:
Python

Real-Time Stock Market Data

Access up-to-date financial insights or company-specific news with the search_stock_market_data method:
Python

Build a Real-Time Stock Analysis Agent

Now that your API keys are set and packages are installed, you’re ready to build the stock analysis agent. Start by importing the required modules:
Python
Initialize the OpenAI model that will power the agent:
Python
Next, set up the Dappier real-time search tool. This tool allows the agent to query live stock-related news and market insights:
Python
Now define the agent workflow. In this case, the agent acts as a real-time stock explainer agent
Python
To stream the results from the agent and display both tool interactions and the generated explanation, run the following:
Python
Finally, launch the agent:
Python

Conclusion

This notebook has guided you how to build a real-time, LLM-powered stock analysis assistant by combining LlamaIndex with Dappier. It walks through creating a smart explanation engine for stock tickers using current news, technicals, and valuation insights. In this notebook, explored:
  • Dappier: A platform that connects LLMs and agentic AI agents to real-time, rights-cleared data from trusted sources. It delivers verified, prompt-ready information across domains like web search, finance, news, and more.
  • LlamaIndex: A data framework that allows seamless integration of external tools with LLMs. It enables structured workflows for tool use, reasoning, and response generation.
  • OpenAI: An advanced AI model provider used here to power the assistant’s reasoning, planning, and response generation.
This setup offers a practical example of building context-aware applications with real-time data access. It can be easily extended to other domains requiring live insights and AI-driven decision-making.