Leia em Português | Read in English
Browser console automation bot for Polymarket operations with integrated Paper Trading system and Data Collection for market analysis.
This bot allows you to execute buy and sell operations on Polymarket through keyboard shortcuts, offering:
- 🎮 Keyboard Control: Execute trades quickly with shortcuts
- 📊 Paper Trading: Simulate operations without risking real money
- 📈 Data Collection: Record market data every 1s for analysis (NEW!)
- 🛡️ Protections: Anti-spam, market order, and double execution prevention
- 📈 Real-time Analysis: Track P&L, statistics, and history
- 🎨 Visual Interface: Control panels integrated in the browser
- 🔊 Sound Feedback: Trade execution notifications
The bot has been tested and validated on the following Polymarket market types:
- Above/Below: Price prediction markets above or below a threshold
npm installnpm run buildThis will create the dist/bundle.js file with all the compiled code.
- Open https://polymarket.com and navigate to a market (e.g., above/below)
- Press
F12to open the browser console - Go to the Console tab
- Copy all the content from
dist/bundle.js - Paste it into the console and press
Enter - Done! The bot is active 🎉
If you prefer, you can copy the code directly from a release. Here's an example based on the latest version:
// Paste this code into the Polymarket console:
// (replace with the actual content of dist/bundle.js after build)
// Example of code structure after build:
// The bundle.js file contains all the minified and optimized code
// To use releases, go to: https://github.com/your-user/polymarket-bot/releases
// And copy the code from the desired version💡 Tip: To get the latest version, always build or download the latest release from the repository.
Before executing, you can adjust settings through the control panel that appears in the top right corner, or by editing src/config.js before building:
export const config = {
QUOTA: 1, // 💰 Value in USD per operation
CAN_TRADE: false, // 🔴 true = PRODUCTION | false = DEBUG
AUTO_NEXT_EVENT: true, // ⏭️ Auto next event
PAPER_TRADING_ENABLED: true, // 📊 Enable Paper Trading
PAPER_INITIAL_BALANCE: 1000, // 💵 Initial balance (USD)
COOLDOWN_MS: 300, // ⏱️ Cooldown between operations (ms)
};CAN_TRADE = false for testing! Only change to true when you're ready to operate with real money.
The shortcuts work for both Paper Trading and Real Trading:
| Key | Action | Description |
|---|---|---|
| C | 📈 BUY UP | Buy betting on the upside |
| B | 📉 BUY DOWN | Buy betting on the downside |
| Q | 💰 SELL 25% | Sell 25% of positions |
| W | 💰 SELL 50% | Sell 50% of positions |
| E | 💰 SELL 100% | Sell all positions (MAX) |
- Anti-Spam Protection: 300ms cooldown between operations
- Auto Next Event: Automatically navigates to next available events
- Market Order: Ensures execution at market price
- Double Initialization Protection: Prevents multiple bot instances
- Automatic Versioning: Each execution traceable with timestamp
- 💵 Real-time adjustment of value per operation
- 🔴/🟢 Toggle between DEBUG and PRODUCTION mode
- 📊 Enable/disable Paper Trading
- ⏭️ Auto next event control
- 📌 System status and version
The Paper Trading system offers a complete simulation without executing real operations:
- 💰 Virtual Balance: Configurable initial balance control
- 📈 Open Positions: Real-time tracking of all positions (UP/DOWN)
- 📊 Complete History: Detailed record of all transactions
- 💹 Real-time P&L: Realized and unrealized profit/loss
- 📉 Detailed Statistics: Complete performance metrics
Each operation records:
- ⏰ Date and time of operation
- 📌 Type (BUY UP/DOWN, SELL)
- 💵 Entry/exit price
- 📊 Number of shares (value/price)
- 💰 Amount invested in USD
- 📈 Profit/Loss (for sales)
- 📊 Gain/loss percentage
The totalizer displays:
- 🔢 Total Trades: Total number of operations
- 💰 Total Invested: Sum of all purchases
- 📈 Realized P&L: Profit/loss from closed positions
- 📉 Unrealized P&L: Profit/loss from open positions
- 🎯 Win Rate: Percentage of winning trades
- ✅ Winning Trades: Number of profitable trades
- ❌ Losing Trades: Number of trades with loss
Displayed when Paper Trading is active:
- 💵 Real-time available balance
- 📊 List of open positions with unrealized P&L
- 📈 Complete session statistics
- 📜 Transaction history (last 10 or all)
- 🔘 Action buttons (export/reset)
- 📥 JSON Export: Saves all history and statistics
- 🔄 Session Reset: Clears data and restarts with initial balance
- 📜 Expandable History: Toggle between last 10 or all transactions
- 💹 FIFO Calculation: Sales processed by First-In-First-Out
- 🔄 Automatic Update: P&L updated on every price change
Paper Trading is enabled by default. You can:
- Disable/enable via checkbox in the control panel
- Or change
PAPER_TRADING_ENABLEDinsrc/config.jsbefore building
Define how much you want to simulate in src/config.js:
PAPER_INITIAL_BALANCE: 1000 // USDUse the same keyboard shortcuts (C, B, Q, W, E):
- BUY: Deducts value from balance and opens position
- SELL: Closes positions using FIFO, calculates P&L and returns to balance
The panel shows in real-time:
- All open positions with unrealized P&L
- Transaction history
- Complete session statistics
Click 📥 Export to save a JSON with:
{
"balance": 1050.25,
"initialBalance": 1000,
"positions": [...],
"transactions": [...],
"stats": {...},
"exportDate": "2026-03-13T10:30:00.000Z"
}Click 🔄 Reset to:
- Return to initial balance
- Clear all positions
- Zero history and statistics
NEW FEATURE! The bot now includes an automated data collection system for market analysis.
- 📈 Automatic Collection: Records market data every 1 second
- 💾 Export Options: JSON and CSV formats
- 🎯 Rich Data: 20+ metrics per record including prices, probabilities, volatility
- 🔄 Continuous: Keeps collecting after export
- 🎛️ Control: Toggle on/off anytime from control panel
Each record includes:
- Prices: Target price, current price, UP/DOWN prices
- Probabilities: Implied market probabilities
- Trends: Price changes, market bias
- Volatility: 1-minute rolling volatility
- Metadata: Timestamps, session ID, sequence number
-
Start Collection (enabled by default)
- Toggle "📊 Coletar Dados" in the control panel
-
Monitor Progress
- See record count update in real-time
-
Export Data
- Click 💾 JSON for structured data
- Click 📊 CSV for spreadsheet analysis
- Files download automatically with timestamp
-
Clear Data
- Click 🗑️ Limpar Dados to reset
- 🔍 Pattern Discovery: Find profitable entry points
- 📈 Backtesting: Test strategies on historical data
- 🎯 Optimization: Identify best timing for trades
- 📊 Analysis: Correlation between metrics
For complete documentation, see __DATA_COLLECTION.md
For development with automatic recompilation:
npm run devThis monitors changes in src/ and recompiles automatically.
src/
├── config.js → Global configurations
├── index.js → Main entry point
├── trading/ → Trading logic
│ ├── buy.js → Buy (UP/DOWN)
│ ├── sell.js → Sell (25%/50%/100%)
│ ├── selectors.js → DOM selectors
│ └── autoNext.js → Auto next event
├── paperTrading/ → Simulation system
│ ├── core.js → Simulated buy/sell
│ └── calculations.js → P&L calculations
├── dataCollector/ → Data collection system
│ ├── collector.js → Market data collector
│ └── exporter.js → JSON/CSV export
├── ui/ → Visual interface
│ ├── controlPanel.js → Control panel
│ ├── paperPanel.js → Paper trading panel
│ └── notifications.js → Notification system
└── utils/ → Utilities
├── helpers.js → Helper functions
├── protection.js → Anti-spam protections
└── sounds.js → Audio system
To create a new release:
# Patch (1.0.0 → 1.0.1)
npm run release:patch
# Minor (1.0.0 → 1.1.0)
npm run release:minor
# Major (1.0.0 → 2.0.0)
npm run release:major⚠️ Always test in DEBUG mode (CAN_TRADE = false) before using in production- 🔄 Don't reload the script without first refreshing the page (F5)
- 💰 The bot executes real trades when
CAN_TRADE = true - ⚖️ Use at your own risk - financial operations involve risks
- 🧪 Paper Trading is for learning - real prices may vary
- 📊 Validate your strategies in Paper Trading before operating with real money
After initialization, you can manually call:
getCurrentAssetValue() // Returns current asset value
getCurrentAssetTarget() // Returns target asset value
buyUp() // Executes UP buy
buyDown() // Executes DOWN buy
sell25() // Sells 25%
sell50() // Sells 50%
sellMax() // Sells 100%- ✅ Add "paper trading" mode with realistic simulation
- 🎯 Implement automatic stop-loss/take-profit
-
⚠️ Implement risk analysis before each operation
- ✅ Add history of completed operations
- ✅ Create visual panel for P&L tracking
- 📝 Implement persistent error log
- 🧠 Add support for multiple strategies
- 📊 Performance charts over time
- 🔔 Customizable price alerts
- 🔄 Implement queue system for operations
- ↩️ Add automatic retry on failure
- 🔍 Improve DOM element detection
- 🧪 Add automated tests
- ⚡ Optimize bundle size
- Implement sell shortcuts (Q, W, E)
- Q: Sells 25% of shares
- W: Sells 50% of shares
- E: Sells 100% (Max) of shares
- Reduce
setTimeoutusage with promises - Add sound notifications for executed trades
- Create graphical user interface (GUI) in the browser
- Complete Paper Trading system
- Control panel with real-time settings
- JSON data export
- Detailed performance statistics
- Modular architecture with Vite
This project is provided "as is", without warranties of any kind, express or implied.
Use at your own risk. The author is not responsible for financial losses, damages, or any other problems arising from the use of this software.
This bot is intended for educational and learning purposes only.
Contributions are welcome! Feel free to:
- 🐛 Report bugs
- 💡 Suggest new features
- 🔧 Submit pull requests
- 📖 Improve documentation
- ⭐ Star the project
- Fork the project
- Create a branch for your feature (
git checkout -b feature/MyFeature) - Commit your changes (
git commit -m 'Add MyFeature') - Push to the branch (
git push origin feature/MyFeature) - Open a Pull Request
Version: 1.0.5
Last updated: March 13, 2026
Author: Bot Polymarket Team
💙 Made with dedication for the trading community