--- sidebar_position: 2 --- # L2 — Containers > **C4 Level 2**: Zooms into Stock Market Professional and shows its deployable units — services, databases, and schedulers. :::info C4 Model — Level 2 The Container diagram answers: *What are the high-level technical building blocks, and how do they talk to each other?* ::: ## Container Diagram ```mermaid C4Container title Container Diagram — Stock Market Professional Person(trader, "Trader", "Reviews signals, executes manually") System_Boundary(smp, "Stock Market Professional") { Container(ingestor, "Data Ingestor", "Python / APScheduler", "Polls market data APIs on schedule, normalises OHLCV candles, detects gaps.") Container(analyser, "Analysis Engine", "Python / pandas-ta", "Applies technical indicators and pattern recognition on latest candle data.") Container(signalGen, "Signal Generator", "Python", "Scores setups by confluence, filters by risk rules, produces ≤3 daily signals.") Container(scheduler, "Job Scheduler", "APScheduler / cron", "Orchestrates pipeline runs: ingest every minute, analyse every 5 min, generate plan pre-market.") ContainerDb(tsdb, "Market Data Store", "SQLite / TimescaleDB", "Stores normalised OHLCV candles, indicator snapshots, and signal history.") Container(notifier, "Notifier", "Python / Discord Webhook", "Formats and delivers the daily trading plan and intraday alerts.") } System_Ext(marketData, "Market Data APIs", "Yahoo Finance, Alpha Vantage, Polygon") System_Ext(discord, "Discord", "Signal delivery") System_Ext(newsApi, "Economic Calendar API", "Forex Factory, Investing.com") Rel(scheduler, ingestor, "Triggers", "Internal call") Rel(scheduler, analyser, "Triggers", "Internal call") Rel(scheduler, signalGen, "Triggers", "Internal call") Rel(ingestor, marketData, "Fetches OHLCV", "REST / WS") Rel(ingestor, tsdb, "Writes candles", "SQL") Rel(analyser, tsdb, "Reads candles", "SQL") Rel(analyser, tsdb, "Writes indicator snapshots", "SQL") Rel(signalGen, tsdb, "Reads snapshots", "SQL") Rel(signalGen, newsApi, "Checks economic calendar", "REST") Rel(signalGen, notifier, "Passes signals", "In-process") Rel(notifier, discord, "Posts daily plan", "Webhook") Rel(trader, discord, "Reads signals", "Discord UI") ``` ## Containers Inventory | Container | Technology | Responsibility | |---|---|---| | **Data Ingestor** | Python, requests, websockets | Poll & normalise market data | | **Analysis Engine** | Python, pandas, pandas-ta, ta-lib | Technical indicators + pattern recognition | | **Signal Generator** | Python | Confluence scoring, risk rules, signal assembly | | **Job Scheduler** | APScheduler | Pipeline orchestration & timing | | **Market Data Store** | SQLite (dev) / TimescaleDB (prod) | Persist OHLCV, indicators, signals | | **Notifier** | Python, Discord Webhook | Format and deliver signals | ## Deployment All containers run as a single **Python process** in development (scheduler + all modules), and can be split into separate Docker containers in production: ``` docker/ ├── ingestor/ # Data poller container ├── analyser/ # Analysis worker container ├── signal-gen/ # Signal generation + notifier └── timescaledb/ # Database container ``` The CI pipeline (Gitea Actions) builds images and pushes to the Zot container registry at `lego-cloud.eu:30264`.