Skip to content

Instantly share code, notes, and snippets.

@devrim
Created May 22, 2026 02:32
Show Gist options
  • Select an option

  • Save devrim/22dadd325e451caa5d9538a83050a69e to your computer and use it in GitHub Desktop.

Select an option

Save devrim/22dadd325e451caa5d9538a83050a69e to your computer and use it in GitHub Desktop.
Autonomous Trading System: 22 Subagents + Daily Signals + Auto-Execution

Autonomous Trading System: Full Implementation Plan

Vision

Automated daily signal detection + Telegram approval + Auto-execution on Alpaca

πŸ“Š 22 Subagents Research
        ↓
πŸ” Consolidate Signals (Score 1-10)
        ↓
🎯 Filter High Conviction (8+ stars)
        ↓
πŸ“± Telegram: "BUY THESE TODAY"
        ↓
πŸ‘ User approves with emoji
        ↓
πŸ’³ Auto-execute on Alpaca
        ↓
βœ… Confirmation + P&L tracking

Phase 1: The 22 Subagents (Parallel Research)

Each agent researches a different signal type and reports daily:

Insider Buying Signals (Agents 1-10)

  1. Semiconductor Supply Chain Insider Tracker

    • Monitors: SNDK, WDC, MU, STX, AMKR, LRCX, TER, etc.
    • Reports: CEO/CFO buys, dollar amounts, percentage of insider base
    • Score: 10 if CEO >$1M, 8 if 3+ insiders, 5 if single insider
  2. Edge AI Insider Tracker

    • Monitors: ARM, NXPI, QCOM, LITE, CIEN
    • Reports: Executive buys in mobile/automotive AI
    • Score: 10 if CEO buys, 8 if engineering head buys
  3. Power/Cooling Infrastructure

    • Monitors: PWR, VRT, COHR, VIAV
    • Reports: Data center infrastructure insider activity
    • Score: Based on volume and seniority
  4. Biotech AI

    • Monitors: CRSP, BEAM, EXAI
    • Reports: CEO/scientist buys (high conviction)
    • Score: 10 if biotech founder/scientist buying
  5. Quantum Computing

    • Monitors: IONQ, QCAO, RGTI
    • Reports: Tech executive insider activity
    • Score: 9 if physicist/quantum expert buying
  6. Robotics/Autonomous

    • Monitors: NNDM, SSYS, AUG, UPWK
    • Reports: Executive and venture capital participation
    • Score: Based on sector momentum
  7. Battery/Energy Storage

    • Monitors: SLDP, ALTM, ALB, VRSKF
    • Reports: Insider accumulation during downturns
    • Score: 8+ if board member buys
  8. Optical/5G Networking

    • Monitors: JDSU, AKAM, NET, VEEX
    • Reports: Telecom executive interest
    • Score: Based on infrastructure build-out signals
  9. Space/Satellite

    • Monitors: RKLB, SATL, ASX, VSAT
    • Reports: Commercial space insider activity
    • Score: 10 if founder/CEO buying
  10. Congressional/Political Trading

    • Monitors: All sectors for bipartisan consensus
    • Reports: 5+ congressional buys same ticker
    • Score: 8 if bipartisan, 7 if partisan consensus

Sector Momentum Signals (Agents 11-16)

  1. Sector Momentum Analyzer

    • YTD returns by sector
    • Identifies early movers (0-50% YTD)
    • Score: 6-8 if early in boom cycle
  2. Earnings Surprise Detection

    • Beat/miss patterns by sector
    • Reports: Sectors with consecutive beats
    • Score: 8+ if 3+ consecutive earnings beats
  3. Insider Trading Volume Spikes

    • Monitors sudden increase in insider activity
    • Reports: Tickers with volume >3x normal
    • Score: 8 if volume spike + price increase
  4. Technical Breakout Signals

    • 52-week high breaks, volume breakouts
    • Reports: Sectors breaking out
    • Score: 6-7 (technical less reliable than fundamentals)
  5. Peer Company Analysis

    • If SNDK booms, NAND makers should follow
    • Reports: Lagging peers in hot sectors
    • Score: 7-8 if peers already moved
  6. Supply Chain Bottleneck Detection

    • Monitor chip shortage news, port congestion, etc.
    • Reports: Companies that supply to hot sectors
    • Score: 7-9 based on scarcity

Alternative Signals (Agents 17-22)

  1. Analyst Upgrade Tracking

    • Track analyst rating changes
    • Reports: Sectors getting upgraded
    • Score: 6-7 (upgrades lag insiders)
  2. Options Flow Analysis

    • Unusual call options activity
    • Reports: Big money positioning in tickers
    • Score: 7-8 if unusual volume detected
  3. Patent/Innovation Signals

    • New patent filings in hot sectors
    • Reports: Companies filing AI/quantum patents
    • Score: 6-7 (leading indicator)
  4. M&A Rumors/Activity

    • Acquisition targets in emerging sectors
    • Reports: Consolidation in hot spaces
    • Score: 8-9 if credible acquisition whispers
  5. Venture Capital Activity

    • Track VC funding in private companies
    • Reports: Companies preparing for IPO in hot sectors
    • Score: 7-8 if Series D+ funding detected
  6. Regulatory/Government Support

    • Track subsidies, government contracts
    • Reports: CHIPS Act, AI funding, green energy grants
    • Score: 8-9 if government backing detected

Phase 2: Daily Consolidation Pipeline

How it works:

Morning (6 AM ET)

1. Spawn 22 subagents in parallel
2. Each agent researches their signal type
3. Each returns: {ticker, signal_type, score (1-10), conviction_reason}
4. Consolidate results

Scoring Logic

# For each ticker, calculate final score:
final_score = (
    insider_score * 0.40 +           # Insider buying is 40% weight
    sector_momentum_score * 0.25 +    # Momentum is 25%
    alternative_signals_score * 0.20 + # Options, patents, etc. 20%
    technical_score * 0.15            # Technical breakouts 15%
)

# If final_score >= 8.0 β†’ Add to "BUY TODAY" list

Output: Daily Signal Report

🎯 ROBIN DAILY SIGNALS (May 22, 2026)

πŸ”₯ HIGH CONVICTION (8+/10):
  1. ARM    | Score: 8.7 | Signal: CEO bought $2M (insider) + analyst upgrade
  2. AMKR   | Score: 8.4 | Signal: 3 insiders buying + semiconductor momentum
  3. NXPI   | Score: 8.2 | Signal: Insider CFO buy + Q2 earnings beat

πŸ“Š MEDIUM CONVICTION (6-8):
  4. QCOM   | Score: 7.8 | Signal: Technical breakout + sector momentum
  5. PWR    | Score: 7.3 | Signal: Data center infrastructure build-out

❌ NO SIGNALS TODAY
  Other 2,000 tickers: <6.0 score

Phase 3: Telegram Integration

Daily Alert (6:30 AM)

Bot sends:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 🎯 BUY THESE TODAY              β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ARM    Score: 8.7 ⭐⭐⭐⭐⭐    β”‚
β”‚ AMKR   Score: 8.4 ⭐⭐⭐⭐⭐    β”‚
β”‚ NXPI   Score: 8.2 ⭐⭐⭐⭐⭐    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ [πŸ‘ BUY] [πŸ“Š DETAILS] [❌ SKIP] β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

User Approval Flow

User: πŸ‘

Bot responds:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ βœ… EXECUTING (Alpaca Paper)    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ARM    - 10 shares @ $42.15     β”‚
β”‚ AMKR   - 5 shares @ $67.80      β”‚
β”‚ NXPI   - 8 shares @ $89.45      β”‚
β”‚                                  β”‚
β”‚ Total invest: $1,247.45         β”‚
β”‚ % of portfolio: 2.5%            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ βœ… Orders placed                β”‚
β”‚ πŸ“Š /status to see positions     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Alternative Commands

πŸ‘           β†’ AUTO-EXECUTE all 3 tickers
πŸ“Š DETAILS   β†’ Show individual signals for each ticker
❌ SKIP      β†’ Don't buy today, check again tomorrow
πŸ”„ ADJUST    β†’ Buy only ARM (select subset)
πŸ€” EXPLAIN   β†’ Why these 3 today? (detailed reasoning)

Phase 4: Auto-Execution

When User Approves (πŸ‘)

1. Get current market prices (Alpaca API)
2. Calculate position size: 2-3% of account per ticker
3. Create market orders for each
4. Execute all orders simultaneously
5. Wait for fills (typically <1 second)
6. Send confirmation with actual fills
7. Update database with trade info
8. Add to portfolio tracking

Execution Logic

def execute_daily_signals(selected_tickers, account_value=$100000):
    """
    Auto-execute approved daily signals
    """
    for ticker in selected_tickers:
        # Get current price
        price = alpaca.get_quote(ticker)
        
        # Calculate position size: 2.5% per position
        position_size = account_value * 0.025
        shares = int(position_size / price)
        
        # Place market order
        order = alpaca.submit_order(
            symbol=ticker,
            qty=shares,
            side='buy',
            type='market',
            time_in_force='day'
        )
        
        # Log and confirm
        db.log_trade(ticker, shares, price, 'MARKET_BUY')
        telegram.send_confirmation(ticker, shares, price)

Phase 5: Monitoring & Adjustments

Daily Tracking

Bot sends every evening:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ“ˆ TODAY'S EXECUTION SUMMARY    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 3 trades executed               β”‚
β”‚ Total invested: $1,247.45       β”‚
β”‚                                  β”‚
β”‚ ARM    +2.3% (unrealized gain)  β”‚
β”‚ AMKR   -0.8% (small loss)       β”‚
β”‚ NXPI   +1.1% (slight gain)      β”‚
β”‚                                  β”‚
β”‚ Account: $101,247.45 (+1.2%)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Weekly Report

Every Sunday:
- Signals executed this week: 15
- Win rate: 73% (11 up, 4 down)
- Avg gain: +4.2%
- Biggest winner: SNDK +12.3%
- Biggest loser: LITE -3.1%
- Portfolio: +2.8% this week

Implementation Checklist

Infrastructure

  • Create signal detection framework
  • Build 22 subagent research scripts
  • Wire signal consolidation pipeline
  • Create daily scoring algorithm
  • Add Telegram daily alert flow
  • Implement auto-execution logic
  • Build portfolio tracking DB
  • Create reporting dashboard

Testing

  • Backtest on last 30 days of data
  • Verify scoring algorithm
  • Test Telegram approval flow
  • Dry-run auto-execution (paper trading)
  • Monitor for 1 week in paper
  • Validate signal accuracy

Deployment

  • Deploy to production (paper trading)
  • Run for 30 days, measure win rate
  • Adjust scoring weights if needed
  • If >60% win rate β†’ Ready for live
  • Migrate to live trading (small positions)

Expected Results

Signal Quality

  • Signals per day: 2-5 (on average)
  • High conviction signals (8+): 1-2 per day
  • False positives: ~30% (normal for early signals)

Returns

  • Win rate: 60-75% (vs 50% coin flip)
  • Avg gain per trade: +3-5%
  • Avg loss per trade: -2-3%
  • Monthly: +8-12% (if 15-20 trades)

Efficiency

  • Setup time: 1-2 hours per day (research + consolidation)
  • User time: 2-5 minutes (read alert + click approve)
  • Auto-execution: <1 second

Code Structure

robin/
β”œβ”€β”€ signals/
β”‚   β”œβ”€β”€ insiders.py           # Agents 1-10
β”‚   β”œβ”€β”€ momentum.py           # Agents 11-16
β”‚   β”œβ”€β”€ alternatives.py       # Agents 17-22
β”‚   └── consolidator.py       # Merge & score
β”‚
β”œβ”€β”€ scoring.py                # Final score logic
β”œβ”€β”€ daily_pipeline.py         # Run all agents + consolidate
β”œβ”€β”€ executor.py               # Auto-execution on Alpaca
β”œβ”€β”€ bot.py                    # Telegram alert + approval
└── db.py                     # Track all signals + trades

Timeline

Phase Timeline Status
Phase 1 2-3 days Build 22 agents
Phase 2 1 day Pipeline consolidation
Phase 3 1 day Telegram integration
Phase 4 1 day Auto-execution wiring
Phase 5 1 day Testing + monitoring
Total 1 week Ready

The Ask

To build this, I need to:

  1. Create 22 research agents - Each one deep-dives into a signal type daily
  2. Build signal consolidation - Merge all findings, score, filter top picks
  3. Wire Telegram approval flow - "BUY THESE TODAY" + user approval
  4. Implement auto-execution - No user intervention after approval
  5. Track everything - Win rate, returns, signal accuracy

Ready to go? This is a significant build but will automate 90% of your decision-making.

Want me to start with Phase 1 (building the 22 agents)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment