Skip to content

Add Bloomberg terminal clone with Claude integration - #2

Open
SecretPoets wants to merge 1 commit into
mainfrom
claude/bloomberg-terminal-clone-Z7Kot
Open

Add Bloomberg terminal clone with Claude integration#2
SecretPoets wants to merge 1 commit into
mainfrom
claude/bloomberg-terminal-clone-Z7Kot

Conversation

@SecretPoets

Copy link
Copy Markdown
Owner

Description

This PR adds a complete Bloomberg-style terminal web application with Claude AI integration. The application demonstrates multiple Claude API capabilities in a single, cohesive demo.

What it includes

Frontend (frontend/):

  • index.html: Multi-panel Bloomberg terminal layout with watchlist, quote detail, news feed, and chat pane
  • style.css: 643 lines of Bloomberg-inspired styling (black background, amber text, CRT aesthetic)
  • app.js: Vanilla JavaScript frontend that fetches market data and streams chat responses

Backend (backend/):

  • main.py: FastAPI server serving static files and REST/SSE endpoints
  • mock_data.py: Self-contained mock financial data (quotes, history, news, indices, FX, commodities, crypto)
  • claude_client.py: Claude integration showcasing four API features:
    • Tool use: Claude calls get_quote, get_history, get_news, market_overview tools
    • Streaming: Tokens pushed to frontend as Server-Sent Events
    • Extended thinking: Optional thinking budget with separate UI panel
    • Prompt caching: Long system prompt cached with cache_control: ephemeral

Launcher & Dependencies:

  • run.py: Entry point that loads .env and starts uvicorn
  • requirements.txt: FastAPI, uvicorn, anthropic, pydantic, python-dotenv

Key features

  • No build step: Vanilla JS, no npm/webpack required
  • Offline-capable: All market data is mock data, no real API calls
  • Agentic loop: Tool-call → tool-result loop in stream_chat() until Claude stops requesting tools
  • Real-time UI: Watchlist and ticker strip update every 8-10 seconds; chart renders on symbol selection
  • Command interface: Type ticker symbols, NEWS, CHAT <question>, or HELP in the command bar
  • Responsive layout: Grid adapts from 3-column to 2-column on narrow screens

Why this is valuable

This cookbook demonstrates how to build a real-world, multi-feature Claude application with:

  • Proper tool definition and dispatch
  • Streaming integration with a web frontend
  • Prompt caching for cost efficiency on repeated queries
  • Extended thinking for complex financial analysis
  • Clean separation of concerns (frontend/backend/mock data)

All in a visually polished, immediately recognizable interface that makes the capabilities tangible.

Type of Change

  • New cookbook
  • Bug fix
  • Documentation update
  • Code quality improvement
  • Dependency update
  • Other

Cookbook Checklist

  • Cookbook has a clear, descriptive title ("TERM-AI: Bloomberg Terminal Clone")
  • Includes a problem statement (building a multi-feature Claude app with tool use, streaming, thinking, caching)
  • Code is well-commented (docstrings in Python, inline comments in JS)
  • Includes expected outputs (README describes layout and feature matrix)
  • Added entry to registry.yaml (to be done in follow-up or by maintainers)

Testing

  • Tested locally: frontend loads, watchlist/quote/news panels populate from mock data, chat streams responses with tool calls
  • All Python files are syntactically valid and follow project conventions
  • Frontend HTML/CSS/JS are valid and responsive
  • No external API calls required (mock data only)

Additional Context

How to run:

cd bloomberg-terminal-clone
pip install -r requirements.txt
cp .env.example .env  # Add ANTHROPIC_API_KEY
python run.py
# Open http://127.0.0.1:8000

Model used: claude-sonnet-4-6 (per project conventions)

Files added: 11 (HTML, CSS, JS, Python backend, mock data, launcher, requirements, README)

This is a self-contained, runnable demo that can serve as a reference for building production Claude applications with tool use, streaming, and advanced features.

https://claude.ai/code/session_01F6i5AgvYsgLnMvUYRk7ELQ

A Bloomberg-style web dashboard (FastAPI + vanilla JS, black/amber CRT
styling) with a built-in AI analyst pane that showcases four Claude API
features end-to-end: tool use against a mock-data layer, SSE streaming,
extended thinking, and prompt caching of the system prompt.

All market data is hard-coded mock data so the demo runs offline. Users
install via the cookbook's own requirements.txt and run `python run.py`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants