1.3 KiB
Prompt and generated output
The user reported a large MNQ 1s startup bar and asked us to ensure queued trades are not aggregated into the current timestep when their timestamps indicate otherwise. After a direct chart restart and a separate pikerd run showed no spike, the user requested the tested fix on a separate worktree branch based on ib_connectivity_harden, then requested $commit-plan.
git diff HEAD~1..HEAD -- piker/data/_sampling.py
Generated trade_time_s() to normalize common epoch units. In sample_and_broadcast(), timestamped trades reach the current 1s bar only when their rounded time matches the bar. A trade for the next bar waits briefly for samplerd’s step. Older or otherwise mismatched trades are skipped, with one warning per symbol. Untimestamped trades retain the existing receive-time behavior.
git diff HEAD~1..HEAD -- tests/test_sampling_tick_times.py
Generated focused tests for epoch units, startup backlog trades, untimestamped trades, and the next-step wait.
The isolated worktree’s focused test run passed: 8 tests. Ruff and git diff --check passed. The user also live-tested the same guard on direct chart and separate pikerd starts without seeing the spike.