่ทณ่ฝฌ่‡ณ

๐Ÿ”ง Source Installation Guide

Difficulty: โญโญโญ Advanced
Time: 15 minutes


โœ… Prerequisites

  • Python 3.11+ (Get Python)
  • Git (Get Git)
  • pip (Python package manager)
  • API Keys (Twelve Data, Alpha Vantage)

๐Ÿš€ Quick Start

1. Clone Repository

git clone https://github.com/XuXuClassMate/trading-assistant.git
cd trading-assistant
# Create virtual environment
python3 -m venv venv

# Activate (Linux/macOS)
source venv/bin/activate

# Activate (Windows)
venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Install in Development Mode

pip install -e .

5. Verify Installation

ta --version
# Output: OpenClaw Trading Assistant CLI v1.3.0

โš™๏ธ Configuration

1. Copy Configuration Templates

cp .env.example .env
cp watchlist.txt.example watchlist.txt

2. Edit Configuration

# Edit .env with your API keys
nano .env

Required API Keys:

TWELVE_DATA_API_KEY=your_key_here
ALPHA_VANTAGE_API_KEY=your_key_here
LANGUAGE=en  # or 'zh' for Chinese


๐ŸŽฏ Usage

Interactive Mode

ta

Direct Commands

# Trading signals
ta sig

# Support/Resistance
ta sr

# Position calculator
ta pos --symbol NVDA --price 175 --capital 10000

# All analysis
ta all

๐Ÿงช Development

Run Tests

# Install test dependencies
pip install -r requirements-dev.txt

# Run tests
pytest

Run Linter

# Install linting tools
pip install flake8 black

# Check code style
flake8 .

# Format code
black .

Make Changes

  1. Create feature branch:

    git checkout -b feature/my-feature
    

  2. Make changes and test

  3. Commit changes:

    git add .
    git commit -m "feat: Add my feature"
    

  4. Push and create PR:

    git push origin feature/my-feature
    


๐Ÿ“ Project Structure

trading-assistant/
โ”œโ”€โ”€ cli.py                    # CLI entry point
โ”œโ”€โ”€ config.py                 # Configuration management
โ”œโ”€โ”€ i18n.py                   # Internationalization
โ”œโ”€โ”€ position_calculator.py    # Position sizing
โ”œโ”€โ”€ stop_loss_alerts.py       # Alert management
โ”œโ”€โ”€ technical_analysis.py     # Technical indicators
โ”œโ”€โ”€ pyproject.toml            # Project metadata
โ”œโ”€โ”€ requirements.txt          # Dependencies
โ”œโ”€โ”€ .env.example              # Environment template
โ”œโ”€โ”€ watchlist.txt.example     # Watchlist template
โ”œโ”€โ”€ docs/                     # Documentation
โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ”œโ”€โ”€ CLI.md
โ”‚   โ””โ”€โ”€ guides/
โ”‚       โ”œโ”€โ”€ docker-install.md
โ”‚       โ”œโ”€โ”€ pip-install.md
โ”‚       โ”œโ”€โ”€ npm-install.md
โ”‚       โ””โ”€โ”€ source-install.md
โ””โ”€โ”€ .github/workflows/        # CI/CD workflows
    โ”œโ”€โ”€ docker-publish.yml
    โ”œโ”€โ”€ pypi-publish.yml
    โ”œโ”€โ”€ publish-npm.yml
    โ””โ”€โ”€ publish-gh.yml

๐Ÿ”„ Update from Source

# Pull latest changes
git pull origin main

# Update dependencies
pip install -r requirements.txt --upgrade

# Reinstall in development mode
pip install -e .

# Verify version
ta --version

๐Ÿ—‘๏ธ Uninstall

# Uninstall package
pip uninstall openclaw-trading-assistant

# Remove virtual environment (if created)
rm -rf venv

# Remove cloned repository
cd ..
rm -rf trading-assistant

โ“ Troubleshooting

Dependency Conflicts

# Upgrade pip
pip install --upgrade pip

# Clear pip cache
pip cache purge

# Reinstall dependencies
pip install -r requirements.txt --force-reinstall

Import Errors

# Make sure you're in the project directory
cd trading-assistant

# Make sure virtual environment is activated
source venv/bin/activate  # Linux/macOS

# Reinstall in development mode
pip install -e .

Python Version Issues

# Check Python version
python3 --version

# If < 3.11, upgrade Python
# macOS: brew install python@3.11
# Ubuntu: sudo apt install python3.11
# Windows: Download from python.org

๐Ÿ“š Next Steps