Skip to content

📊 Add Analytics Dashboard with Real Market Data #38

@Mosas2000

Description

@Mosas2000

Description

Create an analytics page to display platform statistics, trending markets, and user insights. The recharts library is already installed but underutilized.

Current State

  • recharts is in package.json but not used
  • No analytics page exists
  • Scripts folder has analytics-report.ts but no frontend visualization

Proposed Features

1. Platform Overview

  • Total markets created
  • Total volume traded (STX)
  • Active users count
  • Total fees collected

2. Market Statistics

  • Most active markets
  • Largest pools
  • Resolution accuracy
  • Average market duration

3. Charts (using recharts)

  • Volume over time (line chart)
  • Market categories distribution (pie chart)
  • Daily active users (bar chart)
  • Yes/No distribution per market (stacked bar)

4. User Analytics (when connected)

  • Personal P&L
  • Win/loss ratio
  • Favorite categories
  • Position history

UI Mockup

┌─ Analytics Dashboard ────────────────────┐
│                                          │
│ ┌────────┐ ┌────────┐ ┌────────┐        │
│ │ 156    │ │ 45.2K  │ │ 1,247  │        │
│ │ Markets│ │ STX Vol│ │ Users  │        │
│ └────────┘ └────────┘ └────────┘        │
│                                          │
│ ┌─ Volume Over Time ─────────────────┐  │
│ │    📈 Line Chart                   │  │
│ └────────────────────────────────────┘  │
│                                          │
│ ┌─ Top Markets ──────────────────────┐  │
│ │ 1. BTC $100k - 245 STX pool        │  │
│ │ 2. ETH Flip BTC - 180 STX pool     │  │
│ └────────────────────────────────────┘  │
└──────────────────────────────────────────┘

Data Sources

  • On-chain data from market contracts
  • Hiro API for transaction history
  • Derived metrics from market data

Files to Create

  • frontend/src/pages/AnalyticsPage.tsx
  • frontend/src/hooks/useAnalytics.ts
  • frontend/src/components/charts/VolumeChart.tsx
  • frontend/src/components/charts/CategoryPieChart.tsx
  • frontend/src/components/StatsCard.tsx
  • Add route in App.tsx

Priority

🟢 Low - Nice to have for platform insights

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions