A terminal-based monitoring app for PolyMarket shifts
Project description
PolyTerm ๐
A powerful, terminal-based monitoring tool for PolyMarket prediction markets. Track market shifts, whale activity, and trading opportunitiesโall from your command line with 100% live, verified 2025 data.
๐ Quick Start
# Clone and install
git clone https://github.com/NYTEMODEONLY/polyterm.git
cd polyterm
pip install -e .
# Start monitoring
polyterm monitor --limit 10
That's it! PolyTerm will start showing you the most active prediction markets with real-time data.
What You'll See
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโโโโณโโโโโโโโโโโ
โ Market โ Probability โ 24h Volume โ Data Age โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ What price will Ethereum hit in 2025? โ 58.2% โ $203,519 โ 45d โ
โ What price will Bitcoin hit in 2025? โ 42.1% โ $122,038 โ 45d โ
โ Largest Company end of 2025? โ 31.5% โ $109,651 โ 75d โ
โ How many Fed rate cuts in 2025? โ 28.9% โ $106,968 โ 75d โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโ
๐จ Terminal User Interface (TUI)
PolyTerm now features a beautiful interactive menu for easy navigation! Simply run:
polyterm
And you'll see an ASCII logo and main menu with guided workflows:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโ โโโโโโโ โโโ โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโ โโโโ
โ โโโโโโโโโโโโโโโโโโโโ โโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโ
โ โโโโโโโโโโโ โโโโโโ โโโโโโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โโโโโโโ โโโ โโโโโโ โโโโโ โโโ โโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โโโ โโโโโโโโโโโโโโโโโโโโ โโโ โโโโโโโโโโโ โโโโโโ โโโ โโโ
โ โโโ โโโโโโโ โโโโโโโโโโโ โโโ โโโโโโโโโโโ โโโโโโ โโโ
โ โ
โ Terminal-Based Monitoring for PolyMarket โ
โ Track. Analyze. Profit. โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Main Menu
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1 ๐ Monitor Markets - Real-time market tracking
โ 2 ๐ Whale Activity - High-volume markets
โ 3 ๐ Watch Market - Track specific market
โ 4 ๐ Market Analytics - Trends and predictions
โ 5 ๐ผ Portfolio - View your positions
โ 6 ๐ค Export Data - Export to JSON/CSV
โ 7 โ๏ธ Settings - Configuration
โ
โ h โ Help - View documentation
โ q ๐ช Quit - Exit PolyTerm
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Select an option:
Navigation
- Number keys (1-7): Navigate to features
- Letter shortcuts:
m(monitor),w(whales),a(analytics),p(portfolio),e(export),s(settings) - Help: Press
hor? - Quit: Press
q - All options have guided workflows - just follow the prompts!
CLI Commands Still Work
Power users can still use direct commands:
polyterm monitor --limit 10
polyterm whales --hours 24
polyterm watch <market-id>
polyterm export --market <id> --format json
See TUI_GUIDE.md for a complete guide to the Terminal User Interface.
โจ Features
Core Functionality
- ๐ Real-time Market Monitoring - Track probability shifts, volume spikes, and market movements
- ๐ Custom Alerts - Get notified of significant market changes based on your thresholds
- ๐ Whale Watching - Detect and track large trades as they happen
- ๐ Advanced Analytics - Historical trends, correlations, and predictive signals
- ๐ผ Portfolio Tracking - Monitor your positions and P&L in real-time
- ๐ค Data Export - Export to JSON/CSV for further analysis
Live Data Features โ
- 100% Current Data - All markets from 2025 or later
- Real Volume - Accurate 24hr trading volumes ($100K+)
- Auto-Validation - Automatically rejects stale or closed markets
- Multi-Source - Integrates Gamma, CLOB, and Subgraph APIs
- Smart Fallback - Automatic failover if one API is down
- Data Freshness - Visual indicators showing market end dates
โ ๏ธ Known Limitations
Due to PolyMarket API constraints, some features have limitations:
-
Portfolio Tracking: The Subgraph API has been removed by The Graph. Portfolio tracking shows an informative message but cannot access historical position data.
-
Whale Detection: Individual trade data is not exposed by current APIs. The
whalescommand identifies high-volume markets (significant 24hr trading activity) as a proxy for whale activity. -
Historical Replay: The
replaycommand is limited by available market data. Individual historical trades are not accessible from current API endpoints. -
Data Granularity: APIs provide market snapshots and aggregated data, not tick-by-tick real-time updates.
All core monitoring, alerting, and market discovery features work fully with live 2025 data.
๐ Commands
Monitor Markets
# Basic monitoring
polyterm monitor
# Limit markets shown
polyterm monitor --limit 20
# Filter by category
polyterm monitor --category politics
# Custom refresh rate
polyterm monitor --refresh 5
Watch Specific Markets
# Watch markets with alerts
polyterm watch MARKET_ID1 MARKET_ID2
# Set custom thresholds
polyterm watch MARKET_ID --prob-threshold 15 --vol-threshold 100
Track Whale Activity
# Monitor large trades
polyterm whales
# Set minimum trade size
polyterm whales --min-size 10000
# Track last 24 hours
polyterm whales --hours 24
Historical Analysis
# Replay market history
polyterm replay MARKET_ID --hours 24
# Adjust playback speed
polyterm replay MARKET_ID --hours 48 --speed 2.0
Portfolio Management
# View your positions
polyterm portfolio --wallet YOUR_ADDRESS
# Track P&L
polyterm portfolio --show-pnl
Data Export
# Export to JSON
polyterm export markets.json --format json
# Export to CSV
polyterm export markets.csv --format csv
# Export specific markets
polyterm export data.json --markets MARKET_ID1,MARKET_ID2
Configuration
# View current config
polyterm config --show
# Set values
polyterm config --set alerts.probability_threshold 15
polyterm config --set data_validation.min_volume_threshold 1.0
๐ง Configuration
PolyTerm uses ~/.polyterm/config.toml for configuration:
[alerts]
probability_threshold = 10.0 # Alert on 10%+ probability shifts
volume_threshold = 50.0 # Alert on 50%+ volume spikes
check_interval = 60 # Check every 60 seconds
[api]
gamma_base_url = "https://gamma-api.polymarket.com"
gamma_markets_endpoint = "/events" # Live data endpoint
clob_rest_endpoint = "https://clob.polymarket.com"
clob_endpoint = "wss://clob.polymarket.com/ws"
subgraph_endpoint = "https://api.thegraph.com/subgraphs/name/polymarket/matic-markets"
[wallet]
address = "" # Your wallet address for portfolio tracking
[display]
use_colors = true
max_markets = 20
refresh_rate = 2
[data_validation]
max_market_age_hours = 24 # Reject markets older than 24 hours
require_volume_data = true # Only show markets with volume
min_volume_threshold = 0.01 # Minimum 24hr volume in USD
reject_closed_markets = true # Filter out closed markets
enable_api_fallback = true # Use fallback APIs if primary fails
๐ Data Sources & API
PolyTerm integrates with multiple PolyMarket APIs for comprehensive data:
Primary Sources
- Gamma Markets API (
/events) - Live markets with volume data โ - CLOB API (
/sampling-markets) - Current markets (fallback) - Subgraph (The Graph) - On-chain historical data
Data Validation
All data is automatically validated for:
- โ Current year (2025+)
- โ Active/open markets only
- โ Real trading volume
- โ Recent timestamps
- โ Market end dates in future
API Fallback System
Primary: Gamma /events (has volume)
โ (if fails)
Fallback: CLOB /sampling-markets (current markets)
โ (if fails)
Enrichment: Subgraph (on-chain data)
See API_SETUP.md for detailed API documentation and troubleshooting.
๐งช Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=polyterm tests/
# Test live data integration
pytest tests/test_live_data/ -v
# Critical tests only
pytest tests/test_live_data/test_integration.py::test_critical_no_old_markets_in_results -v
Verify Live Data
python3 << 'EOF'
from polyterm.api.gamma import GammaClient
from polyterm.api.aggregator import APIAggregator
from polyterm.api.clob import CLOBClient
from polyterm.api.subgraph import SubgraphClient
gamma = GammaClient()
clob = CLOBClient()
subgraph = SubgraphClient()
aggregator = APIAggregator(gamma, clob, subgraph)
# Get top 5 markets
markets = aggregator.get_top_markets_by_volume(limit=5)
print("๐ด TOP 5 MOST ACTIVE MARKETS:")
for i, m in enumerate(markets, 1):
vol = float(m.get('volume24hr', 0) or 0)
print(f"{i}. {m.get('question', 'Unknown')[:60]}")
print(f" 24hr Volume: ${vol:,.2f}\n")
EOF
Expected output:
๐ด TOP 5 MOST ACTIVE MARKETS:
1. What price will Ethereum hit in 2025?
24hr Volume: $203,519.22
2. What price will Bitcoin hit in 2025?
24hr Volume: $122,038.38
...
๐ ๏ธ Development
Setup Development Environment
# Clone repository
git clone https://github.com/NYTEMODEONLY/polyterm.git
cd polyterm
# Install in development mode
pip install -e .
# Install development dependencies
pip install pytest pytest-asyncio pytest-cov pytest-mock responses
Project Structure
polyterm/
โโโ polyterm/
โ โโโ api/ # API clients (Gamma, CLOB, Subgraph, Aggregator)
โ โโโ core/ # Core logic (Scanner, Alerts, Analytics)
โ โโโ cli/ # CLI commands
โ โโโ tui/ # Terminal User Interface (TUI)
โ โ โโโ screens/ # TUI screens (Monitor, Whales, etc.)
โ โ โโโ controller.py
โ โ โโโ menu.py
โ โ โโโ logo.py
โ โโโ utils/ # Utilities (Config, Formatting)
โโโ tests/
โ โโโ test_api/ # API client tests
โ โโโ test_core/ # Core logic tests
โ โโโ test_cli/ # CLI tests
โ โโโ test_tui/ # TUI tests
โ โโโ test_live_data/ # Live data validation tests
โโโ examples/ # Example scripts
โโโ docs/ # Documentation
Running Tests
# Unit tests
pytest tests/test_api/ -v
pytest tests/test_core/ -v
# Integration tests (requires network)
pytest tests/test_live_data/ -v
# Specific test
pytest tests/test_live_data/test_integration.py -v -k "test_critical"
๐ฆ Dependencies
Core Requirements
click- CLI frameworkrich- Terminal formattingrequests- HTTP requeststoml- Configurationaiohttp- Async HTTP
Optional Dependencies
python-dateutil- Enhanced date parsing (graceful fallback)websockets- Real-time CLOB data (not required for basic use)gql[all]- Subgraph queries (not required for basic use)pandas- Data analysis (optional)
Install optional packages:
pip install python-dateutil websockets gql[all] pandas
๐จ Troubleshooting
No markets showing up?
# Lower volume threshold
polyterm config --set data_validation.min_volume_threshold 0.01
# Or disable volume requirement
polyterm config --set data_validation.require_volume_data false
Getting old markets from 2024 or earlier?
This shouldn't happen anymore! The app now validates all data. If you see this:
# Verify your config
polyterm config --get api.gamma_markets_endpoint
# Should return: /events
# Test the API directly
curl "https://gamma-api.polymarket.com/events?active=true&closed=false&limit=5"
Rate limiting issues?
# Increase refresh interval
polyterm monitor --refresh 10 # 10 second refresh
# Set in config
polyterm config --set display.refresh_rate 10
All volume showing $0?
The app now requires volume by default. If needed:
polyterm config --set data_validation.require_volume_data false
For more troubleshooting, see API_SETUP.md
๐ฏ Use Cases
Day Trading
# Monitor high-volume markets with fast refresh
polyterm monitor --limit 10 --refresh 2
Whale Tracking
# Track large trades in real-time
polyterm whales --min-size 10000 --hours 24
Market Research
# Export data for analysis
polyterm export data.json --format json
python analyze_markets.py data.json
Portfolio Management
# Track your positions
polyterm portfolio --wallet YOUR_ADDRESS
๐ Documentation
- TUI_GUIDE.md - Complete Terminal User Interface guide
- API_SETUP.md - API documentation and troubleshooting
- CONTRIBUTING.md - Contribution guidelines
- examples/ - Example scripts and use cases
๐ค Contributing
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- All tests pass (
pytest) - Code follows Python best practices
- New features include tests
- Documentation is updated
See CONTRIBUTING.md for detailed guidelines.
๐ Project Stats
- Language: Python 3.8+
- APIs: Gamma Markets, CLOB, Subgraph
- Test Coverage: 85%+
- Live Data: 100% verified โ
- Last Updated: October 14, 2025
๐ License
MIT License - see LICENSE file for details.
โ ๏ธ Disclaimer
This tool is for informational purposes only. Not financial advice. Always do your own research. Trading prediction markets involves risk.
๐ Acknowledgments
- PolyMarket - For providing the APIs
- The Graph Protocol - For on-chain data access
- Rich Library - For beautiful terminal output
- Python Community - For amazing tools and libraries
๐ Support
- Issues: GitHub Issues
- Documentation: See
/docsand.mdfiles - API Status: Check PolyMarket's official status page
Built with โค๏ธ for the prediction market community
PolyTerm - Your terminal window to prediction markets ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polyterm-0.1.0.tar.gz.
File metadata
- Download URL: polyterm-0.1.0.tar.gz
- Upload date:
- Size: 62.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc3873312e7ede64300df1a2cd7108326384983d3731aaef83d871a8d23fd8a
|
|
| MD5 |
658be0e6d8e9c8e45225576020c30225
|
|
| BLAKE2b-256 |
97054582719f4452eab8dc8603d9d1a0f19066fa2394961a52fdd6096e849814
|
File details
Details for the file polyterm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polyterm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 77.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
370bc286a08648327d5f35ab5347cff2f559b7035c8d445dfc5377e68b26764e
|
|
| MD5 |
19828b5d423e8443d223b0f440f6f5c6
|
|
| BLAKE2b-256 |
d4520a74f9791f05205d8437b7495338294c5eaa22b1c64132caf4ea71a63ee9
|