Skip to main content

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.

Python 3.8+ License: MIT Live 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 h or ?
  • 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 whales command identifies high-volume markets (significant 24hr trading activity) as a proxy for whale activity.

  • Historical Replay: The replay command 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

  1. Gamma Markets API (/events) - Live markets with volume data โœ…
  2. CLOB API (/sampling-markets) - Current markets (fallback)
  3. 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 framework
  • rich - Terminal formatting
  • requests - HTTP requests
  • toml - Configuration
  • aiohttp - 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

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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 /docs and .md files
  • API Status: Check PolyMarket's official status page

Built with โค๏ธ for the prediction market community

PolyTerm - Your terminal window to prediction markets ๐Ÿ“Š

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polyterm-0.1.0.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polyterm-0.1.0-py3-none-any.whl (77.6 kB view details)

Uploaded Python 3

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

Hashes for polyterm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ddc3873312e7ede64300df1a2cd7108326384983d3731aaef83d871a8d23fd8a
MD5 658be0e6d8e9c8e45225576020c30225
BLAKE2b-256 97054582719f4452eab8dc8603d9d1a0f19066fa2394961a52fdd6096e849814

See more details on using hashes here.

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

Hashes for polyterm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 370bc286a08648327d5f35ab5347cff2f559b7035c8d445dfc5377e68b26764e
MD5 19828b5d423e8443d223b0f440f6f5c6
BLAKE2b-256 d4520a74f9791f05205d8437b7495338294c5eaa22b1c64132caf4ea71a63ee9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page