← Chat Archive

Share:
Bot Review for New Bot Build
2026-04-24T16:58:14 7 messages 8e246d63-d185-4337-b...
USER (hermes, minimax/minimax-m2.7)
please go through both bots - also go throuhgh checklist - in bots look at the nuamces and start asking me question as we are building new bot
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Let me find both bots and the checklist first.
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Found both bots and the checklist. Let me read the key files.
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Now let me look at the Claude_bot's main strategy files.
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Let me also read the rest of the HAL bot and the Claude_bot main entry point.
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Let me read the unified_strategy.py (Claude_bot main entry) and the service files.
2026-04-24T16:59:58
ASSISTANT (hermes, minimax/minimax-m2.7)
Alright, I've done a thorough review of both bots and the checklist. Let me share the key nuances I spotted, then we'll dive into questions for the new bot. --- ## Key Nuances Found ### CLAUDE_BOT (RSI + SMMA — `unified_strategy.py`) **Good patterns:** - Broker position filter: `underlying in symbol` — isolates positions per underlying ✅ - `prev_ltp` is RAM-only, not persisted — no stale anchor bug on restart ✅ - Dual-trigger entry (SMMA2 crossover + RSI gap) is well-designed - RSI re-entry (up to 2x after gap exit) is clean - Manual exit detection + re-arm logic is solid **Risks / nuances:** - State file IS used and IS persisted — violates Section 5 and Section 16 of the checklist ⚠️ - `prev_smma_side`, `prev_rsi_state`, `smma_crossover_pending` etc. all survive restart - If bot crashes with an active position + pending state, on restart it loads that state from file — but broker position is truth, so there's a mismatch risk - `get_all_underlying_positions()` accumulates qty across ALL symbols matching the underlying — correct ✅ but only called for lot cap check, not for entry gating - No explicit startup entry guard (prev_ltp=None on HAL bot but not on SMMA bot — different codebases) - Friday squareoff at 15:28 but market close is 15:30 — 2-min buffer --- ### LT 3-CANDLE BOT (`lt_3candle_bot.py`) **Good patterns:** - Data source split: Flattrade for history, Kotak for live — necessary since Kotak has no history API ✅ - `prev_ltp` is RAM-only, not persisted ✅ - 15-min candles built from 3×5-min locally — zero extra API calls for history ✅ - Stale candle detection with Telegram alert ✅ - Symbol filtering: `symbol.startswith(SYMBOL_UNDER)` in positionbook — correct per Section 20 ✅ - EOD squareoff only on Fridays (NRML carry Mon-Thu) ✅ - Replay on startup without firing signals ✅ **Risks / nuances:** - State file IS used (but position is preserved across days correctly) ⚠️ - `exit_failed` and `hedge_placed` ARE persisted — if bot restarts mid-failure, it reloads this state - PnL calculation formula: `(opt_ltp - pos['entry_price']) * LOT_SIZE` — always treats as long profit, works here since bot only goes LONG, but fragile - Entry price check: `qty >= LOT_SIZE` for BUY confirmation — but this doesn't distinguish long from short (if somehow a short existed from another bot, `qty >= LOT_SIZE` would be true) - No manual exit detection (different from HAL bot which has `_session_legs` tracking) - Exit failure → hedge + Telegram alert every 5 min, but if bot restarts the every-5-min alert doesn't restore --- ### BOT RULES (`bot_rules.md`) — Critical Reference The 3 rules that caused real bugs in production: 1. **BUY offset = +5, SELL offset = -5** (opposite directions) — same bug hit two bots independently 2. **Broker is sole truth** — no state file comparisons on entry/exit 3. **Crossover, not level** — `prev_ltp > level >= fut_ltp` not `fut_ltp >= level` --- Now let's build the new bot. I'll start asking you questions in priority order: **Q1: Direction — Long or Spread?** Both existing bots only go LONG (buy options, never sell). The HAL Renko VIDYA bot does a spread (BUY ATM + SELL ITM1) but only for the sell leg to reduce margin. The LT 3-candle bot is purely directional. Is the new bot going to be: - **A) Pure Long** — buy options only, simple but requires more margin - **B) Spread** — BUY + SELL combination (credit spread or debit spread), lower margin - **C) Either leg independently** — sometimes BUY sometimes SELL based on signal Which are you thinking for the new bot?
2026-04-24T16:59:58