How Backtests Group Daily Mark-to-Market Results by Bar Date
Summary
This forum post asks whether a backtester should calculate daily mark-to-market profit and loss by calendar date or by trading day. The author examines a bar-replay workflow in which each new bar updates the simulation time, then uses the date portion of that timestamp as a key to create or update a daily result. This suggests that result records are grouped by the dates present in the input bars.
The post does not provide a reply or establish whether this behavior means calendar-day accounting in practice. Its unresolved question is whether bars occur only on trading sessions, how their timestamps are assigned, and whether the daily-result logic creates entries for dates with no bars. It is useful as a code-reading prompt about how backtests define a day, but the snippet alone cannot settle the accounting convention or how weekends and holidays are handled.
Key ideas
- The backtest updates its current time as each bar is replayed.
- Daily result records are looked up or created using the date extracted from a bar timestamp.
- The author questions whether this grouping corresponds to calendar days or trading sessions.
- The post does not include an answer, so weekend and holiday handling remain unclear.
- Determining the accounting convention requires examining the input bar dates and the wider daily-result logic.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.