Multi-Exchange Automated Stock Price Pipeline
A production-grade web scraping microservice that automatically collects real-time financial data for 2,000+ public companies across 10 African stock exchanges without manual intervention.
Role
Backend & Data Engineer
Coverage
2,000+ Public Companies
Status
99.9% Production Uptime
Schedule
Every 5 Hours

Infrastructure Status: DigitalOcean App Platform container deployment running continuous 5-hour automated stock pricing jobs across 10 regional exchanges.
0+
Tracked Companies
0
Stock Exchanges
0%
Production Uptime
0
Manual Interventions Required
Fragmented Data Across African Exchanges
African stock market data is historically fragmented, lacking unified APIs or centralized data feeds. Gathering daily quotes, trading volumes, and P/E metrics across 2,000+ public companies manually was impossible at scale.
The challenge was building a resilient, autonomous pipeline capable of crawling diverse web structures, handling rate limits dynamically, and storing structured historical time-series data without failing.
Automated Scraping Microservice with Exponential Backoff
I engineered a FastAPI microservice deployed in a Docker container on DigitalOcean. The pipeline executes every 5 hours via automated cron jobs, fetching live market data, parsing structured tables, and upserting values into PostgreSQL.
Multi-Exchange Support
Crawls listed companies across 10 major African exchanges including NGX, EGX, JSE, and BRVM.
Exponential Backoff Math
Intelligent retry logic preventing IP bans when encountering HTTP 429 rate limit responses.
Dual-Table Relational Schema
Updates current values in company directories while persisting historical time-series data.
Unattended Production Uptime
Autonomous execution running 24/7 with zero manual developer intervention.
Data Processing & Storage Pipeline
Automated Cron
DigitalOcean cron triggers endpoint execution every 5 hours.
Async HTTP Crawler
httpx client with custom headers and exponential backoff retry math.
DOM Parsing Engine
BeautifulSoup extracts prices, market caps, P/E ratios, and deltas.
PostgreSQL Upsert
Atomic upserts to Supabase updating live quotes and history tables.
Execution Workflow
Autonomous Cron Trigger
Every 5 hours, an automated DigitalOcean scheduler initiates the execution cycle, calling the core pipeline endpoint with zero human intervention required.
Database Exchange Query
Queries Supabase for active public companies, joining lookup tables for stock tickers and exchange slugs across 10 supported regional markets.
Resilient Data Retrieval
Fetches live stock pages using HTTP clients equipped with custom browser header emulation to prevent anti-bot blocking.
Intelligent HTML Extraction
Parses dynamic HTML structures to extract stock prices, trading volumes, daily price deltas, P/E ratios, market capitalization, and dividend metrics.
Rate Limiting & Fallbacks
Employs exponential backoff retry algorithms when encountering rate limits. Network timeouts automatically fail back to alternative HTTP providers.
Dual-Table Database Upsert
Atomic upserts update real-time stock quotes in the primary directory while logging historical time-series pricing data for analysis.
Telemetry & Health Logging
Logs execution metrics, response latency, processed tickers, and error rates to monitor pipeline health across continuous runs.
Live Execution Logs & Infrastructure

Real-time container console output logging exchange scraping iterations, HTTP status codes, entity upserts, and completion benchmarks.
Infrastructure & Library Suite
Python 3.13 + FastAPI
High-performance backend service handling API routing, task processing, and data parsing routines.
httpx + BeautifulSoup4
Async HTTP request client paired with robust HTML DOM parsing for multi-exchange data extraction.
Supabase / PostgreSQL
Dual-table relational schema designed for real-time state lookups and historical time-series storage.
Exponential Backoff Math
Rate-limiting protection algorithm dynamically scaling request delays to ensure 99.9% scrape success.
Docker Containerization
Isolated containerized environment deployed seamlessly on DigitalOcean App Platform.
Automated Cron Scheduling
Runs autonomously on 5-hour cycles without requiring manual intervention or developer oversight.
Unattended Reliability & Data Scale
Operational Business Value
The automated pipeline eliminated hundreds of hours of manual financial data entry per month, giving corporate analysts fresh, reliable African stock quotes and historical metrics directly inside their workspace.
Need custom web scraping or data pipeline automation?
Let's discuss how resilient backend microservices can automate data ingestion for your platform.