INNER CODE UNIT · Python
to_dt_pad
aaryansinha16/AI-trader · backend/app.py:649
to_dt_pad = to_dt + timedelta(seconds=30)
logger.info(
f"Tick backfill: filling gap "
f"{from_dt.strftime('%H:%M:%S')} → {to_dt.strftime('%H:%M:%S')} "
f"({(to_dt - from_dt).total_seconds():.0f}s)"
)
try:
ticks = td_bf.fetch_historical_ticks("NIFTY-I", start=from_dt_pad, end=to_dt_pad)
except Exception as e:
logger.warning(f"Tick backfill REST failed for gap: {e}")
continue
if ticks.empty:
continue
ticks = ticks.copy()
ticks["symbol"] = "NIFTY-I"
required = ["timestamp", "symbol", "price", "volume", "oi",
"bid_price", "ask_price", "bid_qty", "ask_qty"]