{"id":50738206,"url":"https://github.com/lweiss01/pmwatch","last_synced_at":"2026-06-10T15:32:12.067Z","repository":{"id":362837607,"uuid":"1258491615","full_name":"lweiss01/pmwatch","owner":"lweiss01","description":"Open-source anomaly detector for politically-sensitive Kalshi prediction markets. Flags unusual trading patterns that may precede public announcements. Public API only, no auth required.","archived":false,"fork":false,"pushed_at":"2026-06-06T05:40:57.000Z","size":384,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-06T07:13:30.324Z","etag":null,"topics":["anomaly-detection","fastapi","fintech","insider-trading","kalshi","open-source","prediction-markets","python","sqlite","transparency"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lweiss01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T16:20:50.000Z","updated_at":"2026-06-06T05:41:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lweiss01/pmwatch","commit_stats":null,"previous_names":["lweiss01/pmwatch"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/lweiss01/pmwatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lweiss01%2Fpmwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lweiss01%2Fpmwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lweiss01%2Fpmwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lweiss01%2Fpmwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lweiss01","download_url":"https://codeload.github.com/lweiss01/pmwatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lweiss01%2Fpmwatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34159250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anomaly-detection","fastapi","fintech","insider-trading","kalshi","open-source","prediction-markets","python","sqlite","transparency"],"created_at":"2026-06-10T15:32:09.970Z","updated_at":"2026-06-10T15:32:12.050Z","avatar_url":"https://github.com/lweiss01.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📡 pmwatch: The Insider Trading Forensics Terminal for Kalshi Prediction Markets\n\n`pmwatch` is a high-signal, local-first quantitative forensics terminal built specifically to track, map, and expose political and macroeconomic insider trading across Kalshi prediction markets.\n\nWhen policy shifts, regulatory rulings, or economic metrics are drafted behind closed doors, the individuals with access to material non-public information leave an undeniable footprint in alternative asset liquidity pools before press releases ever drop. While traditional retail chart scanners look retroactively at price actions, `pmwatch` actively monitors the dark space where asymmetric capital front-runs public policy announcements.\n\n![pmwatch dashboards](https://raw.githubusercontent.com/lweiss01/pmwatch/main/screenshot.png)\n\n---\n\n## 🔥 Key Visual Telemetry \u0026 Signal Drilldowns\n\nThe real-time terminal UI drops you into an institutional-grade security operations center:\n\n* **The Insider Leakage Timeline:** Maps real-time volume anomalies directly against authoritative primary federal data streams, isolating the exact minute insider capital pre-positioned itself ahead of public media drops.\n* **Whale Flow Exposure Matrix:** Strips away retail noise by running percentile-based clustering to isolate the net positioning shifts of the top 1% of traders.\n* **Microstructure Alert Monitor:** A live forensic ticker logging real-time institutional spoofing walls, rapid order cancellations, and wash-trading configurations designed to manipulate order books.\n\n---\n\n## ⚡ Core Architecture: Built for the Alpha\n\nThe framework trades standard equity assumptions for raw predictive forensics, running entirely under local-first engineering principles.\n\n### 1. Order Book Manipulation Forensics\nPrediction market contracts trade within unique fixed bounds ($0.00 to $1.00), meaning traditional equity technical analysis tools fail completely. `pmwatch` tracks depth-of-book ($L2$) fluctuations via a stateful, thread-safe memory queue:\n* **Pre-Cancellation Spoofing Heuristics:** Detects massive liquidity walls designed to panic retail traders, monitoring for patterns where 80%+ of a deep wall is abruptly cancelled within 120 seconds alongside sharp opposite-side execution.\n* **Wash Trading Cross-Detection:** Intercepts live trade streams to pair identical execution sizes on opposite sides of the market within a tight 60-second window to flag artificial volume inflation.\n\n### 2. First-Party Information Leakage Mapping\nStop scraping slow, editorialized mainstream media aggregators. `pmwatch` builds a mathematically verifiable information edge by wiring directly into raw government data infrastructure to flag suspected insider moves:\n* **The $2\\sigma$ Threat Alert:** Tracks rolling contract volume baselines to fire high-priority triggers the second trading volume spikes $\\ge 2$ standard deviations above the statistical norm.\n* **Authoritative Ingestion Pipes:** Streams live data directly from the Federal Register API (notices, agency drafts, and proposed rules), GPO GovInfo search endpoints (statutes and committee prints), Congress.gov floor activity, and TreasuryDirect auction timelines.\n* **1.5x Source Weighting:** Automatically applies a higher confidence metric to raw, unedited government announcements over secondary news aggregation to isolate the true lead time of a leak.\n\n### 3. Dynamic Whale Flow Profiling\nBecause low-liquidity alternative markets are highly sensitive to hidden capital blocks, `pmwatch` dynamically isolates the top 1% of market participants to map insider accumulation:\n* **Contract-Specific Percentiles:** Avoids the trap of hardcoded dollar values. The system calculates the 99th-percentile trade size dynamically per ticker, evaluating a thin legislative contract with the same precision as a massive election line.\n* **Hourly Accumulation Rollups:** Tracks clean YES vs. NO directional whale flows to reveal continuous institutional positioning walls.\n\n---\n\n## 🛠️ Performance \u0026 Complete Rate-Limit Safety\n\nDesigned to operate seamlessly on local hardware, `pmwatch` enforces absolute data privacy and robust protection against API exhaustion:\n* **Streaming WebSocket Architecture:** Streams raw public book metrics straight into localized in-memory buffers (`collections.deque(maxlen=200)` per ticker).\n* **Zero-REST Polling Footprint:** The 15-second analysis loop runs 100% inside local memory state. It performs precisely one REST warmup call on a cold contract startup, completely eliminating `429 Too Many Requests` limits on volatile trading days.\n* **Proactive Eviction:** Garbage collection routines drop historical order book snapshots older than 120 seconds on every tick to maintain a featherweight, static RAM profile.\n\n---\n\n## 🚀 Installation \u0026 Quickstart (100% Public Data, No API Keys Needed)\n\n`pmwatch` operates entirely on publicly available data endpoints. You do not need a Kalshi trading account, profile verification, API keys, or authentication credentials to run this terminal.\n\n### Step 1: Download the Application\n\n**Option A: Clone with Git (Recommended)**\nOpen a PowerShell window, navigate to your projects directory, and run:\n```powershell\ngit clone [https://github.com/lweiss01/pmwatch.git](https://github.com/lweiss01/pmwatch.git)\ncd pmwatch\n```\n\n**Option B: Download ZIP File**\nGo to the repository on GitHub (`https://github.com/lweiss01/pmwatch`), click the green **Code** button, select **Download ZIP**, and extract it to a folder of your choice.\n\n### Step 2: Set Up Environment \u0026 Dependencies\nOpen PowerShell in your project folder. If this is your first time using virtual environments in PowerShell, execute this command to allow running scripts for the current terminal session:\n```powershell\nSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process\n```\n\nNow, create your virtual environment, activate it, install requirements, and initialize the database tables:\n```powershell\npython -m venv .venv\n.venv\\Scripts\\Activate.ps1\npip install -r requirements.txt\npython db.py\n```\n*(This maps the localized SQLite structure under `data/pmwatch.db` for your tracking logs).*\n\n### Step 3: Run the Application (Dual-Window Setup)\n\nTo run both the background analyzer and the web dashboard, launch two separate processes in side-by-side PowerShell windows.\n\n**🧵 Window 1: The Background Scheduler Daemon**\nOpen a new PowerShell window in your `pmwatch` folder and run:\n```powershell\n.venv\\Scripts\\Activate.ps1\npython scheduler.py\n```\n*The daemon will spin up. Microstructure checks run every 15 seconds, news ingestion loops every 15 minutes, and whale updates roll up hourly.*\n\n**🖥️ Window 2: The FastAPI Web Server \u0026 Dashboard**\nOpen another separate PowerShell window in your `pmwatch` folder and run:\n```powershell\n.venv\\Scripts\\Activate.ps1\npython -m uvicorn api:app --port 8080\n```\n\n### Step 4: Open the Terminal Dashboard for Insights Galore\nOnce both windows are running, open your web browser and navigate to:\n```text\nhttp://localhost:8080\n```\n**Insights Galore:** The moment the first collector processing cycle finishes analyzing its batched metrics, the terminal comes completely alive. The UI instantly populates your active $2\\sigma$ anomaly feeds, draws interactive SVG whale flow tracking charts, and maps out hidden pre-positioning windows.\n\n*To force immediate execution without waiting for the scheduler intervals, click the glowing **\"Manual Run\"** button in the top-right header.*\n\n---\n\n## 💻 Tech Stack\n\n* **Core Engine:** Python 3.11+, FastAPI, NumPy, Pandas, Asyncio.\n* **Data Storage:** Lightweight, hyper-optimized local SQLite schema managed via `db.py` tracking transaction anomalies and automated data pruning.\n* **Front End:** Dark-mode dashboard (`dashboard.html`) utilizing lightweight SVG visualization layers to chart net whale exposure without external tracking scripts.\n\n---\n\n## 🧪 Verification \u0026 Test Framework\n\nBuilt with rigorous Test-Driven Development (TDD) principles to guarantee absolute numerical stability across extreme market turbulence.\n\nVerify the local engine parameters and ensure the setup matches specifications:\n```bash\npython -m unittest discover tests\n```\n\n---\n\n## 📖 The Founding Thesis: Holding Positions of Trust Accountable\n\nPrediction markets are uniquely vulnerable to asymmetric information corruption. Because the legal custodians of public policy data (including legislative aides, economic agency staff, regulatory draft writers, and politicians) possess non-public insights into upcoming announcements, that information inevitably leaves a footprint in the order book when bad actors look to profit from positions of trust.\n\n### The Catalyst: The George Santos Precedent\n`pmwatch` was built as a direct response to flagrant exploitation of alternative asset pools by public figures, a reality most notably highlighted by the federal insider trading investigations into former Congressman George Santos. By publicly pumping up the sentiment surrounding an event contract and then using non-public intent to dump tens of thousands of dollars into an opposing asymmetric whale position, bad actors have proven that prediction markets are a playground for manipulation if left unmonitored. \n\n### Real-World Micro-Case Study: The 9-Hour Edge\nDuring an alpha run, the `pmwatch` engine flagged an extreme structural anomaly. In the dead of night at 12:41 AM, the volume $Z$-score for a high-profile federal nomination contract spiked to a staggering 21.44 $\\sigma$ over baseline. This move was driven by a highly concentrated asymmetric whale position shorting the consensus choice by over 13,000 contracts. \n\nExactly 9 hours and 13 minutes later, mainstream political media dropped the breaking news bulletin confirming the sudden shift. The wider market scrambled and re-priced instantly, but `pmwatch` had already mapped the information leakage window nearly half a day prior. This sequence proves that political insider trading leaves a clear structural signature before public disclosure.\n\n`pmwatch` turns the chaos of order book stream data into definitive, institutional-grade intelligence, putting the raw mechanics of information transparency completely in your hands.\n---\n\n## Disclaimer\n\npmwatch is a public transparency tool. It detects market-level anomalies using only\npublicly available data. It does not identify individual traders, make accusations,\nor constitute legal or financial advice. High anomaly scores indicate unusual market\nactivity that may warrant further investigation -- nothing more.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flweiss01%2Fpmwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flweiss01%2Fpmwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flweiss01%2Fpmwatch/lists"}