get_atm() hardcodes step=50 — invalid for indices with different step sizes (e.g. SENSEX step=100)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with get_atm() in src/fastbt/backtest/context.py at the cited lines and trace how the backtest engine or data source provides underlying information to the context. Check how available strikes are represented and whether step size can be determined or configured reliably. Done means get_atm() returns valid strikes for indices with different step sizes, with tests covering the reported SENSEX case and existing NIFTY behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug
get_atm(step=50) in src/fastbt/backtest/context.py (lines 112
and 121) defaults to step=50, which is only correct for
NIFTY. Other indices use different step sizes (SENSEX=100,
BANKNIFTY=100, etc.), producing invalid strikes.
Reproduction
SENSEX spot = 85050
ctx.get_atm() # returns 85050 (wrong — not a valid
SENSEX strike)
ctx.get_atm(step=100) # returns 85100 (correct)
Observed Impact
When running ORB strategy on SENSEX data, the engine tried to
ctx.get_atm() # returns 85050 (wrong — not a valid SENSEX strike)
ctx.get_atm(step=100) # returns 85100 (correct)
Observed Impact
When running ORB strategy on SENSEX data, the engine tried to fetch instruments like 85050CE, 84650CE, 84100CE — none of
which exist. This silently produces fewer trades or incorrect fills.
Log warning:
Lazy fetch for '85050CE' at tick '11:16:00'. Consider calling ctx.prefetch(Instrument(85050, 'CE')) in on_day_start() for
better performance.
Current Workaround
Strategy code must explicitly pass step_size and call ctx.get_atm(self.step_size) everywhere. This is fragile — any missed
call silently breaks on non-50-step indices.
Suggested Fix
Make step configurable at the engine or data-source level so get_atm() uses the correct step for the underlying without
requiring every strategy to pass it manually. Options:
- Add step_size to BacktestEngine or DuckDBVortexLoader, propagate to context
- Detect step from the data (scan available strikes)
- At minimum, document that step=50 is NIFTY-specific
- Lingua principale
- Python
- Stelle
- 28
- Fork
- 17
- Merge medio
- 5h 7m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di uberdeveloper/fastbt
-
FB-010: group_by_expiry silently falls back to a one-day period [minor]Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
uberdeveloper/fastbt#29 · 2 commenti ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
uberdeveloper/fastbt#31 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
uberdeveloper/fastbt#30 ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
uberdeveloper/fastbt#28 ·
-
FB-008: close_trade mixes price and tick; stale exits are silent (zero-P&L fallback) [silent-wrong]Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
uberdeveloper/fastbt#27 ·
Tutte le issue di uberdeveloper/fastbt
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
[Bug]: Importing weave changes the process-wide localeForse già presa @himanshu748 l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
UX
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
mediajunkie/piper-morgan-product#2008 · 2 commenti ·