Metadata-Version: 2.4
Name: diamond-quant
Version: 0.1.1
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
pip install diamond-quant
```

## Quick Start

### 1. Set Your API Key

```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:
- Validate your API key and resolve your tier
- Start the backend API server on port 8000
- Start the frontend web interface on port 3000
- Open your browser to `http://localhost:3000`

All simulation data is stored locally on your machine (`~/.diamond-quant/data.db`).

### 3. Use the Application

- Navigate to `http://localhost:3000`
- Start running simulations, pulling lineups, and analyzing games!

## 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})
- `--env-file PATH` - Path to .env file

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]
```

Set or update your API key. 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)

## Configuration

### Environment Variables (Optional)

Place a `.env` file in your working directory or `~/.diamond-quant/.env`:

- `ODDS_API_KEY` - Your The Odds API key (for live odds)
- `DEEPSEEK_API_KEY` - DeepSeek API key (for AI chat features)
- `GROQ_API_KEY` - Groq API key (alternative AI provider)

### API Key Storage

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

### Local Data

All your simulation results, predictions, and game data are stored locally in `~/.diamond-quant/data.db` (SQLite).

## API Key Tiers

Your API key determines your access level:

| Tier | Sims/Game | Chat/Month | MODELS Tab |
|------|-----------|------------|------------|
| **MASTER** | Unlimited | Unlimited | ✅ |
| **DIAMOND** | 2,000,000 | Unlimited | — |
| **GOLD** | 500,000 | 1,000 | — |
| **SILVER** | 100,000 | 500 | — |
| **BRONZE** | 50,000 | 250 | — |
| **BASE** | 10,000 | 100 | — |

## Troubleshooting

### "Frontend not built" Error

The frontend will automatically build on first run. Make sure Node.js 18+ 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
- Check your internet connection (tier validation requires a one-time check)
- The tool will cache your tier locally for offline use

### Port Already in Use

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

## Support

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