This repo now includes a complete end-to-end workflow for discovering Polymarket markets, collecting signals, modeling edge, backtesting, monitoring, and optionally executing bets.
polymarket_explorer.py— fetches top 100 active/open markets from Polymarket and saves topolymarket_markets.json.data_collector.py— enriches markets with polling, crypto, FRED, and NewsAPI sentiment signals intomarket_signals.json.probability_model.py— builds model probabilities, computes edge and Kelly sizing, and savesmodel_predictions.json.backtest_polymarket.py— simulates historical strategy performance on resolved markets and savesbacktest_results.json.monitor_polymarket.py— Streamlit dashboard with top opportunities, backtest stats, positions, and PnL.bet_executor.py— auto-bet executor via CLOB endpoint with logging and daily-loss circuit breaker.
- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the repo root:
NEWSAPI_KEY=your_newsapi_key
POLYMARKET_PRIVATE_KEY=your_wallet_private_key
POLYMARKET_WALLET_ADDRESS=your_wallet_address
PORTFOLIO_VALUE=1000Run the scripts in this order:
- Fetch active markets
python polymarket_explorer.py- Collect market signals
python data_collector.py- Build model predictions
python probability_model.py- Backtest historical performance
python backtest_polymarket.py- Launch monitoring dashboard (auto-refresh every 5 minutes)
streamlit run monitor_polymarket.py- Execute high-edge bets (optional/live risk)
python bet_executor.py- All scripts print progress updates and handle API retries.
bet_executor.pystops placing bets if daily realized losses exceed 20% of configured portfolio value.- News sentiment requires a valid NewsAPI key.
- Crypto signal in
data_collector.pyattempts to usecheckpoints/gbm_model.pklif available.