Stock AI YouTube Pipeline
Overview
A fully automated pipeline that produces weekly AI-generated stock analysis videos and uploads them to YouTube with zero manual intervention.
Pipeline
1. Data fetch: yfinance pulls weekly OHLCV and fundamental data for a predefined watchlist. 2. Script generation: OpenAI GPT-4 receives the market data and produces a structured narration script with headline, key moves, and outlook sections. 3. Visual synthesis: Stable Diffusion generates thematic background images; price charts are rendered with matplotlib and composited via moviepy. 4. Upload: the finished MP4 is uploaded to YouTube via the Data API v3 with auto-generated title, description, and tags.
Design decisions
GPT-4 is prompted with a strict JSON output schema so the script parser is deterministic. Stable Diffusion runs locally to avoid per-image API costs. moviepy handles all video composition, transitions, and audio overlay. The full pipeline runs in under 10 minutes on a consumer GPU.