Which batch gets the 13:00 HYPEUSDT candle?
The HYPEUSDT five-minute candle with open_time 1794632400000 opened at 13:00 Hong Kong time on November 14, 2026, so it belongs in [13:00, 13:30). The chart shows the 12 opening times extracted from the Binance archive. Six belong to [12:30, 13:00), from 12:30 through 12:55, and six belong to [13:00, 13:30), from 13:00 through 13:25.
HYPEUSDT 五分钟 K 线(开盘时间 1794632400000)于 2026 年 11 月 14 日香港时间 13:00 开盘,因此它属于 [13:00, 13:30) 区间。图表显示了从币安归档数据中提取的 12 个开盘时间。其中 6 个属于 [12:30, 13:00) 区间(从 12:30 到 12:55),另外 6 个属于 [13:00, 13:30) 区间(从 13:00 到 13:25)。
Binance Data Vision HYPEUSDT five-minute archive Assign each candle by its opening timestamp t using start <= t < end. In a regression test, count the 13:00 timestamp in each batch. A combined count of one would also accept (1, 0), which puts the candle in the earlier batch.
币安数据可视化 HYPEUSDT 五分钟归档数据通过开盘时间戳 t,使用 start <= t < end 的规则为每根 K 线分配区间。在回归测试中,统计每个批次中 13:00 时间戳的数量。如果合并计数为 1,也可以接受 (1, 0) 的结果,这意味着该 K 线被归入较早的批次。
Check the boundary in Python The example uses the 12 opening times from the chart and sets the timestamps and batch bounds in Asia/Hong_Kong. Each assertion checks a pair of counts in the order (first batch, next batch).
在 Python 中检查边界。该示例使用了图表中的 12 个开盘时间,并在 Asia/Hong_Kong 时区设置了时间戳和批次边界。每个断言都按(第一批次,下一批次)的顺序检查计数值。
from datetime import datetime
from zoneinfo import ZoneInfo
hong_kong = ZoneInfo('Asia/Hong_Kong')
def at(hhmm): return datetime.fromisoformat(f'2026-11-14T{hhmm}').replace(tzinfo=hong_kong)
opens = [at(hhmm) for hhmm in ( '12:30', '12:35', '12:40', '12:45', '12:50', '12:55', '13:00', '13:05', '13:10', '13:15', '13:20', '13:25', )]
start, boundary, end = at('12:30'), at('13:00'), at('13:30')
def boundary_counts(rows, *, include_first_end=False):
if include_first_end:
first = [t for t in rows if start <= t <= boundary]
else:
first = [t for t in rows if start <= t < boundary]
second = [t for t in rows if boundary <= t < end]
return first.count(boundary), second.count(boundary)
assert boundary_counts(opens) == (0, 1)
assert boundary_counts(opens, include_first_end=True) == (1, 1)
assert boundary_counts([t for t in opens if t != boundary]) == (0, 0)
assert boundary_counts(opens + [boundary]) == (0, 2)
All four assertions passed in Python 3.12.16. Making the first batch’s end inclusive gives (1, 1) because the same row appears in both batches. Removing the 13:00 row gives (0, 0). Adding a second copy gives (0, 2) because both copies belong to the later batch.
所有四个断言均在 Python 3.12.16 中通过。将第一个批次的结束边界设为包含(inclusive)会得到 (1, 1),因为同一行数据出现在了两个批次中。移除 13:00 那一行会得到 (0, 0)。增加第二个副本会得到 (0, 2),因为两个副本都属于较晚的批次。
For a loader regression test, pass the normalized opening timestamps through the batching function and compare each returned sequence with its expected sequence. If the loader writes to storage, replay the same batch and check that the stored timestamps still match the expected sequence in order, with each timestamp appearing once. AI assistance was used to draft and revise this article.
对于加载器回归测试,将归一化后的开盘时间戳传入批处理函数,并将返回的每个序列与预期序列进行比较。如果加载器将数据写入存储,则重放同一批次,并检查存储的时间戳是否仍按顺序与预期序列匹配,且每个时间戳仅出现一次。本文的起草和修订使用了人工智能辅助。