← back to Handbag Auth Nextjs

auction-viewer/QUICK_START_ANALYTICS.md

190 lines

# Quick Start - LUXVAULT Analytics

## Instant Access

**Dashboard:** http://45.61.58.125:7500
**Analytics Demo:** http://45.61.58.125:7500/analytics-demo.html
**API Base:** http://45.61.58.125:7500/api/insights

---

## Top 5 Most Useful Endpoints

### 1. Get Best Deals
```bash
curl "http://45.61.58.125:7500/api/insights/deal-scores?limit=10"
```
Returns top 10 auction deals ranked by proprietary algorithm.

### 2. Get Market Overview
```bash
curl "http://45.61.58.125:7500/api/insights/market"
```
Complete market snapshot: averages, distributions, top brands.

### 3. Get Recommendations (with budget)
```bash
curl "http://45.61.58.125:7500/api/insights/recommendations?budget=5000"
```
Personalized deals under your budget.

### 4. Predict Auction Price
```bash
curl "http://45.61.58.125:7500/api/insights/predict/[AUCTION_ID]"
```
Forecast where an auction will close.

### 5. Compare Brands
```bash
curl "http://45.61.58.125:7500/api/insights/compare-brands"
```
Which brands offer best value?

---

## Quick Examples

### Find Exceptional Deals (Score 80+)
```bash
curl -s "http://45.61.58.125:7500/api/insights/deal-scores?limit=50" | \
  jq '.data[] | select(.deal_score >= 80)'
```

### Get Today's Ending Auctions
```bash
curl -s "http://45.61.58.125:7500/api/insights/velocity" | \
  jq '.data[] | select(.ending_today > 0)'
```

### Check if Price is Good
```bash
AUCTION_ID="LA-104A9D16A3F1"
curl -s "http://45.61.58.125:7500/api/insights/predict/$AUCTION_ID" | \
  jq '{current: .data.current_price, predicted: .data.predicted_final_price, confidence: .data.confidence}'
```

### Top 3 Value Brands
```bash
curl -s "http://45.61.58.125:7500/api/insights/compare-brands" | \
  jq '.data | sort_by(.avg_savings_pct) | reverse | .[0:3] | .[] | {brand, avg_savings_pct, avg_price}'
```

### Brand Price History
```bash
curl -s "http://45.61.58.125:7500/api/insights/brand/Hermes%20Birkin" | \
  jq '.price_history'
```

---

## JavaScript Integration

```javascript
// Get top deals
async function getTopDeals() {
  const response = await fetch('/api/insights/deal-scores?limit=10');
  const data = await response.json();
  return data.data;
}

// Check if auction is good deal
async function checkDeal(auctionId) {
  const prediction = await fetch(`/api/insights/predict/${auctionId}`);
  const pred = await prediction.json();

  const auction = await fetch('/api/auctions').then(r => r.json());
  const current = auction.data.find(a => a.auction_id === auctionId);

  const discount = ((pred.data.predicted_final_price - current.current_price)
                   / pred.data.predicted_final_price) * 100;

  return {
    recommendation: discount > 20 ? "Strong Buy" : discount > 10 ? "Good Deal" : "Fair Price",
    predicted: pred.data.predicted_final_price,
    current: current.current_price,
    discount: discount.toFixed(1) + "%"
  };
}
```

---

## Testing

Run automated tests:
```bash
cd /root/Projects/handbag-auth-nextjs/auction-viewer
./test-analytics.sh
```

---

## Documentation

- **Full Documentation:** ANALYTICS_DOCUMENTATION.md
- **Quick Reference:** ANALYTICS_QUICKREF.md
- **Summary:** ANALYTICS_SUMMARY.md

---

## Server Management

```bash
# Check status
pm2 status auction-viewer

# View logs
pm2 logs auction-viewer --lines 50

# Restart
pm2 restart auction-viewer

# Check health
curl http://45.61.58.125:7500/health
```

---

## Support

All endpoints return:
```json
{
  "success": true,
  "data": {...},
  "generated_at": "ISO timestamp"
}
```

Error format:
```json
{
  "success": false,
  "error": "Error message"
}
```

---

## Rate Limits

- 100 requests per 15 minutes per IP
- Cached responses don't count
- No API key required

---

## Deal Score Interpretation

- **80-100**: Exceptional deal (act now!)
- **60-79**: Great value (strong buy)
- **40-59**: Good opportunity (consider)
- **20-39**: Fair deal (average)
- **0-19**: Premium price (wait)

---

**Built with:** Python 3.10, Node.js, SQLite, Express.js
**Status:** Production Ready
**Version:** 1.0.0