A real-time market tracking dashboard that displays the top 50 Polymarket markets by 7-day volume, integrates TradingView charts for price visualization, and provides a live news feed for selected markets.
- Framework: FastAPI
- Language: Python 3.12+
- Package Manager:
uv(strict requirement) - Database: SQLite (for caching market data, user selections, news articles)
- APIs:
- Polymarket API (market data, volume, prices)
- News API (for real-time news aggregation)
- TradingView Widget (embedded charts)
- Framework: React 18+ with Vite
- Language: TypeScript
- Styling: Tailwind CSS with glassmorphism effects
- State Management: React Query (for API data) + Zustand (for UI state)
- Charts: TradingView Advanced Charts Widget
- Caching Layer: SQLite database with TTL-based invalidation
- Update Frequency:
- Market data: Every 5 minutes
- News feed: Real-time via polling (30s intervals)
- Top 50 ranking: Every 15 minutes
polymarket-news-tracker/
├── .python-version # Python 3.12+
├── pyproject.toml # uv configuration
├── uv.lock # Dependency lock file
├── .env.example # Template for environment variables
├── .gitignore # Exclude polymarket.db, .env, etc.
├── src/
│ ├── backend/
│ │ ├── __init__.py
│ │ ├── main.py # FastAPI app entry point
│ │ ├── models.py # SQLAlchemy models (Market, News, etc.)
│ │ ├── database.py # SQLite connection and session management
│ │ ├── polymarket/
│ │ │ ├── __init__.py
│ │ │ ├── client.py # Polymarket API client
│ │ │ └── schemas.py # Pydantic models for API responses
│ │ ├── news/
│ │ │ ├── __init__.py
│ │ │ ├── aggregator.py # News fetching and filtering logic
│ │ │ └── schemas.py # News article Pydantic models
│ │ ├── routes/
│ │ │ ├── __init__.py
│ │ │ ├── markets.py # GET /markets/top50, GET /markets/{id}
│ │ │ └── news.py # GET /news/{market_id}
│ │ └── tasks/
│ │ ├── __init__.py
│ │ └── update_markets.py # Background task for market updates
│ └── frontend/
│ ├── package.json
│ ├── vite.config.ts
│ ├── tsconfig.json
│ ├── src/
│ │ ├── App.tsx
│ │ ├── main.tsx
│ │ ├── components/
│ │ │ ├── MarketList.tsx # Top 50 markets selector
│ │ │ ├── TradingViewChart.tsx # TradingView widget wrapper
│ │ │ ├── NewsFeed.tsx # Real-time news display
│ │ │ └── TimeframeSelector.tsx # Chart timeframe controls
│ │ ├── hooks/
│ │ │ ├── useMarkets.ts # React Query hook for markets
│ │ │ └── useNews.ts # React Query hook for news
│ │ ├── stores/
│ │ │ └── marketStore.ts # Zustand store for selected market
│ │ └── styles/
│ │ └── globals.css # Tailwind + custom styles
│ └── index.html
└── README.mdFocus: FastAPI backend, Polymarket integration, database management
Tasks:
- Set up FastAPI application with CORS for React frontend
- Implement Polymarket API client:
- Fetch top 50 active markets by 7-day volume
- Filter for
active=truestatus only - Extract market metadata (title, slug, volume, current Yes %)
- Design SQLite schema:
marketstable: id, slug, title, volume_7d, yes_percentage, last_updated, is_activenews_articlestable: id, market_id, title, url, source, published_at, sentiment_score (optional)
- Create REST endpoints:
GET /api/markets/top50→ Returns top 50 markets sorted by volumeGET /api/markets/{market_id}→ Returns detailed market dataGET /api/news/{market_id}?limit=20→ Returns news articles for selected market
- Implement background tasks (using
FastAPI BackgroundTasksorapscheduler):- Update market rankings every 15 minutes
- Fetch and cache news articles every 30 seconds for active markets
- Add
.envconfiguration:
POLYMARKET_API_KEY=your_key_here
NEWS_API_KEY=your_key_here
DATABASE_URL=sqlite:///./polymarket.db
CORS_ORIGINS=http://localhost:5173
Deliverables:
- Fully functional FastAPI backend with documented endpoints
- SQLite database with proper migrations (using Alembic if needed)
- Populated
.env.example
Focus: React + TypeScript UI, TradingView integration, real-time updates
Tasks:
- Set up Vite + React + TypeScript project
- Install dependencies:
npm install react-query zustand axios tailwindcss @headlessui/react lucide-react- Implement components:
- MarketList:
- Display top 50 markets in a scrollable, searchable list
- Show market title, 7-day volume, current Yes %
- Highlight selected market with glassmorphism effect
- TradingViewChart:
- Embed TradingView widget showing Yes % over time
- Allow timeframe selection (1H, 4H, 1D, 1W, 1M)
- Use
market_slugto fetch correct data
- NewsFeed:
- Display news articles in a card-based layout
- Auto-refresh every 30 seconds using React Query
- Show article title, source, timestamp, and link
- TimeframeSelector:
- Toggle buttons for chart timeframes
- Update TradingView widget on selection
- MarketList:
- State management:
- Use Zustand for
selectedMarketandselectedTimeframe - Use React Query for API data fetching with 5-minute cache
- Use Zustand for
- Styling:
- Dark theme with vibrant accent colors (e.g., electric blue, neon green)
- Glassmorphism cards with backdrop blur
- Smooth transitions on hover/selection
- Responsive design (mobile-first)
Deliverables:
- Polished React application with premium aesthetics
- Functional TradingView integration
- Real-time news feed with auto-refresh
Focus: News fetching, filtering, and relevance scoring
Tasks:
- Implement news aggregation logic:
- Use NewsAPI, Google News RSS, or similar service
- Filter articles by market-related keywords (extracted from market title)
- Example: For "Will Trump win 2024?", search for "Trump 2024 election"
- Add sentiment analysis (optional but recommended):
- Use lightweight NLP library (e.g.,
textbloborvaderSentiment) - Score articles as positive/negative/neutral for market context
- Use lightweight NLP library (e.g.,
- Deduplication:
- Avoid storing duplicate articles from multiple sources
- Use URL or title hash for uniqueness checks
- Database optimization:
- Index
market_idandpublished_atcolumns - Implement TTL (time-to-live) for old articles (e.g., delete after 7 days)
- Index
- Error handling:
- Gracefully handle API rate limits
- Log failed requests for debugging
Deliverables:
- Robust news aggregation pipeline
- SQLite database with indexed news articles
- Documented news filtering logic
Focus: Build system, deployment, testing
Tasks:
- Create
uv-based Python environment:
uv venv
uv sync- Add startup scripts:
scripts/start_backend.sh:
#!/bin/bash
uv run uvicorn src.backend.main:app --reload --port 8000scripts/start_frontend.sh:
#!/bin/bash
cd src/frontend && npm run dev- Set up
.gitignore:
.env
polymarket.db
__pycache__/
node_modules/
dist/
.venv/
- Write comprehensive
README.md:- Project description
- Setup instructions (using
uv) - API endpoint documentation
- Environment variable requirements
- Add health checks:
GET /api/health→ Returns backend statusGET /api/markets/status→ Returns last update timestamp
Deliverables:
- Production-ready build system
- Documented setup process
- Health check endpoints
- Backend: Top 50 markets endpoint with SQLite caching
- Frontend: Market list with selection
- TradingView chart integration (basic)
- News API integration
- Real-time news feed with auto-refresh
- Market-to-news keyword matching
- Premium UI with glassmorphism
- Sentiment analysis for news articles
- Performance optimization (lazy loading, pagination)
- Docker containerization
- ALWAYS use
uvfor Python dependency management - NEVER commit
.envorpolymarket.dbto version control - Ensure
.env.exampleis populated with all required variables - Filter ONLY active markets from Polymarket API
- Implement proper error handling for all API calls
- Use TypeScript strict mode in frontend
- Add loading states for all async operations
- Verify TradingView widget renders correctly before shipping
- Top 50 markets load in <2 seconds
- TradingView chart updates on market/timeframe change
- News feed auto-refreshes every 30 seconds
- UI is visually stunning with smooth animations
- All API endpoints return proper error codes
- Project builds without errors using
uv syncandnpm install