Skip to content

About

Prophit monitors Polymarket prediction markets for significant price movements (1%+ change in 24 hours) and provides a clean, functional interface for understanding market dynamics. The application fetches real-time data from Polymarket's API and stores it efficiently for analysis and visualization.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

16 Commits

Folders and files

Repository files navigation

Prophit - Polymarket Movement Tracker

A real-time web application that tracks significant movements in Polymarket prediction markets and connects them to news events. Built with Laravel backend and React frontend.

🎯 Overview

Prophit monitors Polymarket prediction markets for significant price movements (1%+ change in 24 hours) and provides a clean, functional interface for understanding market dynamics. The application fetches real-time data from Polymarket's API and stores it efficiently for analysis and visualization.

✨ Features

πŸ“Š Real-time Market Monitoring

  • Live market activity with real-time updates
  • Significant movement detection (configurable threshold)
  • Price history tracking with interactive charts
  • Volume and probability monitoring

πŸ” Search & Filtering

  • Keyword search across market questions and categories
  • Live market activity filtering
  • Movement history search
  • Category-based filtering

πŸ“ˆ Data Visualization

  • Interactive price charts with Chart.js
  • Movement overview charts
  • Grid and list view modes
  • Responsive design for all devices

🎨 User Interface

  • Modern, clean design with Tailwind CSS
  • Collapsible mobile navigation
  • Real-time sync status
  • Loading states and animations

πŸ—οΈ Architecture

Backend (Laravel 12.3.0)

  • Framework: Laravel 12.3.0
  • Database: SQLite (configurable for production)
  • API: RESTful endpoints for frontend consumption
  • Scheduling: Automated data sync every 5 minutes
  • Authentication: Laravel Sanctum (ready for implementation)

Frontend (React + Inertia.js)

  • Framework: React.js with Inertia.js
  • Styling: Tailwind CSS 3.x
  • Charts: Chart.js with react-chartjs-2
  • Build Tool: Vite 7.1.1
  • State Management: React hooks

External APIs

  • Polymarket CLOB API: clob.polymarket.com
  • Polymarket Gamma API: gamma-api.polymarket.com

πŸ“ Project Structure

ayanadevs_prophit/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ Console/Commands/
β”‚   β”‚   β”œβ”€β”€ SyncPolymarketData.php      # Data sync command
β”‚   β”‚   └── TestPolymarketApi.php       # API testing command
β”‚   β”œβ”€β”€ Http/Controllers/
β”‚   β”‚   β”œβ”€β”€ Api/MarketController.php    # API endpoints
β”‚   β”‚   └── DashboardController.php     # Web routes
β”‚   β”œβ”€β”€ Models/
β”‚   β”‚   β”œβ”€β”€ Market.php                  # Market model
β”‚   β”‚   β”œβ”€β”€ MarketMovement.php          # Movement model
β”‚   β”‚   └── MarketPriceHistory.php      # Price history model
β”‚   └── Services/
β”‚       └── PolymarketService.php       # API integration service
β”œβ”€β”€ database/migrations/
β”‚   β”œβ”€β”€ create_markets_table.php        # Markets schema
β”‚   β”œβ”€β”€ create_market_movements_table.php # Movements schema
β”‚   └── create_market_price_history_table.php # Price history schema
β”œβ”€β”€ resources/
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   β”œβ”€β”€ Components/
β”‚   β”‚   β”‚   β”œβ”€β”€ Layout.jsx              # Main layout
β”‚   β”‚   β”‚   β”œβ”€β”€ MovementCard.jsx        # Movement display
β”‚   β”‚   β”‚   β”œβ”€β”€ StatsGrid.jsx           # Statistics display
β”‚   β”‚   β”‚   β”œβ”€β”€ PriceChart.jsx          # Chart component
β”‚   β”‚   β”‚   β”œβ”€β”€ MovementsChart.jsx      # Overview chart
β”‚   β”‚   β”‚   β”œβ”€β”€ MarketChangesGrid.jsx   # Grid view
β”‚   β”‚   β”‚   β”œβ”€β”€ LiveMarketChanges.jsx   # Live activity
β”‚   β”‚   β”‚   └── MarketChangesSummary.jsx # Summary component
β”‚   β”‚   └── Pages/
β”‚   β”‚       β”œβ”€β”€ Dashboard.jsx           # Main dashboard
β”‚   β”‚       β”œβ”€β”€ MarketDetail.jsx        # Market details
β”‚   β”‚       └── HistoricMovements.jsx   # Historic data
β”‚   └── views/
β”‚       └── app.blade.php               # Main layout template
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ api.php                         # API routes
β”‚   β”œβ”€β”€ web.php                         # Web routes
β”‚   └── console.php                     # Scheduled tasks
└── config/
    └── services.php                    # API configuration

πŸš€ Installation

Prerequisites

  • Linux or MacOS (Windows needs too many things for setup which I can't bother with)
  • PHP 8.2+
  • Node.js 18+
  • Composer
  • npm or yarn

Setup Instructions

  1. Clone the repository

    git clone <repository-url>
    cd ayanadevs_prophit
  2. Install PHP dependencies

    composer install
  3. Install Node.js dependencies

    npm install
  4. Environment setup

    cp .env.example .env
    php artisan key:generate
  5. Configure Polymarket API credentials Add your Polymarket API credentials to .env:

    POLYMARKET_PRIVATE_KEY=your_private_key
    POLYMARKET_API_KEY=your_api_key
    POLYMARKET_SECRET=your_secret
    POLYMARKET_PASSPHRASE=your_passphrase
  6. Database setup

    php artisan migrate
  7. Build frontend assets

    npm run build
  8. Start the application

    php artisan serve
  9. Run the schedule worker

    php artisan schedule:work

πŸ”§ Configuration

Environment Variables

Variable Description Required
POLYMARKET_PRIVATE_KEY Polymarket private key Yes
POLYMARKET_API_KEY Polymarket API key Yes
POLYMARKET_SECRET Polymarket secret Yes
POLYMARKET_PASSPHRASE Polymarket passphrase Yes
APP_ENV Application environment No
APP_DEBUG Debug mode No

Movement Threshold

The default movement threshold is set to 1% (configurable). To change:

  1. Backend: Modify $threshold in DashboardController.php
  2. Frontend: Update threshold options in Dashboard.jsx

πŸ“Š Data Models

Market

  • polymarket_id: Unique Polymarket identifier
  • question: Market question text
  • current_probability: Current probability (0-1)
  • volume: Trading volume
  • category: Market category
  • end_date: Market end date
  • active: Market status
  • metadata: Additional market data

MarketMovement

  • market_id: Associated market
  • probability_before: Probability before movement
  • probability_after: Probability after movement
  • change_percentage: Percentage change
  • movement_started_at: Movement start time
  • movement_detected_at: Detection time
  • volume_during_movement: Volume during movement
  • additional_data: Additional movement data

MarketPriceHistory

  • market_id: Associated market
  • probability: Probability at time of recording
  • volume: Volume at time of recording
  • recorded_at: Recording timestamp

πŸ”Œ API Endpoints

Market Data

  • GET /api/movements - Get recent movements
  • GET /api/markets/{id} - Get market details
  • GET /api/markets/{id}/price-history - Get price history
  • GET /api/markets/search - Search markets
  • GET /api/stats - Get statistics

Sync Operations

  • POST /api/sync - Trigger manual sync

Web Routes

  • GET / - Main dashboard
  • GET /market/{id} - Market details
  • GET /historic - Historic movements

βš™οΈ Commands

Data Sync

# Manual sync
php artisan polymarket:sync

# Test API endpoints
php artisan polymarket:test

Scheduled Tasks

The application automatically syncs data every 5 minutes via Laravel's scheduler.

🎨 Frontend Components

Dashboard

  • Real-time movements with search and filtering
  • Multiple view modes (List, Grid, Chart)
  • Live market activity sidebar
  • Statistics overview

Movement Cards

  • Interactive charts with price history
  • Movement details with before/after probabilities
  • Quick navigation to market details

Charts

  • Price history visualization with Chart.js
  • Interactive tooltips with formatted data
  • Responsive design for all screen sizes
  • Color-coded by movement direction

πŸ” Search Functionality

Live Market Activity

  • Real-time filtering by keywords
  • Category-based search
  • Results counter display

Movement History

  • Keyword search across market questions
  • Category filtering
  • Time-based filtering

πŸ“± Responsive Design

The application is fully responsive with:

  • Mobile-first design approach
  • Collapsible navigation for mobile
  • Adaptive layouts for different screen sizes
  • Touch-friendly interactions

πŸš€ Deployment

Production Setup

  1. Environment configuration

    APP_ENV=production
    APP_DEBUG=false
  2. Database configuration

    • Use PostgreSQL or MySQL for production
    • Configure database credentials
  3. Asset compilation

    npm run build
  4. Queue configuration (optional)

    • Configure Redis for job queues
    • Set up supervisor for queue workers

Performance Optimization

  • Database indexing on frequently queried columns
  • Caching for API responses
  • Asset optimization with Vite
  • CDN for static assets

πŸ§ͺ Testing

API Testing

# Test Polymarket API endpoints
php artisan polymarket:test

Frontend Testing

# Run tests (if configured)
npm test

πŸ”§ Development

Development Server

# Start Laravel server
php artisan serve

# Start Vite dev server
npm run dev

# Run scheduler
php artisan schedule:work

Code Style

  • PHP: PSR-12 standards
  • JavaScript: ESLint configuration
  • CSS: Tailwind CSS utilities

πŸ“ˆ Monitoring

Logs

  • Laravel logs: storage/logs/laravel.log
  • API errors: Logged with context
  • Sync operations: Detailed logging

Metrics

  • Market count: Total active markets
  • Movement count: Recent movements
  • Sync status: Last successful sync
  • API health: Endpoint availability

πŸ†˜ Support

For support and questions:

  • Check the documentation
  • Review the code comments
  • Open an issue on GitHub

Built with ❀️ using Laravel and React

About

Prophit monitors Polymarket prediction markets for significant price movements (1%+ change in 24 hours) and provides a clean, functional interface for understanding market dynamics. The application fetches real-time data from Polymarket's API and stores it efficiently for analysis and visualization.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages