AI BOT
6 мин. чтения
🧠 What is the AI Bot in DEXBOT? #
AI Bot is an autonomous trading module inside the DEXBOT Telegram bot. An external large language model (LLM) analyzes the market and returns a single JSON decision: buy, sell, or hold. Unlike the classic trading bot (indicator signals) and the Grid bot (price grid), the AI Bot looks at market context: prices, candles, technical analysis, and your enabled indicators.
The AI Bot does not predict trends with 100% accuracy. The model’s answer is never executed directly — the code checks budget, hard cap, token whitelist, daily trade limit, drawdown stop, and stop-loss. Start with dry-run (no real trades), then enable live mode when you are ready.
The AI Bot is available on a license of 1 year or more. Without a valid license the menu is locked; if you still have open AI positions, the panic button is available to exit.
🔄 How the cycle works #
- Context gathering — prices, 6h/24h change, candles, TA panel (RSI, MACD, Bollinger…), your indicator signals
- LLM request — the active AI agent (Groq, NVIDIA NIM, OpenRouter, etc.) receives context and replies with JSON
- Validation — budget, cap, whitelist, trades/day limit, open positions are checked
- Execution — dry-run (log and stats only) or a real buy/sell on the network
- Pause — next cycle after the set interval (default 900 sec = 15 min)
The cycle repeats while the AI Bot is running (▶️ Start button) until a stop triggers (drawdown, panic, daily trade limit).
🔘 Statistics legend #
🟢 Green — buy
🔴 Red — sell
📌 — open AI position (token not sold yet)
🧪 — simulation (dry-run mode)
⚔️ — real trade (live mode)
⚙️ How it works #
- AI agent setup:
— Choose a provider (Groq, NVIDIA NIM, OpenRouter…)
— Enter your personal API key (stored encrypted)
— Test with «🔌 Test API» - Goals and budget:
— What to grow (USDC, ETH…)
— Which currency funds purchases
— Max amount — hard cap for all open AI positions - Network and tokens:
— One or more networks (e.g. base or op, arb)
— Token whitelist or “all enabled pairs” on the network - AI decision:
— The model analyzes the market and suggests buy / sell / hold
— The bot applies limits, then executes the trade - Safety:
— Daily trade limit
— Drawdown stop (% of max amount)
— Stop-loss: cut loss at % or hold until profitable (if SL is off)
📱 Main menu (Telegram: 🧠 AI BOT) #
The home screen shows: status (on/off), agent and key, model, goals, budget, max amount, networks, interval, limits, mode (dry / live), stop-loss, last API status.
- 🧠 AI agent — pick one provider (🔑 = key set)
- 🔑 Agent key — enter API key (message deleted after save)
- 🔌 Test API — connection and JSON response test
- 🧠 Model — custom model or provider default
- 🎯 Grow target — target currencies (USDC, ETH…)
- 💵 Budget — spend currency for buys (USDC, USDT…)
- 🛡️ Max amount — hard limit on open positions
- 📉 Trade size — AI decides or fixed % of max amount
- 🔗 Networks — blockchains for AI (comma-separated)
- 🎯 Allowed tokens — whitelist; empty = all enabled pairs on the network
- ⏱ Interval — how often AI decides (60–86400 sec)
- 📊 Daily limit — max trades per day
- 🛑 Stop-loss — on/off and percent
- 🔻 Drawdown stop — auto-stop when loss hits % of cap
- 📊 Statistics — PnL, positions, trade history
- 🚨 Panic button — sell all AI positions and stop the bot
- 🧪 / ⚔️ Mode — dry-run ↔ live (real trades)
- ▶️ / ⏹ Start / Stop — turn AI cycle on/off
🧠 AI agents (providers) #
- ⭐ Groq, NVIDIA NIM, OpenRouter — recommended to start (free tier, Llama 3.3 70B)
- Also: Mistral, Cerebras, Google Gemini, GitHub Models
- Paid: DeepSeek, OpenAI (GPT), Anthropic (Claude), xAI Grok, Perplexity
- Each has a default model and fallback models on API errors
- Your key is personal — create it in the provider’s dashboard
🎯 Grow target and 💵 Budget #
- 📈 Grow target — balance to increase (e.g. USDC). AI tries to grow it by trading alt tokens. Multiple targets allowed.
- 💵 Budget — currency spent on purchases (often same as target).
- 🛡️ Max amount — hard cap: total open AI positions will not exceed this value (default 30).
- 📉 Trade size — “AI decides” (within budget) or fixed % of max amount per buy.
🔗 Networks and 🎯 Allowed tokens #
- 🔗 Networks — blockchains for the AI Bot only. 🟢 = AI trades on this network. Multiple networks (op, arb) share the same budget and daily trade limit.
- 🎯 Allowed tokens — whitelist of symbols (WETH, CBBTC) or contract addresses. Empty list = all enabled trading pairs on the network. AI does not trade disabled pairs.
Enabling a network for the main trading bot is separate: Settings → select blockchain → ON/OFF.
⏱️ Interval and safety limits #
- ⏱️ Decision interval — how often AI makes a new request (default 900 sec). Shorter interval → more API calls and higher risk of 429 rate limits.
- 📊 Trades per day — protection against over-trading (default 20).
- 🔻 Drawdown stop — AI stops automatically when total loss reaches % of max amount (default 20%).
- 🛑 Stop-loss:
- 🔘 Off — losing positions are held until a profitable exit is possible
- 🟢 On — sell when loss reaches the set %
🧪 Dry-run and ⚔️ Live mode #
- 🔘 Dry-run (🧪):
AI makes decisions, keeps stats and history, but does not send transactions on-chain. Recommended for first setup and testing. - 🟢 Live mode (⚔️):
Real buys and sells via the network trading engine. Requires: DEXBOT running, network enabled, wallet keys, not in test mode.
⚠️ Before live mode, test dry-run for 1–2 days and start with a small max amount.
📊 Statistics #
📊 AI BOT — STATISTICS🎯 Goals: USDC💰 Summary (USDC)Spent: 45.20Earned: 48.10Realized PnL: +2.90Trades: 12 (today: 3)📌 Active positions— WETH@base: 0.012 · invested 28.50 USDC🕘 Recent trades🟢 2025-05-20 14:30 · buy WETH@base ~15.00 USDC🔴 2025-05-20 16:00 · sell WETH@base ~16.20 USDC
🚨 Panic button #
🚨 Panic button (sell all) — emergency exit:
- Shows all open AI positions: invested, current value, PnL (% and amount)
- Requires confirmation («Yes, sell all»)
- In live mode — immediate sale of all positions across networks
- After selling, the AI Bot stops automatically
- In dry-run, no real sale (report shows skipped)
Available even with an expired license if open AI positions remain.
🔔 Telegram notifications #
Path: Settings → Notifications → 🧠 AI bot
- AI trades — buys, sells, daily limit reached
- AI API — key errors, API failure streak, fallback model, 429 limit (interval increased)
Required: master notifications toggle ON. Recipients — admins from ADMIN_TELEGA_IDS in .env and/or chat IDs in notification settings.
💡 Recommendations #
- Start with Groq or NVIDIA NIM — free key in a few minutes
- Always tap «🔌 Test API» before starting
- Run dry-run for 1–2 days and review statistics
- In live mode — use a small max amount first
- Interval ≥ 15 minutes on free APIs (fewer 429 errors)
- Limit whitelist to liquid tokens
- Enable drawdown stop
- AI runs in parallel with trading and Grid bots — watch gas and USDC balance
✅ Advantages #
- Autonomous trading based on market data and your indicators
- Hard limits in code — the LLM advises, it does not “drive” alone
- Safe dry-run before real funds
- Your own API key and model choice
- Multiple networks and token whitelist
- Panic sell and drawdown stop
- Separate statistics and Telegram notifications
⚠️ Risks #
- Crypto trading involves risk of loss
- LLMs can be wrong — set a reasonable cap and daily trade limit
- Account for network fees and slippage
- Free APIs have request limits (429)
- Live mode = real funds on the blockchain