polymarket-browse: add --search, --telegram, --matches-only, --non-matches-only flags; fix partial fetch warnings; clean up output formatting
This commit is contained in:
@@ -12,73 +12,74 @@ Browse tradeable Polymarket prediction market events by game category.
|
||||
|
||||
**For Hermes Agent users:**
|
||||
```bash
|
||||
hermes skills install https://git.fbrns.co/shoko/jujutsu-skills#polymarket-browse
|
||||
hermes skills install https://github.com/shokollm/jujutsu-skills#polymarket-browse
|
||||
```
|
||||
|
||||
**For OpenClaw users:**
|
||||
```bash
|
||||
# Clone the repo
|
||||
git clone https://git.fbrns.co/shoko/jujutsu-skills.git ~/jujutsu-skills
|
||||
git clone https://github.com/shokollm/jujutsu-skills.git ~/jujutsu-skills
|
||||
|
||||
# Copy skill to your OpenClaw skills folder
|
||||
cp -r ~/jujutsu-skills/skills/polymarket-browse ~/.openclaw/skills/
|
||||
```
|
||||
|
||||
**Manual installation:**
|
||||
**Optional: For better experience, install the Polymarket MCP server:**
|
||||
This lets the agent answer questions about Polymarket markets, rules, and trading mechanics.
|
||||
```bash
|
||||
# Clone the repo
|
||||
git clone https://git.fbrns.co/shoko/jujutsu-skills.git ~/jujutsu-skills
|
||||
|
||||
# Copy skill to your Hermes skills folder
|
||||
cp -r ~/jujutsu-skills/skills/polymarket-browse ~/.hermes/skills/
|
||||
# Ask your agent to install it for you, or add to config.yaml:
|
||||
hermes mcp add polymarket https://docs.polymarket.com/mcp
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
polymarket-browse [--category "Counter Strike"] [--limit 5] [--detail N]
|
||||
polymarket-browse [--category "Counter Strike"] [--limit 5] [--matches N] [--non-matches N] [--search "TeamName"] [--matches-only] [--non-matches-only] [--detail N] [--raw] [--telegram]
|
||||
```
|
||||
|
||||
## Arguments
|
||||
|
||||
- `--category` : Game category to browse. Options: All Esports, Counter Strike, League of Legends, Dota 2, Valorant, NBA, NFL, UFC, Tennis (default: Counter Strike)
|
||||
- `--limit` : Max number of events to show (default: 5)
|
||||
- `--detail` : Index of event (1-indexed) to show detailed markets for. Defaults to 1 (first event). Set to 0 to disable.
|
||||
- `--limit` : Max events per section (match + non-match). Default: 5
|
||||
- `--matches` : Max match markets to show. Default: --limit
|
||||
- `--non-matches` : Max non-match markets to show. Default: --limit
|
||||
- `--search` : Free-text team/term search within the selected category. Appends to the category query. Example: `--category "Counter Strike" --search "FlyQuest"`
|
||||
- `--matches-only` : Show only match markets (suppress non-match section).
|
||||
- `--non-matches-only` : Show only non-match markets (suppress match section).
|
||||
- `--detail` : Index of match event (1-indexed) to show detailed markets. Default: 1. Set to 0 to disable.
|
||||
- `--list-categories` : List available game categories and exit
|
||||
- `--raw` : Show all events without tradeable filter (for debugging). Includes fetch stats.
|
||||
- `--telegram` : Send results to Telegram. Requires `BOT_TOKEN` and `CHAT_ID` in environment variables.
|
||||
|
||||
## Output Format
|
||||
|
||||
Each event displays in a **6-line format**:
|
||||
Output is split into two sections:
|
||||
|
||||
```
|
||||
=== DOTA 2 ===
|
||||
Query: 'Dota2' | Total API: 54 | Tradeable: 3
|
||||
Current time (WIB): 13:58 WIB | Mar 24, 2026
|
||||
=== COUNTER STRIKE ===
|
||||
Current time (WIB): 17:00 WIB | Mar 24, 2026
|
||||
|
||||
1. [Dota 2: Yakult Brothers vs BetBoom Team (BO2)](https://polymarket.com/market/...)
|
||||
Mar 24, 19:00 WIB | In 5h
|
||||
MATCH MARKETS
|
||||
|
||||
Vol: $4,952
|
||||
Tournament: ESL One Birmingham Group A
|
||||
Odds: Yakult Brothers 29c | 71c BetBoom Team
|
||||
1. [Counter-Strike: TheMongolz vs Spirit (BO3)](https://polymarket.com/market/...)
|
||||
Mar 24, 03:45 WIB | LIVE
|
||||
Vol: $2,626,029
|
||||
Tournament: BLAST Open Rotterdam Group B
|
||||
Odds: TheMongolz 100c | 0c Spirit
|
||||
|
||||
2. [Dota 2: GamerLegion vs Team Yandex (BO2)](https://polymarket.com/market/...)
|
||||
Mar 24, 19:00 WIB | In 5h
|
||||
NON-MATCH MARKETS
|
||||
|
||||
Vol: $3,944
|
||||
Tournament: ESL One Birmingham Group A
|
||||
Odds: GamerLegion 28c | 72c Team Yandex
|
||||
1. [Blast Open Rotterdam 2026: Winner](https://polymarket.com/event/...)
|
||||
Feb 28, 04:43 WIB | 24d ago
|
||||
Markets: 17 | Total Vol: $958,116
|
||||
```
|
||||
|
||||
Format per event:
|
||||
- **Line 1**: `[number]. [Title](url)` — title without tournament name
|
||||
- **Line 2**: `Date, Time WIB | Relative` (e.g., "Mar 24, 19:00 WIB | In 5h")
|
||||
- **Line 3**: (empty separator)
|
||||
- **Line 4**: `Vol: $XXX`
|
||||
- **Line 5**: `Tournament: [tournament name]`
|
||||
- **Line 6**: `Odds: [Team A] [Odds A] | [Odds B] [Team B]`
|
||||
**Match Markets** are actual head-to-head matches with moneyline odds (sorted by volume).
|
||||
**Non-match Markets** are tournament futures, props, and other markets without direct match odds.
|
||||
|
||||
Time shows in WIB (UTC+7 for Indonesian users). Relative time shows "In Xh", "Xd ago", or "LIVE".
|
||||
Stats line (Fetched / Total / Match counts) only shown when `--raw` flag is used.
|
||||
|
||||
If a fetch is interrupted (API error/timeout), a `WARNING: Partial fetch` line appears showing data may be incomplete.
|
||||
|
||||
## Game Categories
|
||||
|
||||
@@ -96,7 +97,13 @@ Time shows in WIB (UTC+7 for Indonesian users). Relative time shows "In Xh", "Xd
|
||||
|
||||
## Filters Applied
|
||||
|
||||
Events are filtered to show only **tradeable** matches:
|
||||
The script classifies every event into one of two categories:
|
||||
|
||||
**Match Markets**: Events that are actual head-to-head matches (have `seriesSlug` + `gameId`, OR title contains " vs ").
|
||||
|
||||
**Non-match Markets**: Everything else — tournament futures, prop bets, player props, etc.
|
||||
|
||||
Tradeable match markets additionally require:
|
||||
- Must have seriesSlug + gameId (actual match, not tournament future)
|
||||
- ML volume > 0
|
||||
- acceptingOrders = true
|
||||
@@ -105,22 +112,19 @@ Events are filtered to show only **tradeable** matches:
|
||||
- ML bestAsk > 0.01 (market hasn't converged toward underdog)
|
||||
- BO2 matches that ended in a tie (1-1) are filtered out
|
||||
- Event endDate has not passed (API doesn't always close ML market promptly)
|
||||
- Match startTime is not more than 4 hours in the past (matches that already ended are filtered out)
|
||||
|
||||
Markets are filtered to only tradeable ones:
|
||||
- acceptingOrders = true
|
||||
- bestBid < 0.99
|
||||
- bestAsk > 0.01
|
||||
- closed = false
|
||||
Use `--raw` to disable the tradeable filter and see all match markets regardless of volume or open orders.
|
||||
|
||||
## Pagination
|
||||
|
||||
The script fetches **ALL pages** until the API runs out of results (up to 100 pages as a safety cap).
|
||||
|
||||
## Rate Limiting
|
||||
|
||||
- Exponential backoff: 2s → 4s → 8s → 16s → 32s
|
||||
- Max 5 retries before aborting
|
||||
|
||||
## Known Issues
|
||||
|
||||
- **BO2 matches that end in a tie (1-1)**: Filtered out by checking if all child_moneyline markets are closed.
|
||||
|
||||
## Odds Format
|
||||
|
||||
All odds are shown in **cents** format:
|
||||
|
||||
Reference in New Issue
Block a user