Skip to main content

cli-usage

TRADING DECISION REPORT ═══════════════════════════════════════════════

Ticker: NVDA Date: 2024-05-10 Decision: BUY Confidence: 8.5/10

Key Factors: • Strong earnings growth trajectory • Positive AI market sentiment • Technical breakout confirmed • Manageable risk profile

Risk Warnings: • High volatility expected • Market cap concentration risk • Sector rotation possibility

Agent Consensus: 4/4 analysts positive Debate Outcome: Bullish case stronger Risk Level: Moderate

═══════════════════════════════════════════════


## CLI Commands and Shortcuts

### During Analysis
- **Ctrl+C**: Cancel current analysis
- **Enter**: Skip to next phase (where applicable)
- **Space**: Toggle detailed logging

### Result Navigation
- **↑/↓**: Scroll through detailed results
- **Tab**: Switch between result sections
- **Q**: Quit and return to main menu

## Configuration Files

The CLI can save and load configurations:

### Save Configuration
```bash
# Save current settings as default
python -m cli.main --save-config default.json

# Save with custom name
python -m cli.main --save-config my_analysis.json

Load Configuration

# Load saved configuration
python -m cli.main --load-config default.json

# Quick analysis with preset
python -m cli.main --preset quick_analysis

Batch Processing

For multiple analyses:

# Analyze multiple tickers
python -m cli.main --batch tickers.txt --date 2024-05-10

# Time series analysis
python -m cli.main --ticker NVDA --date-range 2024-05-01:2024-05-10

Output Options

Export Results

  • JSON: Machine-readable format
  • CSV: Spreadsheet-compatible
  • PDF: Human-readable report
  • TXT: Simple text summary
# Export to file
python -m cli.main --export results.json --format json

Logging Levels

Control CLI verbosity:

  • Minimal: Only final decisions
  • Standard: Key milestones and results
  • Detailed: Full agent communications
  • Debug: Complete trace information

Performance Optimization

For Faster Analysis

  • Use gpt-4o-mini models
  • Set research depth to "Quick"
  • Disable detailed logging
  • Use cached data mode

For Comprehensive Analysis

  • Use o1-preview for deep thinking
  • Set research depth to "Deep"
  • Enable online tools
  • Enable detailed logging

Troubleshooting CLI Issues

Common Problems

CLI Won't Start:

# Check Python version
python --version

# Verify installation
pip list | grep tradingagents

API Connection Errors:

# Verify environment variables
echo $OPENAI_API_KEY
echo $FINNHUB_API_KEY

Performance Issues:

  • Switch to smaller models
  • Reduce research depth
  • Check internet connection for online tools

Next Steps

After mastering the CLI:


CLI Usage

TradingAgents provides a user-friendly command-line interface (CLI) that allows you to interact with the framework without writing code. The CLI provides an interactive experience for stock analysis and trading decisions.

Starting the CLI

To launch the CLI interface:

python -m cli.main

This command will start an interactive session where you can configure your analysis parameters and view results in real-time.

CLI Interface Overview

The CLI provides a structured workflow:

  1. Initial Configuration Screen: Select tickers, date, models, and analysis depth
  2. Progress Tracking: Monitor agent progress as analysis runs
  3. Results Display: View comprehensive trading decisions and reasoning

Configuration Options

Stock Selection

  • Single Ticker: Analyze one specific stock (e.g., NVDA, AAPL)
  • Multiple Tickers: Compare multiple stocks simultaneously
  • Popular Choices: Quick selection from commonly analyzed stocks

Date Selection

  • Specific Date: Choose exact date for historical analysis
  • Date Range: Analyze trends over multiple days
  • Recent Data: Use most recent available trading day

Model Selection

Choose LLM models based on your needs:

For Production Analysis:

  • Deep Thinking: o1-preview for complex reasoning
  • Quick Thinking: gpt-4o for fast responses

For Testing (Cost-Effective):

  • Deep Thinking: gpt-4o-mini
  • Quick Thinking: gpt-4o-mini

Research Depth

Control the thoroughness of analysis:

  • Quick (1 round): Fast analysis with minimal debate
  • Standard (2-3 rounds): Balanced analysis with moderate debate
  • Deep (4-5 rounds): Comprehensive analysis with extensive debate

Interactive Features

Real-Time Progress

The CLI shows live updates as agents work:

  • Agent activation status
  • Current analysis phase
  • Data gathering progress
  • Debate round completion

Agent Activity Display

Monitor individual agent contributions:

  • Fundamentals Analyst: Company financial analysis
  • Sentiment Analyst: Market sentiment evaluation
  • News Analyst: Recent news impact assessment
  • Technical Analyst: Chart pattern and indicator analysis
  • Researchers: Bullish vs bearish debate process
  • Risk Management: Risk assessment and portfolio impact

Decision Output

View comprehensive results including:

  • Final Recommendation: BUY/SELL/HOLD decision
  • Confidence Score: Decision certainty level
  • Key Reasoning: Summary of analysis factors
  • Risk Assessment: Identified risks and mitigation
  • Agent Consensus: Level of agreement between agents

CLI Workflow Example

Here's a typical CLI session flow:

$ python -m cli.main

┌─────────────────────────────────────────────┐
│ TradingAgents CLI v1.0 │
│ Multi-Agent Trading Analysis │
└─────────────────────────────────────────────┘

Select Stock Ticker: NVDA
Analysis Date: 2024-05-10
Deep Think Model: gpt-4o-mini
Quick Think Model: gpt-4o-mini
Research Depth: Standard (3 rounds)
Online Tools: Yes

Starting Analysis...

[1/6] Initializing Agents... ✓
[2/6] Gathering Market Data... ✓
[3/6] Running Individual Analysis...
└─ Fundamentals Analyst: Analyzing financials... ✓
└─ Sentiment Analyst: Processing sentiment... ✓
└─ News Analyst: Reviewing recent news... ✓
└─ Technical Analyst: Computing indicators... ✓

[4/6] Researcher Debate (Round 1/3)...
└─ Bullish Researcher: Presenting bull case... ✓
└─ Bearish Researcher: Presenting bear case... ✓
└─ Debate Resolution: Finding consensus... ✓

[5/6] Risk Assessment...
└─ Risk Manager: Evaluating portfolio impact... ✓
└─ Portfolio Manager: Final review... ✓

[6/6] Generating Trading Decision... ✓

═══════════════════════════════════════════════