S
StockBud Docs

Configuration

Environment variables and configuration options for StockBud

Configuration

StockBud is configured through environment variables. All settings can be placed in a .env file in the project root.

Required Variables

These must be set for StockBud to function:

VariableDescriptionExample
ALPACA_API_KEYYour Alpaca API keyPKABC123...
ALPACA_SECRET_KEYYour Alpaca secret keyxyz789...

Alpaca Settings

VariableDescriptionDefault
ALPACA_BASE_URLAlpaca API endpointhttps://paper-api.alpaca.markets
ALPACA_DATA_URLAlpaca data endpointhttps://data.alpaca.markets

For live trading, change ALPACA_BASE_URL to https://api.alpaca.markets. Only do this when you're ready to trade with real money.

AI Provider Settings

Optional integrations for enhanced AI analysis:

VariableDescriptionRequired For
OPENAI_API_KEYOpenAI API keyAI analysis features
ANTHROPIC_API_KEYAnthropic API keyClaude-based analysis
PERPLEXITY_API_KEYPerplexity API keyResearch queries

Database Settings

VariableDescriptionDefault
SUPABASE_URLSupabase project URLOptional
SUPABASE_KEYSupabase anon keyOptional
FIREBASE_PROJECT_IDFirebase projectOptional

Server Settings

VariableDescriptionDefault
STOCKBUD_PORTServer port (for HTTP mode)8080
STOCKBUD_LOG_LEVELLogging verbosityINFO
STOCKBUD_DEMO_MODEEnable demo mode with mock data0

Example .env File

# === Required ===
ALPACA_API_KEY=your_alpaca_api_key
ALPACA_SECRET_KEY=your_alpaca_secret_key
 
# === Alpaca Config ===
# Paper trading (default)
ALPACA_BASE_URL=https://paper-api.alpaca.markets
 
# Live trading (uncomment when ready)
# ALPACA_BASE_URL=https://api.alpaca.markets
 
# === AI Providers (optional) ===
OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# PERPLEXITY_API_KEY=pplx-...
 
# === Database (optional) ===
# SUPABASE_URL=https://xxx.supabase.co
# SUPABASE_KEY=eyJ...
 
# === Server ===
STOCKBUD_LOG_LEVEL=INFO
# STOCKBUD_DEMO_MODE=1

Feature Flags

Enable or disable specific features:

VariableDescriptionDefault
STOCKBUD_ENABLE_TRADINGAllow trade executiontrue
STOCKBUD_ENABLE_ALERTSEnable price alertstrue
STOCKBUD_ENABLE_ANALYTICSTrack usage analyticsfalse

Per-Client Configuration

When running StockBud for multiple AI clients, you can override settings per-client in the MCP configuration:

{
  "mcpServers": {
    "stockbud-paper": {
      "command": "uv",
      "args": ["run", "python", "scripts/start/stockbud_main.py"],
      "env": {
        "ALPACA_BASE_URL": "https://paper-api.alpaca.markets"
      }
    },
    "stockbud-live": {
      "command": "uv",
      "args": ["run", "python", "scripts/start/stockbud_main.py"],
      "env": {
        "ALPACA_BASE_URL": "https://api.alpaca.markets"
      }
    }
  }
}

Validation

Check your configuration is valid:

uv run python scripts/validate/check_config.py

This will verify:

  • ✅ Required variables are set
  • ✅ Alpaca credentials work
  • ✅ Optional services are reachable

On this page