now i want to build the new strategy - please go through the both bots - in details - how all the brokers are handled as every broker has its own nuance - then search the docsand md files which has the questionnaire to build strategy - ask me question one by one and we will have the strategy y the end - improvise if you can
2026-04-29T09:59
ASSISTANT (hermes, deepseek-v4-pro)
Let me start by loading the relevant skills and digging into both bots. I'll do this in parallel where possible.
2026-04-29T09:59
ASSISTANT (hermes, deepseek-v4-pro)
Now let me dive into the actual bot source code and search for strategy documentation.
2026-04-29T09:59
ASSISTANT (hermes, deepseek-v4-pro)
Excellent. Found the strategy audit checklist and key docs. Let me now load all the critical files in parallel.
2026-04-29T09:59
ASSISTANT (hermes, deepseek-v4-pro)
Now let me read the critical remaining sections of both bots — the entry/exit logic and order handling.
2026-04-29T09:59
ASSISTANT (hermes, deepseek-v4-pro)
Now I have a thorough understanding of both bots, all three brokers, and the strategy audit checklist. Let me give you a crisp summary of what I found, then we'll start the Q&A.
---
**WHAT I STUDIED:**
**Bot 1 — Claude_Bot (SMMA + RSI)**
- 4 multi-broker profiles (DLF/Flattrade, INFY/Shoonya, INDUSINDBK/Shoonya, HAL/disabled)
- Monday-locked SMMA(2) + dual RSI(20/120) filter
- BUY options only (no selling), LIMIT+NRML, ₹2,200 SL, Friday EOD
- State persists via JSON files
**Bot 2 — LT 3Candle_Bot (Renko VIDYA)**
- Single symbol LT on NFO futures/options
- Daily VIDYA bias locked at 9:15 + 2-consecutive 15-min candle pattern
- Hybrid broker: Kotak for live trading, Flattrade for candle history
- ₹1,000 max loss, 2 trades/direction/3h-window, NRML
- SQLite local candle DB + JSON state
**Broker Nuances (CRITICAL for strategy design):**
| Feature | Shoonya | Flattrade | Kotak |
|---|---|---|---|
| History API | YES (10 intervals) | YES (6 intervals) | NO |
| Auth | Simple token | Simple token | TOTP+MPIN (2-step) |
| Response format | Direct | Direct | Nested `{"stat":"ok","data":{...}}` |
| Token field | `token` | `token` | `tok` |
| WebSocket | Standard | Standard | Proprietary HSWebSocketLib |
| Best for | Backtesting + Live | Backtesting + Live | Live execution only |
**Design checklist** (from strategy_audit_checklist.md): 20 sections covering position management, order execution, symbol/instrument, risk controls, state management, broker-as-truth, startup behavior, market hours, logging, error handling, configuration, strategy logic, testing, deployment, system health, entry signal integrity, margin/spreads, manual exit detection, order price direction, and multi-bot isolation.
---
Now let's start building. Question by question.
---
**Q1: INSTRUMENT SELECTION**
What do you want to trade? You have two patterns to choose from:
A) **Futures + options on a single symbol** (like LT 3Candle) — focused, simpler broker setup
B) **Options across multiple symbols on multiple brokers** (like Claude_Bot) — diversified, more complex
C) **Something entirely different** — equity cash, index options, spreads, etc.
Also — which underlying(s) are you thinking of? And which broker(s) do you want to use (Shoonya, Flattrade, Kotak, or a mix)?
2026-04-29T09:59
USER (hermes, deepseek-v4-pro)
i want to use mix of brokers - and like to use options
2026-04-29T10:01
ASSISTANT (hermes, deepseek-v4-pro)
Good. Mix of brokers + options. That narrows things down.
---
**Q2: SINGLE SYMBOL OR MULTI-SYMBOL?**
A) **Single symbol, laser-focused** — like LT 3Candle bot (all resources on one underlying, deeper pattern tracking, multi-timeframe, local DB caching). Simpler but eggs in one basket.
B) **Multi-symbol, diversified** — like Claude_Bot (2-4 underlyings, one thread each, spreads risk across names). More moving parts, more broker connections, more to monitor.
C) **Hybrid** — one primary symbol with broker A, one secondary with broker B, possibly different strategies per symbol.
Which approach? And do you already have specific underlyings in mind (e.g., LT, DLF, INFY, INDUSINDBK, or something new)?
2026-04-29T10:01
USER (hermes, deepseek-v4-pro)
it would be indeed 5 symbols and mapped clearly to each broker
2026-04-29T10:03
ASSISTANT (hermes, deepseek-v4-pro)
Clear. 5 symbols, each pinned to a broker. Now the critical layer:
---
**Q3: STRATEGY TYPE**
Before we pick the exact symbols, what kind of entry/exit logic are you drawn to? Your two existing bots represent two families:
A) **Trend-indicator based** (like Claude_Bot's SMMA + RSI) — a computed level/indicator locked at a fixed time (e.g., Monday 9:16), then price crossing that level triggers entries. Good for swing/trend following.
B) **Pattern-based** (like LT 3Candle's 2-candle window) — price action patterns forming on a specific timeframe, with a daily bias from a longer-term indicator (e.g., VIDYA). More discretionary-feeling, fewer but higher-conviction entries.
C) **Breakout/level-based** (like the old Bespoke strategy) — pre-defined support/resistance levels, entries on break and hold.
D) **Something new entirely** — mean reversion, open-range-break, VWAP bands, option Greeks-based, spread selling, straddle/strangle, etc.
Which family appeals to you? Or describe the core idea you have in mind.
2026-04-29T10:03
USER (hermes, deepseek-v4-pro)
so this strategy will tradefrom 9:17 to 9:45 - sq off at 9:45 or hit sl - will be based on option 2
2026-04-29T10:05
ASSISTANT (hermes, deepseek-v4-pro)
Nice. A 9:17→9:45 morning sniper. Very tight window — 28 minutes. That changes the design significantly from the existing bots.
---
**Q4: DAILY BIAS (Directional Filter)**
Before the 9:17-9:45 execution window, we need a daily bias to tell the bot which direction to trade. Options:
A) **VIDYA anchor** (like LT 3Candle) — computed from daily Renko bricks at EOD or BOD. Futures LTP vs VIDYA at 9:15 gives GREEN/RED bias. Fixed for the day.
B) **SMMA level** (like Claude_Bot) — Monday-locked weekly SMMA. Price above = bullish, below = bearish.
C) **Pre-market / opening range** — first 1-2 minutes of price action at 9:15 sets the tone (e.g., open > prev close = bullish bias).
D) **No bias** — trade both directions based purely on pattern within the window.
E) **Something else** — describe it.
---
**Q5: CANDLE TIMEFRAME & PATTERN**
Within 9:17-9:45, you only get:
- 1-min candles: ~28 candles
- 3-min candles: ~9 candles
- 5-min candles: ~5 candles
- 15-min candles: only 1-2 (too few)
What timeframe and pattern type?
A) **2-candle hold** (like 3Candle bot but on faster timeframe, e.g., 3-min) — candle-1 low/high must hold through candle-2 for entry
B) **Open range breakout** — capture the 9:17-9:22 range, enter when price breaks above/below
C) **Candle close above/below level** — each candle close above/below the bias level triggers entry
D) **Something else** — describe
2026-04-29T10:05
USER (hermes, deepseek-v4-pro)
these will be renko based candles as in 2 candle bot - one more thing i like to ad - if the proft of INR 2000 comes then it shoul book the profit and stay out - SL hit then stay out - only one chance - as you said sniper
2026-04-29T10:08
ASSISTANT (hermes, deepseek-v4-pro)
Got it. Renko-based, ₹2000 profit target lockout, SL lockout, one shot per day. Clean sniper design. Let me now get into the specifics.
---
**Q6: RENKO — DAILY BIAS SOURCE**
The LT 3Candle bot builds daily Renko bricks from EOD daily candles to compute VIDYA. But remember the broker constraint: **Kotak has NO historical data**. If any of your 5 symbols are on Kotak, the renko computation must come from another broker's data (like what LT 3Candle does: Flattrade for history, Kotak for execution).
So — how should the daily bias/renko be computed?
A) **EOD computation** (like LT 3Candle) — a separate `_eod.py` script runs after market close, builds renko bricks from daily OHLC, computes tomorrow's VIDYA anchor. Ready at 9:15. Requires daily data from a history-capable broker (Shoonya/Flattrade) for ALL symbols, even those trading on Kotak.
B) **On-demand at 9:15** — fetch last N days of daily candles at BOD, build renko, compute VIDYA inline. Works but slower, and won't work for Kotak-only symbols without a fallback broker.
C) **Previous day's close-based** — simpler: just use prev close vs a moving average, no full renko needed.
---
**Q7: RENKO BRICK SIZE**
For the LT 3Candle bot: brick = 5 × instrument tick size. What brick size for this strategy?
A) **5 × tick size** (same as 3Candle) — more bricks, more sensitive
B) **Larger brick** (e.g., 10× tick or fixed ₹amount) — fewer bricks, stronger trend signal
C) **ATR-based** — adaptive to volatility
D) **Fixed value** — you specify
And since you have 5 symbols with potentially different tick sizes and price ranges, should the brick size be uniform or per-symbol?
---
**Q8: 2-CANDLE WINDOW ON RENKO — HOW?**
In LT 3Candle, the 2-candle pattern runs on 15-min candles with a daily renko bias. But you only have 9:17-9:45 (28 mins). Two approaches:
A) **Renko bias only** — daily renko gives the direction. Within 9:17-9:45, watch for one specific trigger (e.g., price pulls back to VIDYA and holds, or first 3-min candle close above VIDYA)
B) **Intraday renko candles** — build renko bricks from 1-min or 3-min price action live during the window. The 2-candle pattern runs on these intraday renko bricks.
C) **Mixed** — daily renko for bias, fast timeframe (1-min/3-min) regular candles for the 2-candle pattern
Which approach? And what timeframe for the actual pattern candles?
2026-04-29T10:08
USER (hermes, deepseek-v4-pro)
so essentially the strategy will remain same - Vidya would be calculated on previous last 5 min candles (as EOD candles dont come before morning 8:00 am ) and once vidya is defined - we will open in the direction of Vidya - if opening is less then VIDYA we buy put and vice versa we buy call - with SL and Profit booking level - Only one shot per day - scenatro can play out like at 9:15 the opening is above VIDYA and 9:17 prices are belw VIDYA - we wait for it ton cross VIDYA - in our window
2026-04-29T10:17
ASSISTANT (hermes, deepseek-v4-pro)
So the core design is crystallizing:
- VIDYA computed from **previous day's last 5-min candle** (workaround for EOD delay)
- 9:15 opening vs VIDYA → bias direction
- 9:17-9:45 window: wait for price to **cross VIDYA** → enter in bias direction
- ₹2000 profit → book and stay out. SL hit → stay out. One shot only.
---
**Q9: VIDYA COMPUTATION — PREVIOUS DAY 5-MIN DETAIL**
"Previous day's last 5-min candle" — clarify:
A) **Just the last 5-min candle's CLOSE** (15:25-15:30 bar close) — this single value feeds the renko brick chain. Effectively using prev day's closing price as the renko input.
B) **All of previous day's 5-min candle closes aggregated** into a single value (e.g., VWAP of 5-min closes)? Then fed to renko.
C) **The last 5-min candle's full OHLC** — just the close feeds renko, but OHLC kept for reference.
---
**Q10: ENTRY — CROSSOVER CONFIRMATION**
"Wait for price to cross VIDYA" — on what frequency?
A) **Every tick / 1-second poll** — fastest entry, catches the crossover instantly. But noisy, could get false cross and immediate reverse.
B) **1-min candle close above/below VIDYA** — needs a full 1-min candle to close on the correct side. Slower, cleaner.
C) **3-min candle** — fewer signals, more conviction.
D) **Crossover + hold for N seconds** — price crosses and stays there for e.g., 15 seconds.
---
**Q11: STOP LOSS**
What's the SL?
A) **Fixed ₹ amount per position** (e.g., -₹1000, -₹1500, -₹2000) — same across all 5 symbols
B) **Percentage of option premium** (e.g., -30% of entry price)
C) **VIDYA level itself** — if price crosses back across VIDYA, exit
D) **Opening range low/high** — first minute's range as SL reference
And should SL be the same for all 5 symbols, or customizable per symbol?
---
**Q12: ₹2000 PROFIT — PER SYMBOL OR TOTAL?**
₹2000 profit target:
A) **Per symbol** — if DLF option hits +₹2000, lock DLF out. Others keep trading.
B) **Portfolio total** — once combined P&L across all 5 hits +₹2000, all stop.
C) **Per symbol but with a daily cap** — e.g., ₹2000 per symbol AND ₹5000 total daily cap.
2026-04-29T10:17
USER (hermes, deepseek-v4-pro)
pls ask me one question at time - shhot again
2026-04-29T10:19
ASSISTANT (hermes, deepseek-v4-pro)
You got it. One at a time from here.
---
**Q9: VIDYA COMPUTATION FROM PREVIOUS DAY**
"Previous day's last 5-min candle" — how exactly?
A) **Just the CLOSE of the 15:25-15:30 bar** — that single price feeds the renko chain
B) **All previous day's 5-min closes, but the last one is the freshest data point** — full day of 5-min data, renko built from the entire chain ending with that last bar
Which one?
2026-04-29T10:19
USER (hermes, deepseek-v4-pro)
option B - it is our make shift for eod candle - all 5 min candle will give us OHLC require to calculate vidya level for next day
2026-04-29T10:22
ASSISTANT (hermes, deepseek-v4-pro)
Understood. All of yesterday's 5-min candles → build renko → compute VIDYA anchor for today. Clean.
---
**Q10: ENTRY — HOW IS THE CROSSOVER CONFIRMED?**
Price must cross VIDYA within 9:17-9:45. But cross based on what?
A) **Instant LTP cross** — poll every 1-2 seconds, enter the moment LTP moves to the correct side of VIDYA
B) **1-min candle close** — wait for a full 1-min candle to close above/below VIDYA before entering
C) **3-min candle close** — fewer signals, more conviction per entry
2026-04-29T10:22
USER (hermes, deepseek-v4-pro)
ideally we are based on renko - once 2 candles re formed in the direction we are in the game ... you can poll every 30 seconds till 9:22 and then relax it to 1 minute polling
2026-04-29T10:25
ASSISTANT (hermes, deepseek-v4-pro)
Crystal clear. 2 renko bricks forming in the bias direction = entry trigger.
---
**Q11: INTRADAY RENKO BRICK SIZE**
The intraday renko bricks building live during the window — what size?
A) **Same as daily renko** (5 × tick size, like LT 3Candle) — consistent with the VIDYA calculation
B) **Smaller** — e.g., 2-3× tick for faster brick formation in the tight 28-min window
C) **Fixed ₹ amount** — e.g., ₹5, ₹10 per brick, uniform across all 5 symbols
D) **Per-symbol custom** — each of the 5 gets its own brick size based on price/volatility
2026-04-29T10:25
USER (hermes, deepseek-v4-pro)
on the basis of stocks i will give you details - ask for it immrdiately when usee new stocks are called for
2026-04-29T10:28
ASSISTANT (hermes, deepseek-v4-pro)
Noted. Brick size = per-symbol, you'll provide the numbers when we pick the 5 stocks.
---
**Q12: STOP LOSS MECHANISM**
What's the SL?
A) **Fixed ₹ per position** — same number across all 5 (e.g., -₹1000)
B) **Renko brick break** — if a brick forms in the opposite direction, exit
C) **VIDYA cross-back** — price crosses back across VIDYA
D) **Per-symbol custom ₹ amount** — different SL for each stock
2026-04-29T10:28
USER (hermes, deepseek-v4-pro)
A fixed but we will see as we go along
2026-04-29T10:31
USER (hermes, deepseek-v4-pro)
yes.. but remember all buying selling will happen in limit - so put limit order close to 2000
2026-04-29T10:31
ASSISTANT (hermes, deepseek-v4-pro)
Got it — LIMIT orders for everything. Let me make sure I understand the exit mechanics:
---
**Q13: EXIT ORDER PLACEMENT**
For the ₹2000 profit booking — how should the exit order work?
A) **Place target LIMIT sell immediately after entry** — calculate the exact option price that gives +₹2000, place a LIMIT SELL at that price right away. It sits and waits for fill during the window.
B) **Monitor P&L every poll, then exit** — check P&L each 30s/1min cycle. When unrealized P&L ≥ ₹2000, fire a LIMIT SELL at current LTP-offset.
C) **Trailing approach** — place a target limit, but also monitor and adjust it if things go well.
2026-04-29T10:31
USER (hermes, deepseek-v4-pro)
i like C if itmeans that after stock crosses 2000 profit i know min is going to be 2000
2026-04-29T10:33
ASSISTANT (hermes, deepseek-v4-pro)
So a "ratchet" — once ₹2000 is touched, the exit floor is locked at ₹2000 minimum, but you can capture more upside if the trend continues. Smart.
---
**Q14: ₹2000 PROFIT CALCULATION**
Profit = (current option LTP - entry option price) × lot size. Different stocks have different lot sizes, so the option price move needed to hit ₹2000 varies. Should the ₹2000 be:
A) **Uniform ₹2000 across all 5 stocks** — same profit target regardless of lot size. A stock with lot=700 needs ~₹3 move. A stock with lot=150 needs ~₹13 move.
B) **Per-symbol custom** — different target for each (e.g., ₹2000 for heavy lots, ₹1500 for lighter)
2026-04-29T10:33
USER (hermes, deepseek-v4-pro)
2000 all across
2026-04-29T10:37
ASSISTANT (hermes, deepseek-v4-pro)
Uniform ₹2000 across all 5. Clean.
---
**Q15: THE 5 STOCKS & BROKER MAPPING**
Time to name them. For each, I need:
- **Underlying symbol** (e.g., LT, DLF, INFY)
- **Broker** assigned to it (Shoonya / Flattrade / Kotak)
- **Expiry** (current month futures expiry, e.g., 29MAY26 or 26JUN26)
Go ahead — list your 5.
2026-04-29T10:37
USER (hermes, deepseek-v4-pro)
sbi and indigo on flattrade - hal and tcs in shoonya - ULTRACEMCO in kotak
2026-04-29T10:41
ASSISTANT (hermes, deepseek-v4-pro)
Good picks. Quick flag before we continue:
**ULTRACEMCO on Kotak** — Kotak has NO historical data. Same problem as LT 3Candle. ULTRACEMCO will need a secondary broker (Flattrade or Shoonya) to pull yesterday's 5-min candles for the renko/VIDYA computation. We'll use the same hybrid pattern — Kotak for live execution, another broker for history. I'll default to Flattrade for that unless you say otherwise.
---
**Q16: RENKO BRICK SIZE PER STOCK**
For each of the 5, what's the intraday renko brick size?
- SBIN (Flattrade) — ?
- INDIGO (Flattrade) — ?
- HAL (Shoonya) — ?
- TCS (Shoonya) — ?
- ULTRACEMCO (Kotak) — ?
Also — confirm the **futures expiry** we're targeting. Is it 30APR26 (current, expiring tomorrow!), or have we already rolled to 29MAY26?
2026-04-29T10:41
USER (hermes, deepseek-v4-pro)
keep the brick size of 2 foe each stock - i want that each stock should have their database - the 5 min candke database - the future of each stock will change everymonth as per expiry but it should not be a problem for db as it will keep noting the prices from futures as if it is perpetual future - say understood about db
2026-04-29T10:45
ASSISTANT (hermes, deepseek-v4-pro)
Understood.
Per-stock SQLite DB, keyed by underlying (not specific futures contract), so it reads like a perpetual continuous series. Monthly rollover just changes the symbol the broker fetches — the DB doesn't care. Clean design.
---
**Q17: EXPIRY & LOT SIZES**
Current expiry 30APR26 expires TOMORROW. We should target **29MAY26** for all. Confirm:
| Stock | Broker | Expiry | Lot Size |
|---|---|---|---|
| SBIN | Flattrade | 29MAY26 | 750 |
| INDIGO | Flattrade | 29MAY26 | 300 |
| HAL | Shoonya | 29MAY26 | 150 |
| TCS | Shoonya | 29MAY26 | 175 |
| ULTRACEMCO | Kotak | 29MAY26 | 200 |
Correct these lot sizes if I have any wrong.
Also — for ULTRACEMCO on Kotak: confirm the hybrid setup. Flattrade pulls yesterday's 5-min candles for renko/VIDYA, Kotak handles the actual live order. Same pattern as LT 3Candle. OK?
2026-04-29T10:45
USER (hermes, deepseek-v4-pro)
where did you get the the lot sizes
2026-04-29T10:46
ASSISTANT (hermes, deepseek-v4-pro)
Honest answer: some were from your existing configs (HAL = 150 from Claude_bot), others were my best guess from memory. They could be wrong — NSE revised lot sizes recently.
Give me the correct lot sizes for:
- SBIN (Flattrade)
- INDIGO (Flattrade)
- HAL (Shoonya)
- TCS (Shoonya)
- ULTRACEMCO (Kotak)
And for ULTRACEMCO on Kotak — confirm the hybrid setup (Flattrade for history, Kotak for execution)?
2026-04-29T10:46
USER (hermes, deepseek-v4-pro)
two things - expiry i gave you 26MAY26 - you noted 29 - not good - second can you build the skill to find the lot size -
{
"apikey": "bace7fbebffc8bbb3711224bdcc6ddf1b4307399223b718b25ab32b106de7b62",
"underlying": "SBIN",
"exchange": "NFO",
"expiry_date": "26MAY26"
}
2026-04-29T10:51
ASSISTANT (hermes, deepseek-v4-pro)
You're right — 26MAY26, not 29. My apologies. Let me now build the skill and get the real lot sizes. I'll query all 5 using the OpenAlgo API.
2026-04-29T10:51
ASSISTANT (hermes, deepseek-v4-pro)
Let me try directly via the API endpoints using curl.
2026-04-29T10:51
ASSISTANT (hermes, deepseek-v4-pro)
I keep mangling the one-liners. Let me write a proper script.
2026-04-29T10:51
ASSISTANT (hermes, deepseek-v4-pro)
Live data from OpenAlgo `optionsymbol`. Confirmed:
| Stock | Lot Size | Futures LTP | ATM CE |
|---|---|---|---|
| SBIN | 750 | ₹1,094.25 | 1100CE |
| INDIGO | 150 | ₹4,470 | 4450CE |
| HAL | 150 | ₹4,374.20 | 4350CE |
| TCS | 175 | ₹2,446 | 2480CE |
| ULTRACEMCO | 50 | ₹12,014 | 12000CE |
Now — confirm: ULTRACEMCO on Kotak = Flattrade for history data (yesterday's 5-min candles for VIDYA), Kotak for live execution. Same hybrid pattern as LT 3Candle. Yes?