I’m trying to backtest a signal engine using Lumibot’s PandasDataBacktesting against 24-hour datasets (forex, or stock data with pre-market + after-hours from Polygon.io).
However, Lumibot only executes trades between 09:30 and 16:00 America/New_York, even though my input data contains bars for the full 24 hours.
During debugging I noticed two things I want to verify:
1. Claim: Lumibot forces a market-hours calendar
lumibot/brokers/broker.py imports pandas_market_calendars:
import pandas_market_calendars as mcal
Source: https://github.com/Lumiwealth/lumibot/blob/master/lumibot/brokers/broker.py
And pandas_market_calendars only provides calendars for exchange-traded assets (NYSE, NASDAQ, CME, etc). Running:
mcal.get_calendar_names()
returns no forex or 24-hour market calendars.
Question: Is Lumibot’s broker logic inherently tied to these calendars, meaning the framework assumes equity-style sessions?
2. Claim: Lumibot cannot process continuous 24-hour data
Even when I provide minute-bars for the full day, the backtester logs:
Market opens in 63000 seconds (17.5 hours)
Advancing time by 59400 seconds (skipping 16.5 hours)
This results in:
- Many timestamps being skipped
- ~70% of my signals never executing
- Only trades inside 09:30–16:00 being evaluated Question: Is this behavior expected, and does Lumibot officially support only regular equity market hours during backtesting?
Minimal example
from lumibot.backtesting import PandasDataBacktesting
from my_strategy import SignalBasedStrategy
SignalBasedStrategy.run_backtest(
PandasDataBacktesting,
start_date,
end_date,
pandas_data=full_24h_dataframe,
parameters={"signals_df": signal_df},
budget=100000,
)
Even with continuous 24-hour data, only the regular NYSE session is processed.
What I need to confirm
- Is Lumibot fundamentally unable to backtest 24-hour continuous markets (forex/crypto)?
- Is there a configuration I’m missing, or is this a limitation of PandasDataBacktesting?
- Should all data be pre-filtered to exchange hours before using Lumibot?
Looking for clarification from anyone who has worked with the internals of Lumibot or extended-hours data handling.