A collection of Python scripts for interacting with Polymarket's API to fetch market data, comments, and other information.
- Python 3.7 or higher
requestslibrary
-
Clone or download this repository
-
Install required dependencies:
pip install requestsFile: get-polymarket-market-comments.py
Fetches all comments from a Polymarket event and saves them to JSON files.
Usage:
python get-polymarket-market-comments.py <polymarket_url>Example:
python get-polymarket-market-comments.py https://polymarket.com/event/will-trump-release-epstein-files-by?tid=1765631877125What it does:
- Extracts the event slug from the provided URL
- Fetches event metadata and all associated markets
- Retrieves all comments from the event (with pagination)
- Displays the first 20 comments in the console
- Saves all comments to a JSON file named
{slug}_event_comments.json - If specific markets are found (e.g., "December 19"), fetches and saves those separately
Output files:
All output files are saved to the output/ directory:
output/{slug}_event_comments.json- All comments for the entire eventoutput/{slug}_dec19_comments.json- Comments for specific market (if found)
This repository will be expanded with additional scripts for:
- Market data analysis
- Price tracking
- Trading history
- And more...
These scripts use Polymarket's Gamma API:
- Base URL:
https://gamma-api.polymarket.com - Endpoints used:
/events- Get event and market information/comments- Get comments for events and markets
Feel free to add more scripts to interact with Polymarket's API. Follow the existing code structure and update this README with new scripts.
This project is open source and available for personal use.