# Dashboard Live Data Cron Setup

This project updates all F&O symbols in batches to avoid Angel One rate-limit.

## Recommended `.env`

```env
DATA_MODE=angel
DASHBOARD_SYMBOL_LIMIT=1000
DASHBOARD_UPDATE_BATCH=5
DASHBOARD_API_CACHE_SECONDS=5
CRON_SECRET=change_this_long_secret
```

## Option 1: cPanel Cron using PHP CLI

Command every 1 minute:

```bash
/usr/bin/php /home/YOUR_USER/public_html/D2/php-greeks-app/update_dashboard.php 5
```

If your PHP path is different, check cPanel > Terminal:

```bash
which php
```

## Option 2: cPanel Cron using URL

Command every 1 minute:

```bash
wget -q -O - "https://your-domain.com/D2/php-greeks-app/public/update_dashboard_web.php?secret=change_this_long_secret&batch=5" >/dev/null 2>&1
```

or:

```bash
curl -s "https://your-domain.com/D2/php-greeks-app/public/update_dashboard_web.php?secret=change_this_long_secret&batch=5" >/dev/null 2>&1
```

## WAMP/local manual test

```bash
cd C:\wamp\www\D2\php-greeks-app
php update_dashboard.php 5
```

Browser test for web updater:

```text
http://localhost/D2/php-greeks-app/public/update_dashboard_web.php?batch=5
```

If `CRON_SECRET` is set:

```text
http://localhost/D2/php-greeks-app/public/update_dashboard_web.php?secret=YOUR_SECRET&batch=5
```

## How it works

- Each run updates only N symbols (`DASHBOARD_UPDATE_BATCH`).
- Results are saved in:

```text
php-greeks-app/cache/dashboard_live/rows.json
```

- Dashboard reads cached rows, so page load is fast.
- Increase batch only if Angel rate-limit does not occur.
