# Getting Started

This guide will help you install and set up Crypto Trader for the first time.

## Installation

### From AppImage (Recommended for Bluefin Linux)

1. Download the latest AppImage release from the releases page
2. Make it executable:
   ```bash
   chmod +x crypto_trader-*.AppImage
   ```
3. Run the application:
   ```bash
   ./crypto_trader-*.AppImage
   ```

### From Source

1. Clone the repository:
   ```bash
   git clone <repository-url>
   cd crypto_trader
   ```

2. Create a virtual environment:
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows: venv\Scripts\activate
   ```

3. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

4. Install backend dependencies:
   ```bash
   pip install -r requirements.txt
   pip install -r backend/requirements.txt
   ```

5. Install frontend dependencies:
   ```bash
   cd frontend
   npm install
   ```

6. Run the application:
   
   **Backend** (in one terminal):
   ```bash
   python -m uvicorn backend.main:app --reload --port 8000
   ```
   
   **Frontend** (in another terminal):
   ```bash
   cd frontend
   npm run dev
   ```
   
   Access the application at: http://localhost:3000
   API documentation at: http://localhost:8000/docs

## First Launch

When you first launch Crypto Trader:

1. **Configuration Setup**: The application will create configuration directories:
   - `~/.config/crypto_trader/` - Configuration files
   - `~/.local/share/crypto_trader/` - Data and database
   - `~/.local/share/crypto_trader/logs/` - Application logs


 2. **Database Initialization**: 
    - Ensure PostgreSQL is running and credentials are configured in `config.yaml` or via environment variables.
    - Tables will be created automatically on first run.

3. **Paper Trading**: By default, the application starts in paper trading mode with $100 virtual capital.

4. **UI Overview**: The web interface contains six main pages accessible via the navigation menu:
   - **Dashboard**: Overview with AutoPilot controls, system health, and real-time market data
   - **Strategies**: Create, edit, delete, and manage trading strategies with full parameter configuration
   - **Trading**: Manual order placement, order management, and position closing
   - **Portfolio**: View portfolio performance, holdings, allocation charts, and risk metrics
   - **Backtesting**: Configure and run backtests on historical data with progress tracking
   - **Settings**: Manage exchanges, risk settings, alerts, alert history, and application configuration

## Adding Your First Exchange

1. Click on the **Settings** tab
2. In the **Exchanges** section, click **Add Exchange**
3. Enter your exchange name (e.g., "Coinbase")
4. Enter your API key and secret
5. Choose **Read-Only Mode** for safety (recommended for first-time setup)
6. Click **Save**
7. Test the connection using the **Test Connection** button

## Placing Your First Trade

1. Go to the **Trading** tab
2. Select an exchange and symbol from the dropdowns
3. Choose order type (Market, Limit, or Stop)
4. Select Buy or Sell
5. Enter quantity
6. For limit orders, enter your desired price
7. Click **Place Order**

The order will execute in paper trading mode by default. You can view your positions in the **Open Positions** table and order history in the **Order History** section.

## Using Autopilot

The Autopilot feature provides autonomous trading signal generation with two modes:

1. **Pattern-Based Autopilot**: Uses technical pattern recognition and sentiment analysis
   - Transparent and explainable
   - Works immediately without training data
   - Best for users who want to understand every decision

2. **ML-Based Autopilot**: Uses machine learning to select optimal strategies
   - Adaptive and learns from performance
   - Requires training data
   - Best for users who want data-driven optimization

**Quick Start**:
1. Go to the **Dashboard** page
2. In the **Autopilot Configuration** section, select your preferred mode
3. Choose a symbol (e.g., BTC/USD)
4. Optionally enable **Auto-Execute** (start with paper trading first!)
5. Click **Start AutoPilot**

See the [Trading Guide](trading.md#autopilot-modes) for detailed information about both modes and when to use each.

## Next Steps

1. [Configure your exchanges](configuration.md#exchanges)
2. [Set up your first strategy](strategies.md#creating-a-strategy)
3. [Try paper trading](trading.md#paper-trading)
4. [Try autopilot](trading.md#autopilot-modes)
5. [Run a backtest](backtesting.md#running-a-backtest)

## System Requirements

- **Python**: 3.11 or higher
- **Operating System**: Linux (Bluefin Linux recommended), macOS, Windows
- **Memory**: 2GB RAM minimum, 4GB recommended
- **Storage**: 500MB for application, additional space for historical data
- **Network**: Internet connection for real-time data and trading
- **Database**: PostgreSQL 12 or higher (required)

## Getting Help

- Check the [FAQ](faq.md) for common questions
- Review the [Troubleshooting](troubleshooting.md) guide
- Consult the [API Documentation](../api/index.html) for advanced usage

