Tutorial: Building an Interactive Stock Analysis Report with Claude Code¶
In this tutorial, you will create a complete stock analysis report that visualizes price movements and trading patterns for multiple stocks using Claude Code from the command line.
By the end, you'll have built an interactive report that displays financial data with professional charts and statistics.
What you'll learn
- How to use Claude Code to plan and build data applications
- How to use the
holoviz_displaytool to quickly visualize and persist your work - How to work with stock data using
yfinance - How to iterate on visualizations using natural language
Prerequisites
Before starting, ensure you have:
- Claude Code CLI installed and configured (Getting Started Guide)
Step 1: Plan Your Report¶
First, let's ask Claude to help us plan our stock analysis report. Open claude and run:
I want to quickly display a stock analysis report showing AAPL and META's hourly data for the last 60 days.
The report should include:
- Individual price charts for each stock
- Summary statistics table
- Normalized comparison overlay
- Trading volume visualization
- Professional styling
Please design and plan this report. Keep it simple and as a single script.
Claude will use holoviz-data-explorer to develop a detailed architecture plan:

What you'll see
Claude will outline a clear plan for building your report, including the key libraries and components needed.
Step 2: Implement the Report¶
Now let's ask Claude to implement the report and use the display tool to show it:
Claude will:
- Generate the complete Python code
- Use the
holoviz_displaytool to execute it - Provide a URL where you can view the results
You should see output like:
Step 3: View Your Report¶
Open the URL in your browser. You should see your stock analysis report with:
- Individual price charts showing AAPL and META stock movements
- Summary statistics table with key metrics (open, high, low, close, volume)
- Normalized comparison overlaying both stocks to compare relative performance
- Volume visualization showing trading activity

Checkpoint
If you see interactive charts like the above, congratulations! You've successfully created a stock analysis report. Try hovering over the charts - they're interactive!
Step 4: Experiment with Different Stocks¶
Now that you understand how the report works, let's modify it to analyze different stocks:
Claude will generate updated code with the new stocks and provide a new URL to view the modified report.

Step 5: Add More Features¶
Let's enhance the report by adding a moving average to the price charts:
Claude will update the code to include moving average trend lines and provide a new URL to view the enhanced report.

What you've learned
You can iterate on your report by asking for modifications in natural language. Claude understands the existing code structure and makes appropriate changes.
Step 6: Save Your Work¶
The reports you created are stored by the Display Server. To save one as a permanent file:
- Navigate to the Display Server feed at
http://localhost:5005/feed - Find your stock analysis report
- Click the Copy Code button

- Create a new file called
stock_report.pyin your project - Paste the code and save
Now you have a standalone Python file! You can run it anytime:
Common Issues and Solutions¶
Module Not Found Error¶
What you see: ModuleNotFoundError: No module named 'yfinance'
Why it happens: The required package isn't installed in your Python environment
Solution: Install the missing package:
Charts Not Displaying¶
What you see: Empty page or error when clicking the view URL
Why it happens: The Display Server might not be running or there's a code error
Solution:
- Check that Claude Code MCP server is configured:
claude mcp list - Look at the error message in the report for specific issues
- Ask Claude to fix any code errors:
Connection Refused Error¶
What you see: Connection refused when accessing the display URL
Why it happens: The Display Server isn't running
Solution: The Display Server should start automatically with the MCP server. Check Claude Code's output for startup messages.
What You've Accomplished¶
Congratulations! In this tutorial, you have:
- ✅ Planned and built a data analysis application with Claude Code
- ✅ Implemented a complete stock analysis report
- ✅ Created interactive charts with hvPlot
- ✅ Built a multi-component report with Panel
- ✅ Explored interactive visualization features
- ✅ Modified the report to analyze different stocks
- ✅ Added new features through natural language requests
- ✅ Saved your work as a standalone Python application
Next Steps¶
Now that you've mastered stock analysis with Claude Code, try:
- Weather Dashboard Tutorial: Build another interactive dashboard
- Display System Guide: Learn more about the display capabilities
- Expand your report: Add technical indicators (RSI, MACD, Bollinger Bands)
- Real-time updates: Make the report refresh with live data
- Portfolio analysis: Compare multiple stocks with portfolio weights
Happy analyzing! 📈