Grok × Polymarket 4-Step Multi-Agent Trading Desk: SCAN · VERIFY · EXECUTE · EXIT Pipeline That Filters Out 90% of Bad Trades
The best agent on a quantitative trading desk has never placed a trade — its entire job is to say NO. Learn how to replace fragile single-prompt FOMO bots with an institutional 4-Agent Desk (SCAN -> VERIFY -> EXECUTE -> EXIT) for Polymarket CLOB & crypto markets: run free deterministic code filters first, invoke Grok `x_search` only on survivors, size off live cash + pool depth, and enforce 5 pre-written exit rules (`exits.py`) with full `tasks.csv` skip auditing.
3-मिनट का शुरुआती प्री-फ्लाइट चेकलिस्ट (Pre-Flight Checklist)
- ✓An xAI Grok API Key from console.x.ai (with
x_searchकॉपी enabled for live X sentiment and fake-news verification) - ✓A dedicated Polymarket sub-wallet via https://poly.market/p-day (run
PAPER = Trueकॉपी for the first 7 days before touching live funds) - ✓A Linux VPS (e.g., RAKsmart) where API keys are written via
read -rsकॉपी into achmod 600 .envकॉपी file, never pasted into chat logs
कभी भी होम लैपटॉप पर लाइव ट्रेडिंग बॉट चलाएं नहीं जो स्लीप मोड में जाए या Wi-Fi का कनेक्शन टूट जाए! हम RAKsmart Cloud VPS की सलाह देते हैं: (1) OKX/Binance और Polygon RPC के लिए अत्यंत कम मिलीसेकंड लेटेंसी के लिए Tokyo, Singapore, या Silicon Valley चुनें; (2) Docker Compose के लिए Ubuntu 22.04 LTS (2 vCPU / 4GB RAM) चुनें; (3) अपने एक्सचेंज API व्हाइटलिस्ट के अपने डिडिकेटेड स्टैटिक IPv4 एड्रेस को बाइंड करें।
क्या आपने अभी-अभी VPS खरीदा है? Windows / Mac पर SSH के माध्यम से कैसे कनेक्ट करें और कमांड चलाएं (3-मिनट गाइड)
कई नए उपयोगकर्ते क्लाउड सर्वर खरीदने के तुरंत बाद अटक जाते हैं: 'मैं इन टर्मिनल कमांड्स को कहाँ टाइप करूँ?' इन 5 सरल चरणों का पालन करें:
• सर्वर IPv4 पता (जैसे,
198.51.100.88कॉपी)• SSH पोर्ट: आमतौर पर
22कॉपी होता है, या आपके पैनल में दिखाए गए कोई कस्टम सिक्योरिटी पोर्ट जैसे 22022कॉपी / 62134कॉपी• यूज़रनेम: Ubuntu पर यह हमेशा
rootकॉपी होता है• रूट पासवर्ड: आपका प्रारंभिक सर्वर पासवर्ड
powershellकॉपी टाइप करें और Enter दबाएँ।• Mac पर: Command ⌘ + Space दबाएँ,
Terminalकॉपी टाइप करें और Enter दबाएँ।ssh -p PORT root@SERVER_IPकॉपी चलाएँ (ध्यान दें कि -pकॉपी लोअरकेस में है; कस्टम पोर्ट छोड़ने से Connection refusedकॉपी हो जाता है):• स्टैंडर्ड पोर्ट 22:
ssh -p 22 root@198.51.100.88कॉपी• कस्टम SSH पोर्ट (जैसे
62134कॉपी): ssh -p 62134 root@198.51.100.88कॉपीAre you sure you want to continue connecting (yes/no)?कॉपी पूछा जाए, पूरा शब्द yesकॉपी टाइप करें और Enter दबाएँ।• प्रॉम्प्ट 2 ([!] जब मैं अपना पासवर्ड टाइप करता हूँ तो カーसर क्यों नहीं हिलता?!): जब
password:कॉपी पूछा जाता है, सुरक्षा के लिए Linux सभी अक्षरों को छुपा देता है (न तो * अस्केरिक्स दिखते हैं)! बस पासवर्ड को अदृश्य रूप से पेस्ट करने के लिए PowerShell में राइट-क्लिक करें (या Mac पर Cmd + Vकॉपी दबाएँ), फिर Enter दबाएँ!root@ubuntu:~#कॉपी में बदल जाते हैं, तो आप अपने क्लाउड सर्वर के अंदर हैं! Docker, Git, और Python इंस्टॉल करने के लिए ये सेटअप कमांड एक बार पेस्ट करें:docker compose ...कॉपी कमांड के लिए: बस अपने SSH विंडो में पेस्ट करने के लिए राइट-क्लिक करें और Enter दबाएँ।• Python (
.pyकॉपी) स्क्रिप्ट्स के लिए: nano bot.pyकॉपी टाइप करें और Enter दबाएँ → कोड पेस्ट करने के लिए राइट-क्लिक करें → सेव करने के लिए Ctrl + O दबाएँ और फिर Enter दबाएँ → बाहर जाने के लिए Ctrl + X दबाएँ → चलाएँ nohup python3 bot.py > bot.log 2>&1 &कॉपी ताकि आपका बॉट आपके लैपटॉप बंद करने के बाद भी 24/7 चलता रहे!# 1. Update Ubuntu packages and install Git, Curl, and Python3
apt update -y && apt install -y curl git python3-pip python3-venv
# 2. One-line official Docker & Docker Compose installation
curl -fsSL https://get.docker.com | sh && systemctl enable --now docker
# 3. Verify Docker Compose is ready
docker compose version
# ==============================================================================
# poly_grok_desk.py — 4-Agent Quantitative Trading Desk (SCAN·VERIFY·EXECUTE·EXIT)
# Philosophy: "The best agent on a trading desk has never placed a trade.
# Its whole job is to say NO."
# Safe Setup (Never echo API keys into terminal history):
# mkdir -p /workspace/desk && cd /workspace/desk
# read -rs -p "xai key: " K && printf 'XAI_API_KEY=%s\n' "$K" > .env && unset K
# chmod 600 .env
# ==============================================================================
import csv, json, os, time
from collections import Counter
# 1. CONFIG (You edit this file. The bot NEVER edits config constants itself.)
MODEL = "grok-4.7"
PAPER = True # Paper mode first: real orderbooks, real prices, simulated fills
START_BALANCE = 1000.0 # Dedicated sub-wallet bankroll ($1,000 USDC)
SCANNERS = ["SCAN-1", "SCAN-2", "SCAN-3", "SCAN-4"]
LEADS_PER_RUN = 12 # Cap per 5-min run so a busy minute never burns API budget
SKIP_IF = {
"min_liquidity_usd": 50_000, # Pool liquidity < $50k -> instant free SKIP
"max_spread_cents": 2.2, # Bid-Ask spread > 2.2¢ -> instant free SKIP
"min_age_min": 30, # Market too fresh / unindexed -> SKIP
"max_hours_to_resolve": 168, # Capital efficiency: skip dead-money > 7 days out
"max_ticket_share": 0.01, # Your order size is NEVER > 1% of orderbook liquidity
}
MIN_X_CONFIDENCE = 0.72 # Grok x_search confidence below 0.72 -> SKIP
SIZE_PCT = 0.15 # Bet 15% of current available cash (capped at $200 & 1% of pool)
MIN_TICKET, MAX_TICKET = 20.0, 200.0
MAX_OPEN = 5 # Max 5 concurrent slots (5 × $200 = $1,000)
SESSION_LOSS_HALT_PCT = 15.0 # Circuit breaker: down 15% from session start -> halt new entries
EXIT = {
"hard_stop_pct": -18.0, # Price drops 18% -> exit 100% immediately
"ladder": [(15.0, 0.50), (35.0, 0.50)], # Take profit ladder: +15% sells half, +35% sells rest
"trail_pct": 12.0, # After first take: exit if price pulls back 12% from peak
"time_stop_min": 720, # 12h flat (< +2%) -> free the slot ("Dead money is a loss")
"time_stop_min_pct": 2.0,
"liq_drop_pct": 40.0, # Orderbook depth drops 40% since entry -> exit 100% now
}
# 2. VERIFY STEP: Free Deterministic Code Checks FIRST, Paid Grok X-Read LAST
X_READ_PROMPT = """
You are VERIFY, the final gatekeeper on a Polymarket quantitative desk.
This market already passed all hard code checks (liquidity >= $50k, tight spread, valid window).
Search X (Twitter) for the event and audit the UMA Resolution Rules. Judge ONLY what code cannot see:
1. Ambiguous / subjective UMA resolution criteria (wordplay risk or disputed oracle source)
2. Coordinated bot hype on X (dozens of fresh accounts posting identical fake breaking news)
3. Whether the official primary source (Fed / AP / League scoreboard) has actually confirmed
RETURN ONLY JSON: {"verdict": "GO" | "SKIP", "confidence": 0.0-1.0, "why": "one concise line"}
Unsure is SKIP. Anything not valid JSON is SKIP.
"""
def hard_skip(f: dict) -> str | None:
"""Facts are code. A missing field is ALWAYS a skip, never a guess."""
req = ["price", "liq_usd", "spread_cents", "age_min", "hours_to_resolve", "uma_disputed"]
if any(f.get(k) is None for k in req): return "missing_data"
if f["uma_disputed"]: return "uma_dispute_active"
if f["liq_usd"] < SKIP_IF["min_liquidity_usd"]: return "thin_liquidity"
if f["spread_cents"] > SKIP_IF["max_spread_cents"]: return "wide_spread"
if f["age_min"] < SKIP_IF["min_age_min"]: return "too_fresh"
if f["hours_to_resolve"] > SKIP_IF["max_hours_to_resolve"]: return "dead_money_horizon"
return None
def size_order(cash_usdc: float, liq_usd: float) -> float:
"""Sized off the balance you have NOW + capped at 1% of pool depth."""
usd = cash_usdc * SIZE_PCT
usd = min(max(usd, MIN_TICKET), MAX_TICKET, liq_usd * SKIP_IF["max_ticket_share"])
return round(usd, 2)
# 3. EXIT STEP: Written BEFORE Entry (Runs every 5 minutes on all open positions)
def evaluate_exit(pos: dict, cur_price: float, cur_liq: float, now_ts: float) -> tuple[float, str] | None:
if cur_price <= 0:
return (1.0, "market_halted")
peak = max(pos["peak"], cur_price)
pct = (cur_price / pos["entry"] - 1.0) * 100.0
age_min = (now_ts - pos["opened_ts"]) / 60.0
if cur_liq < pos["liq0"] * (1.0 - EXIT["liq_drop_pct"] / 100.0):
return (1.0, "liquidity_pulled_40pct")
if pct <= EXIT["hard_stop_pct"]:
return (1.0, "hard_stop")
if pos["steps"] < len(EXIT["ladder"]):
target_pct, frac = EXIT["ladder"][pos["steps"]]
if pct >= target_pct:
return (frac, f"take_profit_+{target_pct:.0f}pct")
if pos["steps"] > 0 and cur_price <= peak * (1.0 - EXIT["trail_pct"] / 100.0):
return (1.0, "trailing_stop_from_peak")
if pos["steps"] == 0 and age_min >= EXIT["time_stop_min"] and pct < EXIT["time_stop_min_pct"]:
return (1.0, "time_stop_dead_money")
return None
if __name__ == "__main__":
sample_lead = {"slug": "fed-cuts-25bps-nov", "price": 0.984, "liq_usd": 420_000,
"spread_cents": 0.4, "age_min": 1440, "hours_to_resolve": 18, "uma_disputed": False}
skip_reason = hard_skip(sample_lead)
ticket_usdc = size_order(1000.0, sample_lead["liq_usd"]) if not skip_reason else 0.0
print(f"[VERIFY] hard_skip={skip_reason} -> Survivor sent to Grok X-Read | Ticket=${ticket_usdc} USDC")
लाइन-बाई-लाइन सरल हिंदी में कोड और कमांड का विवरण
| कोड / कमांड लाइन | सरल हिंदी में विवरण (इसका क्या काम है?) |
|---|---|
read -rs -p "xai key: " K && printf 'XAI_API_KEY=%s\n' "$K" > .env && unset K
|
Zero-echo secret injection: writes your xAI key into .envकॉपी without echoing to terminal history or AI chat transcripts. |
SKIP_IF = {"min_liquidity_usd": 50_000, "max_spread_cents": 2.2, ...}
|
Hard deterministic filter thresholds that kill 90%+ of low-quality markets for free before calling Grok. |
def hard_skip(f: dict) -> str | None:
|
Enforces 'facts before opinions' — any missing field or thin orderbook returns a final SKIPकॉपी. |
usd = min(max(usd, MIN_TICKET), MAX_TICKET, liq_usd * SKIP_IF["max_ticket_share"])
|
Sizes each survivor off current cash while capping exposure at $200 and 1% of orderbook liquidity. |
if cur_liq < pos["liq0"] * (1.0 - EXIT["liq_drop_pct"] / 100.0): return (1.0, "liquidity_pulled_40pct")
|
Pre-written exit trigger: dumps 100% of the position immediately if orderbook depth drops 40% from entry. |
if pos["steps"] == 0 and age_min >= EXIT["time_stop_min"] and pct < EXIT["time_stop_min_pct"]:
|
Time-stop exit: frees the slot if a position stays flat for 12 hours ('Dead money is a loss too'). |
[!] शुरुआती लोगों के लिए टॉप 3 गड्ढे और समस्या-निवारण गाइड
✕ Pitfall 1: Sending Every Raw Scanner Lead Directly to Grok x_searchकॉपी
The bill must scale with survivors, not with leads. Always run free hard_skip()कॉपी checks first so 90% of bad markets die for free.
✕ Pitfall 2: Letting the Bot Edit config.pyकॉपी Risk Constants on Its Own
Only humans edit config.pyकॉपी. Never let an autonomous routine widen stop-losses or raise MAX_TICKETकॉपी.
✕ Pitfall 3: Re-Running a Rejected Market Until the LLM Says GOकॉपी
A skip is final. Re-prompting VERIFY to get the answer you want turns your desk back into FOMO with an API key.
Part 1: Why Single-Prompt Bots Fail — Replace FOMO with a 4-Agent Trading Desk
Everyone's first bot is the same: one agent, one prompt ('find a market, check news, buy, sell the top'). That's not a quantitative agent — that's your FOMO with an API key. A real trading desk splits every trade into four strict roles inside one codebase: SCANकॉपी (finds leads from Polymarket Gamma / whale wallets without opinions), VERIFYकॉपी (whose default answer is SKIPकॉपी), EXECUTEकॉपी (sizes survivors off current cash and pool depth), and EXITकॉपी (enforces pre-written stops and ladders).
Part 2: Funnel Economics — Free Deterministic Code Skips First, Paid Grok x_searchकॉपी Last
Your AI API bill should scale with survivors, not with leads. In verify.pyकॉपी, hard_skip()कॉपी runs free deterministic checks first (liquidity < $50k, spread > 2.2¢, missing fields -> instant SKIPकॉपी). Only the 5% of leads that survive every hard rule trigger a Grok API call with x_searchकॉपी enabled to check for coordinated X bot hype or ambiguous UMA Resolution Rules.
Part 3: Write the Exit Before the Entry (exits.pyकॉपी) — Dead Money Is a Loss Too
Most retail traders decide when to sell while staring at a green or red candle. On this desk, five exit triggers exist before entry: 40% liquidity drop pull-out, hard stop, stepped profit ladder, peak trailing stop, and a time stop that frees flat capital slots.
Want built-in trailing stops and automated grid ladders without coding? Use Pionex's 16 Free Cloud AI Trading Bots ↗.
Part 4: Auditing tasks.csvकॉपी vs trades.csvकॉपी, Zero-Echo Key Setup & Paper-to-Live Fences
Deploy on an isolated RAKsmart Linux VPS ↗, inject keys via read -rsकॉपी into a chmod 600 .envकॉपी file so secrets never land in chat transcripts, run PAPER = Trueकॉपी for 7 days on Polymarket ↗, and verify that tasks.csvकॉपी logs 90%+ skips before enabling live execution.
Headline Quant Guides Directory (With Reading Level, Time & Code Stack)
Start from L1 Beginner Essentials and progress to L4 Institutional Tick Backtesting. Every guide includes reading difficulty, estimated reading time, and production-ready code:
Beginner $1,000 Quant Starter Combo Deep-Dive: How Much Can You Earn Monthly Running Polymarket Penny Clipper & LP Bots?
Complete quantitative breakdown for first-time algorithmic traders starting with $1,000 USDC: ranking all 4 Polymarket open-source bot strategies by risk-adjusted edge, modeling 3 realistic monthly profit tiers ($60–$180/mo or 6%–18% monthly ROI) using 5×$200 position splitting, and enforcing the 3 iron survival rules.
Pionex Cloud AI Bots vs. Self-Hosted Polymarket Bots (CloddsBot / Grok Desk): 6 Key Differences & Dual-Engine Allocation Guide
Both are called 'quant trading bots,' yet Pionex's 16 built-in cloud bots and self-hosted open-source Polymarket bots (`CloddsBot`, `polymarket_lp_tool`, `Grok 4-Step Desk`) operate on completely different market mechanics. Pionex harvests crypto volatility and perpetual funding rates with zero code and massive liquidity capacity, while self-hosted Polymarket bots snipe $1.00 deterministic event settlement discounts and Daily LP Rewards with zero correlation to Bitcoin price swings.
Pionex AI Quantitative Trading Complete Guide: 16 Free Built-In Grid Bots, Funding-Rate Arbitrage & Polymarket Delta Hedging
Don't want to maintain a Linux VPS? Master Pionex's 16 free built-in AI trading bots (PionexGPT strategy generator, AI Infinity Grid, Spot-Futures Funding Rate Arbitrage, and 0.05% maker/taker fees) and learn how to pair Pionex BTC/ETH grids with Polymarket event tail-hedges.
CloddsBot & Polymarket LP Bot Complete Guide: Deploy 119-Skill AI Arbitrage, Penny Clipper & Daily Liquidity Rewards Bots
Why pay $5,000+ for black-box bots when the best Polymarket trading engines are MIT open-source on GitHub? Full deployment guide to `alsk1992/CloddsBot` (3.1k⭐, 119+ skills including cross-market arbitrage, Penny Clipper expiry decay, and smart-money copy trading) and `lihanyu81/polymarket_lp_tool` (passive LP market-making for daily USDC rewards).
Grok × Polymarket 4-Step Multi-Agent Trading Desk: SCAN · VERIFY · EXECUTE · EXIT Pipeline That Filters Out 90% of Bad Trades
The best agent on a quantitative trading desk has never placed a trade — its entire job is to say NO. Learn how to replace fragile single-prompt FOMO bots with an institutional 4-Agent Desk (SCAN -> VERIFY -> EXECUTE -> EXIT) for Polymarket CLOB & crypto markets: run free deterministic code filters first, invoke Grok `x_search` only on survivors, size off live cash + pool depth, and enforce 5 pre-written exit rules (`exits.py`) with full `tasks.csv` skip auditing.
Polymarket CLOB Quant गाइड: py-clob-client के साथ 0%-शुल्क Maker और व्हेल कॉपी-ट्रेडिंग बॉट डेप्लॉय करें
पूरा इंजीनियरिंग वॉकथ्रू: Polygon L2 CLOB क्रेडेंशियल्स निकालें, Gamma condition टोकन आईडीज की क्वेरी करें, व्हेल फिल्स की सदस्यता लें, और गैसलेस 0%-शुल्क EIP-712 लिमिट ऑर्डर लगाएं।
क्वांट VPS सुरक्षा, API IP व्हाइटलिस्टिंग और हार्ड ड्रॉडाउन किल-स्विच इंजीनियरिंग गाइड
क्वांट ट्रेडर्स के लिए प्रोडक्शन सुरक्षा चेकलिस्ट: लो-लेटेन्सी VPS चयन, एक्सचेंज API IP व्हाइटलिस्टिंग, विथड्रॉल-डिसेबल्ड कीज़, और ऑटोमेटेड 5% दैनिक ड्रॉडाउन किल-स्विच।
AI LLM संभाव्यता कॅलिब्रेशन + अर्धा-केली साइज़िंग: +EV ऑर्डर्स के लिए डीपसीक / ओपनएआई / ओलामा API इंटीग्रेशन का चरण-दर-चरण मार्गदर्शन
ब्रेकिंग न्यूज़ को स्ट्रक्चर्ड बेयनियन लाइक्लीहूड अनुपातों और अर्धा-केली पोज़ीशन साइज़ में परिवर्तित करने के लिए पाइथन के माध्यम से डीपसीक, ओपनएआई GPT-4o या लोकल ओलामा LLM को जोड़ने का पूर्ण चरण-दर-चरण मार्गदर्शन।
Freqtrade + FreqAI Docker ट्यूटोरियल: OKX / Binance से कनेक्ट करें, ऐतिहासिक डेटा डाउनलोड करें और Lookahead Bias का ऑडिट करें
Docker Compose के माध्यम से Freqtrade को डेप्लॉय करने, बहु-वर्षीय OKX और Binance OHLCV डेटा डाउनलोड करने, यथार्थवादी शुल्क-संायोजित बैकटेस्ट चलाने, और `lookahead-analysis` चलाने की कदम-दर-कदम गाइड।
Hummingbot मार्केट मेकिंग और डेल्टा-हेजिंग गाइड: Polymarket के ऑड्स बनाम OKX / Binance परप्स का आर्बिट्रेज कैसे करें
संस्थानिक डेस्क Hummingbot V2 मार्केट-मेकिंग कंट्रोलर्स को OKX/Binance पर Polymarket इवेंट कॉन्ट्राक्ट्स के साथ कैसे जोड़कर डेल्टा-न्यूट्रल मैक्रो वोलैटिलिटी हेज बनाते हैं।
NautilusTrader L2 ऑर्डरबुक बैकटेस्टिंग गाइड: स्लिपेज के भ्रम और क्यू-पोज़िशन बैस को खत्म करें
NautilusTrader में कैसे रियलिस्टिक क्यू-पोज़िशन फिल्स, लेटेन्सी मोडलिंग और वॉक-फॉरवर्ड वैलिडेशन के साथ हाई-फाइडेलिटी L2 ऑर्डरबुक टिक बैकटेस्ट चलाएं।
Poly Day (p.day) — Polymarket India गाइड: What is Polymarket, Is Polymarket Legal in India & Prediction Market Live Odds
Polymarket India लाइव ऑड्स, 'Is Polymarket legal in India', क्या है पॉलीमार्केट, और Binance P2P से Polygon USDC डिपॉज़िट
भारतीय क्रिप्टो और स्पोर्ट्स ट्रेडर्स के बीच «Polymarket India», «is Polymarket legal in India», «what is Polymarket» और «Polymarket app» सबसे तेज़ी से ट्रेंड करने वाले कीवर्ड हैं। पॉलीमार्केट (Polymarket) पॉलीगॉन (Polygon) ब्लॉकचेन पर चलने वाला दुनिया का सबसे बड़ा विकेंद्रीकृत प्रेडिक्शन मार्केट है, जहाँ क्रिकेट (IPL / ICC T20), अमेरिकी व भारतीय राजनीति, फेडरल रिज़र्व और बिटकॉइन पर 1¢ से 99¢ के बीच वास्तविक USDC तरलता के साथ ट्रेडिंग होती है।
Poly Day India (p.day/hi/) पर आप बिना किसी रुकावट के सभी लाइव पॉलीमार्केट ऑड्स (Polymarket Analytics), स्मार्ट-मनी व्हेल वॉलेट सिग्नल और Binance P2P / CoinDCX के ज़रिए INR से Polygon USDC ट्रांसफर करने की पूरी प्रक्रिया हिंदी में देख सकते हैं।