Metadata-Version: 2.4
Name: diamond-quant
Version: 0.1.0
Summary: Diamond Quant - MLB MCMC Prediction Tool
Author: Diamond Quant
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.104.0
Requires-Dist: uvicorn>=0.24.0
Requires-Dist: requests>=2.31.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: click>=8.1.0
Requires-Dist: bcrypt>=4.0.0
Requires-Dist: cryptography>=41.0.0
Requires-Dist: psycopg2-binary>=2.9.0
Dynamic: author
Dynamic: requires-python

# Diamond Quant

MLB MCMC Prediction Tool - Professional baseball game simulation and prediction platform.

## Installation

```bash
pip3 install diamond-quant
```

## Quick Start

### 1. Set Your API Key

First, you'll need an API key from your administrator. Once you have it:

```bash
diamond-quant auth
```

Enter your API key when prompted. It will be securely stored in `~/.diamond-quant/config.json`.

### 2. Start the Application

```bash
diamond-quant start
```

This will:
- Start the backend API server on port 8000
- Start the frontend web interface on port 3000
- Open your browser to `http://localhost:3000`

### 3. Use the Application

- Enter your API key on the authentication screen (if not already set)
- Start using Diamond Quant!

## Command Line Options

### Start Command

```bash
diamond-quant start [OPTIONS]
```

Options:
- `--frontend-port PORT` - Port for frontend (default: 3000)
- `--backend-port PORT` - Port for backend API (default: 8000)
- `--skip-auth` - Skip API key authentication check
- `--api-url URL` - Backend API URL (defaults to http://localhost:{backend-port})

Examples:
```bash
# Use custom ports
diamond-quant start --frontend-port 3001 --backend-port 8001

# Skip authentication (for local development)
diamond-quant start --skip-auth
```

### Auth Command

```bash
diamond-quant auth [OPTIONS]
```

Options:
- `--api-url URL` - Backend API URL for validation (default: http://localhost:8000)

### Status Command

```bash
diamond-quant status
```

Check your current API key configuration and validation status.

## Requirements

- Python 3.9+
- Node.js 18+ and npm (for frontend)
- PostgreSQL database (configured via DATABASE_URL environment variable)

## Configuration

### Environment Variables

The backend API uses environment variables for configuration. Create a `.env` file or set:

- `DATABASE_URL` - PostgreSQL connection string
- `REQUIRE_API_KEY` - Set to `true` to require API keys (default: `false` for local dev)

### API Key Storage

API keys are stored in `~/.diamond-quant/config.json` with secure permissions (600).

## Troubleshooting

### "Frontend not built" Error

If you see this error, the frontend will automatically build on first run. Make sure Node.js and npm are installed.

### "Cannot connect to API server"

Make sure the backend started successfully. Check the console output for errors.

### "API key validation failed"

- Verify your API key is correct
- Make sure the backend is running
- Check that `REQUIRE_API_KEY` is set correctly

### Port Already in Use

If ports 3000 or 8000 are already in use, specify different ports:

```bash
diamond-quant start --frontend-port 3001 --backend-port 8001
```

## API Key Tiers

Your API key determines your access level:

- **ENDBOSS** - Full access + MODELS tab (unlimited)
- **DIAMOND** - 2M sims/game, unlimited chat
- **GOLD** - 500k sims/game, 1000 chat/month
- **SILVER** - 100k sims/game, 500 chat/month
- **BRONZE** - 50k sims/game, 250 chat/month
- **BASE** - 10k sims/game, 100 chat/month

## Support

For issues or questions, contact your administrator or refer to the full documentation.
