Skip to content

Commit dea88b8

Browse files
committed
add MetEngine smart money analytics with URL/slug resolution
1 parent 3ba646b commit dea88b8

10 files changed

Lines changed: 5833 additions & 172 deletions

File tree

Cargo.lock

Lines changed: 3462 additions & 171 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ path = "src/main.rs"
1515

1616
[dependencies]
1717
polymarket-client-sdk = { version = "0.4", features = ["gamma", "data", "bridge", "clob", "ctf"] }
18-
alloy = { version = "1.6.3", default-features = false, features = ["providers", "sol-types", "contract", "reqwest", "reqwest-rustls-tls", "signer-local", "signers"] }
18+
alloy = { version = ">=1.6.3,<1.7", default-features = false, features = ["providers", "sol-types", "contract", "reqwest", "reqwest-rustls-tls", "signer-local", "signers"] }
1919
clap = { version = "4", features = ["derive"] }
2020
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
2121
serde_json = "1"
@@ -26,6 +26,13 @@ anyhow = "1"
2626
chrono = "0.4"
2727
dirs = "6"
2828
rustyline = "15"
29+
reqwest = { version = "0.13", features = ["json", "rustls"], default-features = false }
30+
reqwest-middleware = { version = "0.5", features = ["json", "multipart"] }
31+
x402-reqwest = "1.3"
32+
x402-chain-solana = { version = "1.3", features = ["client"] }
33+
x402-types = "1.3"
34+
solana-keypair = "3.1"
35+
solana-client = "3.1"
2936

3037
[dev-dependencies]
3138
assert_cmd = "2"

README.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,131 @@ polymarket shell
406406

407407
Supports command history. All commands work the same as the CLI, just without the `polymarket` prefix.
408408

409+
### MetEngine (Smart Money Analytics)
410+
411+
Smart money analytics powered by [MetEngine](https://metengine.xyz). Uses the x402 payment protocol on Solana Mainnet -- no API keys, payment IS authentication. Each request is pay-per-use in USDC.
412+
413+
**Setup:**
414+
415+
```bash
416+
# Set your Solana private key (Base58 format)
417+
export METENGINE_SOLANA_KEY=<your-base58-private-key>
418+
419+
# Or pass it per-command
420+
polymarket --solana-key <your-base58-private-key> metengine trending
421+
422+
# Optional: use a private Solana RPC (recommended for heavy usage)
423+
export SOLANA_RPC_URL=https://your-rpc-endpoint.com
424+
```
425+
426+
The Solana wallet must hold USDC on Mainnet to pay for requests. Resolution order: `--solana-key` flag > `METENGINE_SOLANA_KEY` env > config file.
427+
428+
**Free endpoints (no wallet needed):**
429+
430+
```bash
431+
polymarket metengine health # API status
432+
polymarket metengine pricing # Endpoint pricing tiers
433+
```
434+
435+
**Market Discovery:**
436+
437+
```bash
438+
# Trending markets by volume spike, trade count, or smart money inflow
439+
polymarket metengine trending --timeframe 24h --sort-by volume_spike --limit 20
440+
441+
# Search markets
442+
polymarket metengine search "bitcoin" --status active --sort-by relevance
443+
444+
# Market categories with volume/trade stats
445+
polymarket metengine categories --timeframe 24h
446+
447+
# Platform-wide statistics
448+
polymarket metengine platform-stats --timeframe 7d
449+
450+
# OHLCV price history (accepts condition ID, slug, or Polymarket URL)
451+
polymarket metengine price-history 0xCONDITION_ID --timeframe 7d --bucket-size 1h
452+
polymarket metengine price-history https://polymarket.com/event/foo/bar-slug --timeframe 7d
453+
polymarket metengine price-history bar-slug --timeframe 7d
454+
455+
# Similar markets (overlapping traders)
456+
polymarket metengine similar 0xCONDITION_ID --limit 10
457+
458+
# Smart money opportunity scanner
459+
polymarket metengine opportunities --min-signal-strength moderate --min-smart-wallets 3
460+
461+
# Highest smart money conviction
462+
polymarket metengine high-conviction --min-smart-wallets 5 --min-avg-score 65
463+
464+
# Capital flow across categories
465+
polymarket metengine capital-flow --timeframe 7d --smart-money-only
466+
467+
# Volume heatmap
468+
polymarket metengine volume-heatmap --timeframe 24h --group-by category
469+
470+
# Recently resolved markets with smart money accuracy
471+
polymarket metengine resolutions --sort-by smart_money_accuracy --limit 25
472+
473+
# Dumb money positions (low-score traders)
474+
polymarket metengine dumb-money 0xCONDITION_ID --max-score 30
475+
```
476+
477+
**Intelligence & Trades:**
478+
479+
```bash
480+
# Deep smart money intelligence (accepts condition ID, slug, or URL)
481+
polymarket metengine intelligence 0xCONDITION_ID --top-n-wallets 10
482+
polymarket metengine intelligence https://polymarket.com/event/foo/bar-slug
483+
484+
# Sentiment over time
485+
polymarket metengine sentiment 0xCONDITION_ID --timeframe 7d --bucket-size 4h
486+
487+
# Participant breakdown by tier
488+
polymarket metengine participants 0xCONDITION_ID
489+
490+
# Insider detection on a market
491+
polymarket metengine insiders 0xCONDITION_ID --min-score 20
492+
493+
# Recent trades (filterable)
494+
polymarket metengine trades 0xCONDITION_ID --timeframe 24h --smart-money-only
495+
496+
# Whale trades across all markets (--market accepts condition ID, slug, or URL)
497+
polymarket metengine whale-trades --min-usdc 10000 --timeframe 24h
498+
polymarket metengine whale-trades --market https://polymarket.com/event/foo/bar-slug
499+
500+
# Wallets that called outcomes early
501+
polymarket metengine alpha-callers --days-back 30 --min-days-early 7 --min-bet-usdc 100
502+
503+
# Platform-wide insider detection
504+
polymarket metengine wallet-insiders --min-score 50 --limit 50
505+
```
506+
507+
**Wallet Analytics:**
508+
509+
```bash
510+
# Full wallet profile (score, stats, positions)
511+
polymarket metengine wallet-profile 0xWALLET
512+
513+
# Recent trading activity
514+
polymarket metengine wallet-activity 0xWALLET --timeframe 24h
515+
516+
# PnL breakdown by position
517+
polymarket metengine wallet-pnl 0xWALLET --timeframe 90d
518+
519+
# Compare 2-5 wallets side by side
520+
polymarket metengine wallet-compare "0xWALLET1,0xWALLET2"
521+
522+
# Find copy-traders of a wallet
523+
polymarket metengine copy-traders 0xWALLET --max-lag-minutes 60
524+
525+
# Top performing wallets leaderboard
526+
polymarket metengine top-performers --timeframe 7d --metric pnl --limit 25
527+
528+
# Category specialists
529+
polymarket metengine niche-experts "crypto" --min-category-trades 10 --sort-by category_sharpe
530+
```
531+
532+
All MetEngine commands support `--output table` (default) and `--output json`.
533+
409534
### Other
410535

411536
```bash
@@ -461,6 +586,24 @@ polymarket clob cancel ORDER_ID
461586
polymarket clob cancel-all
462587
```
463588

589+
### Research with smart money analytics
590+
591+
```bash
592+
# Find trending markets with smart money activity
593+
polymarket metengine trending --timeframe 24h --sort-by smart_money_inflow
594+
595+
# Deep-dive into a specific market (use condition ID, slug, or full URL)
596+
polymarket metengine intelligence 0xCONDITION_ID
597+
polymarket metengine sentiment https://polymarket.com/event/foo/bar-slug --timeframe 7d
598+
599+
# Check who's trading it
600+
polymarket metengine whale-trades --market 0xCONDITION_ID --timeframe 24h
601+
602+
# Profile a smart wallet
603+
polymarket metengine wallet-profile 0xWALLET
604+
polymarket metengine wallet-pnl 0xWALLET --timeframe 90d
605+
```
606+
464607
### Script with JSON output
465608

466609
```bash
@@ -483,6 +626,7 @@ src/
483626
main.rs -- CLI entry point, clap parsing, error handling
484627
auth.rs -- Wallet resolution, RPC provider, CLOB authentication
485628
config.rs -- Config file (~/.config/polymarket/config.json)
629+
metengine.rs -- x402 HTTP client (FreeClient + PaidClient with Solana signing)
486630
shell.rs -- Interactive REPL
487631
commands/ -- One module per command group
488632
output/ -- Table and JSON rendering per command group

0 commit comments

Comments
 (0)