Ad Spend Anomaly & Seasonal Circuit Breaker
Protect client ad accounts from runaway budgets, checkout crashes, and accidental overspending with an automated circuit breaker.
Problem it addresses
Create a Python spend anomaly detection script (circuit_breaker.py) that monitors campaign spend records against hourly velocity thresholds, conversion drop-off anomalies, and CPA ceilings. Features: 1) Configurable JSON rules for spend limits, 2) Mock simulation test suite replicating flash-sale pacing spikes, 3) Out-of-the-box Telegram and Discord alert webhook dispatchers, 4) Complete operational runbook.
Who it is for
PRO operating in high-growth e-commerce, digital publishing, and direct-response marketing across Saudi Arabia, UAE, and Egypt.
What is inside
Key files listed in the README repository architecture:
config/alert_rules.sample.jsonexamples/simulated_spend_log.jsonLICENSEplaybooks/emergency-runbook.mdREADME.mdsrc/circuit_breaker.pytests/test_circuit_breaker.py
How to evaluate and use it
- Read the README first and confirm that the documented problem matches your use case.
- Inspect the listed files to find the data, tools, templates, and tests relevant to your task.
- Follow the repository’s Quick Start and check prerequisites before running commands.
- Compare outputs with documented examples and review limitations before using them in a decision or client workflow.
Quick Start from the README: python -m unittest discover -s tests · python src/circuit_breaker.py --help
Scope and limitations
- Multi-Platform API Latency: Real-time spend anomaly detection must account for 15-to-45 minute reporting delays on Meta and TikTok APIs.
- Seasonal Spend Spikes: Circuit breakers during White Friday or Ramadan require dynamic thresholds to avoid pausing profitable hyper-scaling campaigns.
- Safe Auto-Pause Execution: Automated script errors default to notifying on-call media buyers via webhook rather than silently killing high-ROI ads.
This page summarizes the available documentation; it does not establish performance or business results. Verify data and prerequisites before use.