get_atm() hardcodes step=50 — invalid for indices with different step sizes (e.g. SENSEX step=100)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 28
- Forks
- 17
- Avg merge
- 8h 50m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uberdeveloper/fastbt
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
uberdeveloper/fastbt#31 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 52/100
uberdeveloper/fastbt#30 ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
uberdeveloper/fastbt#28 ·
-
FB-008: close_trade mixes price and tick; stale exits are silent (zero-P&L fallback) [silent-wrong]Openbug
Difficulty 3/5 1-2 days Newbie friendliness 70/100
uberdeveloper/fastbt#27 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
uberdeveloper/fastbt#26 ·
All issues in uberdeveloper/fastbt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SwiftKickMobile/skai#84 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jxxghp/MoviePilot#7070 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
flop-labs/technocore-chat#997 ·
Maintainers usually reply within 1 day
-
tunneld on Windows: Wi-Fi devices are not discovered because uvicorn runs on a ProactorEventLoopOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
doronz88/pymobiledevice3#2051 ·
Maintainers usually reply within 1 day