Skip to content
All library documents

Hourly Bar Completion When a Contract Has No Recent Trades

Article vn.py community

Summary

This forum exchange explains a BarGenerator behavior for forming hourly candles when a contract is inactive near the end of an hour. If no new market data arrives during the final minutes, the incoming bar may carry a timestamp in the next hour. The hour change signals that the current hourly bar should be finalized and a new one started, even though a final trade or minute bar was absent.

The discussion records that removing the relevant logic would leave the callback variable undefined, but the participants do not provide a code listing, test results, or a complete account of the module’s implementation. The original questioner reports resolving the issue after receiving an explanation from other users. The takeaway is about time-bucket handling in bar aggregation; it does not assess a trading strategy or show how missing prices should be synthesized.

Key ideas

  • A change in hour can signal that the current hourly candle should be closed.
  • Inactive contracts may produce no market updates near a time boundary.
  • Bar aggregation needs to handle an hour change even when the final minutes contain no trades.
  • The exchange reports a resolution but supplies no code-level verification or complete implementation details.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.