Skip to content

wanguolin/polymarket-chrome-extension-prompts

Repository files navigation

Polymarket Strategy Generator Chrome Extension

A powerful Chrome extension that extracts betting information from Polymarket event pages and generates AI-friendly prompts for Kelly Criterion-based betting strategies and arbitrage opportunities.

Features

  • Smart Page Detection: Automatically detects Polymarket event pages and enables/disables accordingly
  • Data Extraction: Intelligently extracts event titles, market data, odds, and resolution rules
  • AI-Optimized Prompts: Generates comprehensive prompts for AI trading assistants
  • Template Customization: Edit and save custom prompt templates with placeholder support
  • Clipboard Integration: One-click copying of generated prompts
  • Dark/Light Theme: Automatic theme adaptation based on system preferences
  • Maximum Permissions: Configured for development use with localhost and local network access

Installation & Setup

1. Download or Clone the Extension

git clone <repository-url>
cd polymarket-chrome-extension

2. Enable Developer Mode in Chrome

  1. Open Chrome and navigate to chrome://extensions/
  2. Toggle "Developer mode" in the top-right corner
  3. You should see additional options appear

3. Load the Extension

  1. Click "Load unpacked" button
  2. Navigate to and select the polymarket-chrome-extension folder
  3. The extension should now appear in your extensions list

4. Pin the Extension (Recommended)

  1. Click the puzzle piece icon (Extensions) in Chrome's toolbar
  2. Find "Polymarket Strategy Generator" and click the pin icon
  3. The extension icon will now appear directly in your toolbar

Usage Guide

Basic Operation

  1. Navigate to a Polymarket Event Page

    • Go to any URL matching the pattern: https://polymarket.com/event/*
    • Example: https://polymarket.com/event/fed-decision-in-july
  2. Extension Status Indicators

    • Green dot: Active on valid Polymarket event page
    • Red dot: Not on a compatible page
    • 🟡 Yellow dot: Checking page status
  3. Generate and Copy Prompt

    • Click "Auto Copy Prompt" button
    • Extension extracts page data automatically
    • Generated prompt is copied to clipboard
    • Paste into your preferred AI assistant

Template Customization

  1. Access Template Editor

    • Click "Edit Template" button
    • Template editor opens in overlay
  2. Available Placeholders

    • {{TITLE}} - Betting event title
    • {{MARKET_INFO}} - Market data, odds, and volumes
    • {{RULES}} - Event resolution rules and conditions
  3. Save Custom Templates

    • Edit template content as needed
    • Click "Save Template" to persist changes
    • Use "Reset to Default" to restore original template

Development and Testing

The extension is configured with maximum permissions for development purposes:

  • Local Development: Access to http://localhost/* and http://127.0.0.1/*
  • Network Testing: Access to local network http://192.168.1.*/*
  • Full Web Access: Complete internet access for data fetching

Extracted Data Structure

The extension extracts three key data types:

1. Event Title

  • Primary heading from the betting event page
  • Fallback to meta tags if main title not found

2. Market Information

  • Betting options and outcomes
  • Current odds and probabilities
  • Trading volumes
  • Buy/sell prices for Yes/No positions

3. Resolution Rules

  • Event resolution criteria
  • Source information and deadlines
  • Special conditions and edge cases

Default AI Prompt Template

The extension includes a comprehensive default template that instructs AI assistants to:

  1. Market Assessment

    • Evaluate odds and implied probabilities
    • Identify market inefficiencies
    • Assess liquidity patterns
  2. Kelly Criterion Application

    • Calculate optimal bet sizing
    • Consider multiple confidence scenarios
    • Factor in bankroll management
  3. Arbitrage Strategy

    • Specific entry/exit points
    • Limit order recommendations
    • Take-profit and stop-loss levels
  4. Risk Management

    • Timeline-based adjustments
    • Volatility considerations
    • Exit strategies
  5. Execution Plan

    • Specific order types and prices
    • Timing recommendations
    • Profit-taking milestones

Troubleshooting

Extension Not Working

  1. Verify you're on a polymarket.com/event/* page
  2. Check that extension is enabled in chrome://extensions/
  3. Try refreshing the page and reopening extension popup

Data Extraction Issues

  1. Ensure page has fully loaded before clicking "Auto Copy Prompt"
  2. Check browser console for any JavaScript errors
  3. Try on different Polymarket event pages to isolate issues

Template Problems

  1. Use "Reset to Default" if custom template causes issues
  2. Ensure all placeholders ({{TITLE}}, {{MARKET_INFO}}, {{RULES}}) are present
  3. Check template syntax for any malformed content

Clipboard Issues

  1. Grant clipboard permissions when prompted
  2. Manually copy from browser console if automatic copy fails
  3. Check that popup has focus when clicking copy button

Privacy & Permissions

This extension requests extensive permissions for development flexibility:

  • Active Tab: Access current tab information
  • Storage: Save custom templates locally
  • Clipboard: Copy generated prompts
  • All Hosts: Maximum access for development and testing

Note: In production use, permissions should be reduced to only necessary domains.

Technical Details

Architecture

  • Manifest V3: Uses latest Chrome extension standards
  • Content Scripts: Inject into Polymarket pages for data extraction
  • Service Worker: Background script for extension management
  • Popup Interface: Modern, responsive UI with dark/light theme support

Browser Compatibility

  • Chrome 88+ (Manifest V3 support required)
  • Chromium-based browsers (Edge, Brave, etc.)

File Structure

polymarket-chrome-extension/
├── manifest.json          # Extension configuration
├── popup.html            # Main popup interface
├── popup.css             # Styling for popup
├── popup.js              # Popup functionality
├── content.js            # Page data extraction
├── background.js         # Service worker
├── icons/                # Extension icons (16x16 to 128x128)
└── README.md            # This documentation

Development Notes

Content Script Strategy

The extension uses multiple fallback selectors to extract data from Polymarket's dynamic React interface:

  • CSS class-based selectors for direct targeting
  • Attribute-based selectors for stability
  • Text content searching for resilience
  • Meta tag fallbacks for reliability

Error Handling

Comprehensive error handling includes:

  • Network request failures
  • Missing page elements
  • Clipboard API limitations
  • Storage quota exceeded scenarios

Performance Optimization

  • Lazy loading of heavy operations
  • Debounced DOM queries
  • Efficient selector strategies
  • Minimal memory footprint

Contributing

To contribute to this extension:

  1. Fork the repository
  2. Create feature branch
  3. Test thoroughly on multiple Polymarket pages
  4. Submit pull request with detailed description

License

This extension is provided as-is for educational and development purposes. Users are responsible for compliance with Polymarket's terms of service and applicable regulations.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published