Skip to content

A simple webapp showing market winners and those with a high ROI generally. Data provided by Polymarket API.

Notifications You must be signed in to change notification settings

abraham-ny/Polymarket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polymarket Tracker

A modern, data-focused dashboard for tracking top-performing Polymarket accounts by win rate and ROI. Features real-time data synchronization with Google Sheets.

Features

  • Dual View Pages

    • Page 1: Highest Win Rate accounts
    • Page 2: Best ROI (Return on Investment) accounts
  • Rich Account Stats

    • Win Rate percentage
    • ROI percentage
    • Total volume traded
    • Number of trades
    • Weekly P&L with visual indicators (green up arrows for profit, red down arrows for loss)
  • Interactive Grid

    • Sort by: Win Rate, ROI, Weekly P&L, or Volume
    • Click any account card to open their Polymarket profile in a new tab
    • Responsive grid layout
  • Google Sheets Integration

    • Export all tracked accounts to Google Sheets
    • Automatic formatting with conditional colors
    • Timestamp tracking
  • Auto-Refresh

    • Data refreshes every 5 minutes when tab is active
    • Local caching for faster load times

Setup Instructions

1. Frontend Setup

  1. Open index.html in a web browser
  2. The site works entirely client-side - no server required!

2. Polymarket API Integration

The current implementation uses mock data. To connect to the real Polymarket API:

  1. Open script.js
  2. Find the fetchTopAccountsByWinRate() and fetchTopAccountsByROI() functions
  3. Replace the mock data generation with actual API calls:
async function fetchTopAccountsByWinRate() {
    const response = await fetch(`${CONFIG.POLYMARKET_API}/leaderboard?sortBy=winrate&limit=50`);
    const data = await response.json();
    return data.accounts; // Adjust based on actual API response structure
}

Note: You'll need to:

  • Review Polymarket's API documentation for the correct endpoints
  • Handle authentication if required
  • Adjust the data mapping to match the API response format

3. Google Sheets Integration Setup

Step 1: Create a Google Sheet

  1. Go to Google Sheets
  2. Create a new spreadsheet
  3. Copy the spreadsheet ID from the URL (the long string between /d/ and /edit)

Step 2: Set up Google Apps Script

  1. In your Google Sheet, go to Extensions > Apps Script
  2. Delete any existing code
  3. Copy the entire contents of google-apps-script.gs into the script editor
  4. At the top of the script, add your spreadsheet ID:
    const SPREADSHEET_ID = 'YOUR_SPREADSHEET_ID_HERE';
  5. Save the script (💾 icon or Ctrl+S)

Step 3: Deploy as Web App

  1. Click Deploy > New deployment
  2. Click the gear icon ⚙️ next to "Select type"
  3. Choose Web app
  4. Configure:
    • Description: "Polymarket Tracker API"
    • Execute as: Me
    • Who has access: Anyone
  5. Click Deploy
  6. Copy the Web app URL (it will look like: https://script.google.com/macros/s/...)

Step 4: Update Frontend Configuration

  1. Open script.js
  2. Find the CONFIG object at the top
  3. Add your Web App URL:
    const CONFIG = {
        POLYMARKET_API: 'https://gamma-api.polymarket.com',
        GOOGLE_SHEETS_SCRIPT_URL: 'YOUR_WEB_APP_URL_HERE',
        CACHE_DURATION: 5 * 60 * 1000,
    };

Step 5: Test the Integration

  1. Open index.html in your browser
  2. Click "Fetch & Sync Data" to load account data
  3. Click "Export to Sheets" to send data to Google Sheets
  4. Check your Google Sheet - data should appear with formatting!

File Structure

polymarket-tracker/
├── index.html              # Main HTML file
├── styles.css              # Dark dashboard styling
├── script.js               # Frontend logic & API integration
├── google-apps-script.gs   # Google Sheets backend
└── README.md               # This file

Customization

Changing the Color Scheme

Edit the CSS variables in styles.css:

:root {
    --bg-primary: #0a0e14;      /* Main background */
    --accent-primary: #00ff88;   /* Primary accent (green) */
    --accent-secondary: #0099ff; /* Secondary accent (blue) */
    --accent-danger: #ff3366;    /* Negative values (red) */
}

Adjusting Refresh Interval

In script.js, modify:

const CONFIG = {
    CACHE_DURATION: 5 * 60 * 1000, // Change to desired milliseconds
};

Adding More Stats

  1. Update the account data structure in script.js
  2. Modify the createAccountCard() function to display new stats
  3. Update Google Sheets headers in google-apps-script.gs

Browser Compatibility

  • ✅ Chrome/Edge (recommended)
  • ✅ Firefox
  • ✅ Safari
  • ✅ Opera

Troubleshooting

"Error fetching account data"

  • Check browser console for specific error messages
  • Verify the Polymarket API endpoint is correct
  • Check for CORS issues (may need a backend proxy)

"Error exporting to Google Sheets"

  • Ensure the Web App URL is correct in CONFIG
  • Verify the Apps Script deployment is set to "Anyone"
  • Check the Apps Script execution log for errors

Accounts not displaying

  • Open browser console (F12)
  • Check for JavaScript errors
  • Verify data structure matches expected format

Future Enhancements

  • Real-time WebSocket updates
  • Historical performance charts
  • Filter by date range
  • Email alerts for top performers
  • CSV export option
  • Dark/Light theme toggle

License

MIT License - feel free to use and modify!

Credits

Built with vanilla HTML, CSS, and JavaScript - no frameworks required!

About

A simple webapp showing market winners and those with a high ROI generally. Data provided by Polymarket API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published