MCPcopy Index your code
hub / github.com/JakeNesler/Claude_Prophet

github.com/JakeNesler/Claude_Prophet @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
309 symbols 597 edges 24 files 232 documented · 75%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Prophet Trader

THIS IS NOW DEPRECATED, please refer to https://github.com/JakeNesler/OpenProphet?tab=readme-ov-file

OpenProphet is a fully agentic harness running OpenCode. It makes it easier to access remotely via web ui and hearbeat system similar to openclaw.

This repo still works fine for an mcp, but all updates to the prophet mcp will now be inside of OpenProphet.

AI-powered autonomous options trading system with MCP integration

⚠️ WARNING: This is an experimental AI-powered trading system. Trading options involves significant risk of loss. I strongly recommend using this for paper trading only. Do not use real money. The author provides no warranties and assumes no responsibility for financial losses.


Overview

Prophet Trader is an aggressive discretionary options trading system that combines: - Multi-timeframe options - LEAPS (60-90+ DTE) + Scalping (0-5 DTE) + Active hedging - Trades both directions - Calls on rallies, puts on selloffs, not married to one side - Pattern Day Trader status - Unlimited day trades with $25K+ equity - MCP server integration - Full Claude Code control via Model Context Protocol - AI agents - CEO, Strategy, Consultant, Engineer for analysis and pressure-testing - Vector similarity search - AI memory of past trades for pattern recognition - Real-time logging - All decisions and activity tracked for review


Architecture

Prophet Trader
├── cmd/bot/main.go              # Entry point (Go backend)
├── controllers/                  # HTTP handlers (48 functions)
│   ├── activity_controller.go   # Activity logging endpoints
│   ├── intelligence_controller.go # News & analysis endpoints
│   ├── news_controller.go       # News aggregation
│   ├── order_controller.go      # Trading operations
│   └── position_management.go   # Managed positions
├── services/                     # Business logic (63 functions)
│   ├── activity_logger.go       # Trade journaling
│   ├── alpaca_data.go           # Market data service
│   ├── alpaca_options_data.go   # Options chain data
│   ├── alpaca_trading.go        # Order execution
│   ├── gemini_service.go        # AI news cleaning
│   ├── news_service.go          # News aggregation
│   ├── position_manager.go      # Stop-loss/take-profit automation
│   ├── stock_analysis.go        # Technical analysis
│   └── technical_analysis.go    # RSI, MACD, momentum
├── database/                     # SQLite storage (15 functions)
│   └── storage.go               # Bars, orders, positions, embeddings
├── models/                       # Data entities (7 types)
│   └── models.go                # DB models
├── interfaces/                   # Type definitions (80 types)
│   ├── trading.go               # Order, Position, Account
│   └── options.go               # OptionContract, OptionChain
├── config/                       # Configuration
│   └── config.go                # Environment loading
├── mcp-server.js                 # MCP server (Claude Code integration)
├── .claude/agents/               # AI agent definitions
├── activity_logs/                # Daily trading journals
├── decisive_actions/             # Trade decision logs
└── data/prophet_trader.db        # SQLite database

System Stats

Metric Value
Language Go (net/http)
Packages 8
Functions 152
Types 80
Lines of Code 3,623
Avg Complexity 3.3

How It Works

1. MCP Server Layer (mcp-server.js)

The MCP (Model Context Protocol) server acts as a bridge between Claude Code and the Go trading backend:

Claude Code <---> MCP Server (Node.js) <---> Go Backend <---> Alpaca API
  • Exposes 40+ trading tools to Claude Code
  • Handles request/response formatting
  • Manages authentication and rate limiting
  • Runs on port 4534 by default

2. Go Backend (cmd/bot/main.go)

The trading bot backend handles: - Order Execution - PlaceOrder, CancelOrder via Alpaca API - Market Data - Real-time quotes, historical bars, options chains - Position Management - Automated stop-loss/take-profit monitoring - News Aggregation - Google News + MarketWatch feeds - AI Integration - Gemini for news cleaning/summarization - Activity Logging - Trade journals and decision logs

3. Services Architecture

Service Purpose Key Functions
AlpacaTradingService Order execution PlaceOrder, CancelOrder, GetPositions
AlpacaDataService Market data GetHistoricalBars, GetLatestQuote
AlpacaOptionsDataService Options data GetOptionChain, GetOptionSnapshot
PositionManager Automation MonitorPositions, CloseManagedPosition
StockAnalysisService Analysis AnalyzeStock, GetTechnicalAnalysis
NewsService Intelligence GetCleanedNews, AggregateNews
GeminiService AI processing CleanNewsForTrading
ActivityLogger Journaling LogDecision, LogActivity

4. Data Flow

1. User Request (Claude Code)
   ↓
2. MCP Tool Call (e.g., place_options_order)
   ↓
3. HTTP Request to Go Backend
   ↓
4. Controller (OrderController.PlaceOptionsOrder)
   ↓
5. Service (AlpacaTradingService.PlaceOrder)
   ↓
6. Alpaca API (live/paper trading)
   ↓
7. Response back through chain
   ↓
8. Result displayed in Claude Code

Quick Start

1. Environment Setup

Create .env file:

ALPACA_PUBLIC_KEY=your_public_key
ALPACA_SECRET_KEY=your_secret_key
ALPACA_ENDPOINT= # Start with paper trading
GEMINI_API_KEY=your_gemini_key  # For AI news cleaning

2. Build & Run Go Backend

# Build the bot
go build -o prophet_bot ./cmd/bot

# Run the bot
./prophet_bot

3. Start MCP Server

The MCP server runs automatically when Claude Code starts via .mcp.json configuration.

4. Start Trading

Open Claude Code and use MCP tools:

get_account           # Check portfolio status
get_options_positions # Review open positions
get_quick_market_intelligence  # Get market news
analyze_stocks        # Technical analysis
place_options_order   # Execute trades

MCP Tools Reference

Trading Operations

Tool Description
place_options_order Buy/sell options contracts
place_managed_position Position with auto stop-loss/take-profit
close_managed_position Close managed position at market
cancel_order Cancel pending order
place_buy_order Buy stock (not used - options only)
place_sell_order Sell stock (not used - options only)

Market Data

Tool Description
get_account Portfolio value, cash, buying power
get_options_positions All open options positions
get_options_position Single option position details
get_options_chain Available contracts for underlying
get_orders Order history
get_quote Real-time stock quote
get_latest_bar Latest OHLCV bar
get_historical_bars Historical price data
get_managed_positions All managed positions with status

Intelligence

Tool Description
get_quick_market_intelligence AI-cleaned MarketWatch news (fast)
analyze_stocks Technical analysis + news + recommendations
search_news Google News search by keyword
get_cleaned_news Aggregated news from multiple sources
get_marketwatch_topstories MarketWatch top stories
get_marketwatch_realtime Real-time headlines
get_marketwatch_bulletins Breaking news
get_marketwatch_marketpulse Quick market updates

Vector Search (AI Memory)

Tool Description
find_similar_setups Find past trades similar to current setup
store_trade_setup Store completed trade for future reference
get_trade_stats Win rate, profit factor by filters

Logging

Tool Description
log_decision Log trading decision with reasoning
log_activity Log activity to daily journal
get_activity_log Get today's activity log

Utilities

Tool Description
wait Pause execution (max 300 seconds)
get_datetime Current time in US Eastern timezone

AI News Intelligence (Gemini)

The system uses Google Gemini to transform raw news feeds into actionable trading intelligence.

What It Does

  • Cleans noisy RSS feeds into structured summaries
  • Extracts key themes and sentiment by sector
  • Identifies trading-relevant catalysts (earnings, FDA decisions, macro events)
  • Reduces token usage by 80-90% compared to raw news

Tools That Use It

Tool Description
get_quick_market_intelligence Fast 15-article MarketWatch summary
get_cleaned_news Multi-source aggregated intelligence
analyze_stocks Includes news context per ticker
aggregate_and_summarize_news Custom topic/symbol aggregation

Example Output

Raw news: 50+ noisy articles with ads, duplicates, irrelevant content

Cleaned output:

{
  "summary": "Tech rallying on NVDA earnings beat...",
  "key_themes": ["AI infrastructure spending", "Fed pause expectations"],
  "sentiment_by_sector": {"technology": "bullish", "energy": "neutral"},
  "actionable_tickers": ["NVDA", "AMD", "SMCI"]
}

Configuration

Set GEMINI_API_KEY in your .env file:

GEMINI_API_KEY=your_gemini_api_key

Optional: If no key is set, intelligence tools return raw news instead of AI-cleaned summaries.


Trading Strategy

Core Approach: Multi-Timeframe Options Trading

The system trades both directions (calls AND puts) based on market conditions. Not married to bullish or bearish - if the market dumps, buy puts; if it bounces, flip to calls.

1. LEAPS Foundation (60-90+ DTE) - Hold longer-dated calls on high-conviction names (tech, broad market ETFs) - These ride broader trends and survive short-term volatility - Provides baseline exposure while scalps generate active returns

2. Intraday Scalping (0-5 DTE) - Trade both directions based on momentum - Quick entries, quick exits, tight stops - Capture overnight gaps and intraday swings

3. Active Hedging - Hold protective puts against bullish exposure - When market sells off, hedges cushion losses - Provides flexibility to wait for bounce opportunities

4. Disciplined Exits - Take profits aggressively on winners (+25-50%) - Cut losers fast (-15% or thesis break) - Never average down without regime confirmation

5. Capital Preservation Mode - Maintain 50-70% cash at all times - Scale down when volatility spikes or market gets choppy - Fed weeks / major events = smaller positions, more hedges

Risk Management

Rule Value
Max position size 15% of portfolio
Max total deployment 50% of portfolio
Stop loss -15% or thesis break
Daily loss limit -5% triggers halt
Cash reserve 50-70% at all times

AI Agents

Located in .claude/agents/:

CEO Agent (paragon-trading-ceo)

  • Portfolio-level risk assessment
  • Capital allocation decisions
  • Behavioral pattern recognition
  • Use before deploying >$20K

Strategy Agent (stratagem-options-scalper)

  • Technical analysis and setups
  • Entry/exit price recommendations
  • Risk/reward calculations
  • Use for finding trade setups

Consultant Agent (daedalus-intelligence-director)

  • Adversarial thinking
  • Blind spot identification
  • Pressure-testing trade thesis
  • Use when uncertain or emotional

Engineer Agent (forge-go-engineer)

  • Go code development
  • Trading infrastructure
  • Tool building
  • Use for system improvements

Vector Search (AI Memory)

The system includes semantic search for finding similar historical trades:

How It Works

  1. Trade decisions in decisive_actions/ are embedded using local AI model
  2. 384-dimensional vectors stored in SQLite (data/prophet_trader.db)
  3. AI queries past trades using natural language

Example Queries

// Find similar SPY scalp setups
find_similar_setups("SPY gap up scalp for quick profit")

// Find similar stop-loss decisions
find_similar_setups("cut loss fast to preserve capital")

// Find profit-taking patterns
find_similar_setups("take profit on winning position")

Benefits

  • AI learns from experience
  • Pattern recognition across different wording
  • Local model (no API costs)
  • Automatic updates via store_trade_setup

Seeding Your Own Knowledge

You can pre-populate the vector database with your own trading principles or example trades. Create a JSON file with entries like:

[
  {
    "symbol": "GENERAL",
    "action": "KNOWLEDGE",
    "strategy": "RISK_MANAGEMENT",
    "reasoning": "Risk 1-2% of capital per trade maximum. Position sizing is more important than entry price.",
    "market_context": "Survive to trade another day."
  },
  {
    "symbol": "NVDA",
    "action": "BUY",
    "strategy": "SWING",
    "result_pct": 42.3,
    "result_dollars": 3180,
    "reasoning": "Bought 30-45 DTE calls with delta 0.35 on pullback to VWAP after earnings beat.",
    "market_context": "Tech sector leading, VIX at 14, AI narrative strengthening."
  }
]

Then use the store_trade_setup MCP tool to load each entry, or create a simple script to batch import them.


File Structure

Logs & Decisions

activity_logs/
├── activity_2025-11-17.json
├── activity_2025-11-18.json
└── ...

decisive_actions/
├── 2025-12-19T16-50-25-067Z_SELL_SPY251219C00681000.json
├── 2025-12-19T16-44-32-129Z_BUY_SPY251219C00681000.json
└── ...

Database

``` data/prophet_trader.db ├── db_orders # Order history ├── db_bars # Price data cache ├── db_positions # Position snapshots ├── db_managed_positions # Managed position state ├── trade_embeddings #

Extension points exported contracts — how you extend this code

TradingService (Interface)
TradingService defines the interface for executing trades [1 implementers]
interfaces/trading.go
OptionDataService (Interface)
OptionDataService defines interface for options market data
interfaces/options.go
DataService (Interface)
DataService defines the interface for market data operations [1 implementers]
interfaces/trading.go
StorageService (Interface)
StorageService defines the interface for local data persistence [1 implementers]
interfaces/trading.go
StrategyExecutor (Interface)
StrategyExecutor defines the interface for strategy execution This will be useful for AI personas and quant strategies l
interfaces/trading.go

Core symbols most depended-on inside this repo

callTradingBot
called by 33
mcp-server.js
PlaceOrder
called by 9
interfaces/trading.go
saveLog
called by 8
services/activity_logger.go
CancelOrder
called by 8
interfaces/trading.go
min
called by 7
controllers/intelligence_controller.go
fetchRSSFeed
called by 7
services/news_service.go
Close
called by 6
database/storage.go
savePositionToDB
called by 6
services/position_manager.go

Shape

Method 177
Struct 76
Function 51
Interface 5

Languages

Go95%
TypeScript5%

Modules by API surface

interfaces/trading.go44 symbols
services/position_manager.go32 symbols
controllers/order_controller.go26 symbols
services/news_service.go20 symbols
services/activity_logger.go20 symbols
database/storage.go16 symbols
services/technical_analysis.go15 symbols
services/alpaca_trading.go15 symbols
services/stock_analysis_service.go14 symbols
models/models.go14 symbols
services/alpaca_options_data.go12 symbols
services/gemini_service.go11 symbols

For agents

$ claude mcp add Claude_Prophet \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact