How prielkrishtal/filingbot works
FilingBot turns SEC Form 4 filings into classified insider-trading alerts and offers Telegram users report-based Q&A. The documented pipeline runs from scheduled EDGAR polling and XML parsing, through persisted filings and LLM classification, to optional 10-Q enrichment and Telegram notification; the bot also supports on-demand RAG Q&A. The sampled code shows ingestion, classification, notification, shared persistence, and Redis Streams. Enrichment and vector indexing are documented capabilities but their implementation is not present in the supplied tree, so those links are documented rather than source-verified.
Main entry points: main.py Classification worker · edgar_poller.py EDGAR poller · models.py PostgreSQL · redis_client.py Redis Streams
Components 26
Filing ingestion
- Poll scheduler
ingestion/main.py - EDGAR poller
ingestion/edgar_poller.py - Form 4 parser
ingestion/form4_parser.py - Request throttling
ingestion/rate_limiter.py - Filing persistence
ingestion/main.py
Signal classification
- Classification worker
workers/classification/main.py - Insider history
workers/classification/history_service.py - LLM classifier
workers/classification/classifier.py - Classification prompts
workers/classification/prompts.py
Report enrichment
- 10-Q enrichment
workers/enrichment - Company report index
workers/enrichment
Alerts and Q&A
- Notification worker
workers/notification/main.py - Alert formatting
workers/notification/message_builder.py - Telegram bot
telegram_bot/handlers/commands.py
Shared infrastructure
- PostgreSQL
core/database/models.py - Redis Streams
core/redis_client.py - Filing schemas
core/schemas/filing.py - Domain enums
core/schemas/enums.py - Service configuration
core/config.py - Structured logging
core/logging_config.py - Database sessions
core/database/session.py - Ticker directory
core/ticker_directory.py
Other components
- SEC EDGAR
- Telegram users
- Telegram API
- Groq API
Connections 36
- Poll scheduler → EDGAR poller: polls
ingestion/main.py - EDGAR poller → SEC EDGAR: fetches filings
README.md - EDGAR poller → Request throttling: throttles requests
ingestion/edgar_poller.py - EDGAR poller → Form 4 parser: parses XML
ingestion/edgar_poller.py - EDGAR poller → Filing schemas: returns filings
ingestion/edgar_poller.py - Filing persistence → EDGAR poller: requests filings
ingestion/main.py - Filing persistence → PostgreSQL: stores filings
ingestion/main.py - Filing persistence → Redis Streams: publishes raw
ingestion/main.py - Classification worker → Redis Streams: consumes raw
workers/classification/main.py - Classification worker → PostgreSQL: loads and updates
workers/classification/main.py - Classification worker → Insider history: loads history
workers/classification/main.py - Insider history → PostgreSQL: queries filings
workers/classification/history_service.py - Classification worker → LLM classifier: classifies filing
workers/classification/main.py - LLM classifier → Classification prompts: uses prompts
workers/classification/classifier.py - LLM classifier → Groq API: requests classification
README.md - Classification worker → Redis Streams: publishes classified
workers/classification/main.py - Classification worker → Filing schemas: validates filing
workers/classification/main.py - Classification worker → Domain enums: sets pipeline status
workers/classification/main.py - 10-Q enrichment → Company report index: indexes reports
README.md - 10-Q enrichment → SEC EDGAR: downloads 10-Q
README.md - Notification worker → Redis Streams: consumes classified
workers/notification/main.py - Notification worker → PostgreSQL: loads users and filing
workers/notification/main.py - Notification worker → Alert formatting: builds alert
workers/notification/main.py - Notification worker → Telegram API: sends messages
workers/notification/main.py - Telegram users → Telegram bot: asks questions
README.md - Telegram bot → Company report index: queries report index
README.md - Telegram bot → PostgreSQL: reads user data
telegram_bot/handlers/commands.py - Telegram bot → Ticker directory: looks up tickers
telegram_bot/handlers/commands.py - Telegram API → Telegram users: delivers alerts
README.md - Database sessions → Service configuration: configures connection
core/database/session.py - PostgreSQL → Database sessions: uses base model
core/database/models.py - Redis Streams → Service configuration: configures client
core/redis_client.py - Redis Streams → Structured logging: logs events
core/redis_client.py - EDGAR poller → Service configuration: loads SEC settings
ingestion/edgar_poller.py - Filing schemas → Domain enums: uses domain enums
core/schemas/filing.py - PostgreSQL → Domain enums: stores statuses
core/database/models.py