The plan #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Insider Copytrade System -- Implementation Plan
Description
A personal system that monitors SEC EDGAR Form 4 filings in real-time, filters for high-quality insider buying signals, alerts via Slack, and optionally executes trades automatically through Alpaca's paper or live trading API.
The system is fully self-hosted, uses only free/public data sources, and requires no third-party data subscriptions.
Background
Company insiders (executives, directors, >10% shareholders) must file SEC Form 4 within 2 business days of any trade. This is public data via SEC EDGAR. The signal value of insider buying is academically documented -- executives buying their own stock with personal capital is a meaningful vote of confidence, particularly when:
The edge vs. political trade copying: 2-day disclosure lag vs. 45 days, and the signal is company-specific rather than sector-level.
Key risk: This signal is publicly known and tracked. The edge is in filtering quality and execution speed, not data exclusivity. Large-cap Form 4 signals are arbitraged quickly. Focus on small/mid-cap, clustered, unplanned buys.
System Outline
Actionables
Phase 1 -- Data Ingestion
Goal: Reliably pull and parse Form 4 filings as they appear.
Tasks:
SEC also provides a structured latest filings feed:
For each new filing, fetch and parse the XML document. Key fields to extract:
issuerTradingSymbol(ticker)rptOwnerName,officerTitle(insider name + role)transactionDatetransactionAcquiredDisposedCode(A = buy, D = sell)transactionShares,transactionPricePerSharetransactionTotalValue(compute if not present)footnotes(check for "10b5-1" mention)sharesOwnedFollowingTransactionStore raw filing XML + parsed fields. Track
accessionNumberas dedup key.SQLite schema:
Phase 2 -- Filter Engine
Goal: Reduce noise to actionable signals only.
Filters to apply (in order):
flag == 'A'total_value >= 50000(configurable)Scoring formula (simple v1):
Expose all thresholds in
config.pyfor easy tuning during backtesting.Phase 3 -- SQLite Storage
SQLite is sufficient for this workload (low write volume, single process). Use WAL mode for concurrent reads during backtesting:
Keep raw filing XML in a
/data/filings/directory keyed by accession number. Parse on ingest, re-parse never needed.Phase 4 -- Slack Alerts
Goal: Get notified immediately when a signal fires, with enough context to decide manually.
alerted = 1in DB after sending to avoid duplicates on re-pollPhase 5 -- Backtesting
Goal: Validate filter parameters on historical data before going live.
Data:
https://www.sec.gov/dera/data/form-4-datayfinance(free, sufficient for backtesting)Backtest logic:
Use
vectorbtfor performance:Output metrics:
Critical: Test on post-2022 data specifically. Pre-2022 results are likely inflated -- the signal became widely tracked after Autopilot/media coverage.
Parameter grid to test:
Phase 6 -- Alpaca Integration
Goal: Optionally auto-execute signals. Start with paper trading.
Paper trading base URL:
https://paper-api.alpaca.marketsLive trading base URL:
https://api.alpaca.marketsSwap via config flag -- never hardcode.
Position sizing: start at 2% per signal, max 10% in any single ticker. Add a max open positions limit (e.g. 20) to cap exposure.
Exit logic (v1): time-based only (close after N days). Add trailing stop later.
Build Order
Do not proceed to Step 7 without meaningful paper trading history.
Dependencies
All free. No paid APIs required.
Config Template
@claude get to work. Create md in repo of this plan. And build the poc.
Claude finished @dodox's task —— View job
Done
claude/issue-1-insider-copytrade-pocPR opened: dodox/Cleopatra#2
20 files committed on branch
claude/issue-1-insider-copytrade-poc. Quick start:| Branch