pub fn merge_multiple_order_book_caches(
sources: &[CachedOrderBook],
max_depth: usize,
) -> CachedOrderBookExpand description
Merge N exchange-level orderbook caches into one broker-level cache.
对齐 C++ QotRealTimeData::MergeMultipleOrderBookCaches(vSources, pbMerged, nMaxDepth=40) (QotRealTimeData.cpp:1534-1591):
- 第一个 source 作为基础 (拷 svr_recv_time 等基本字段, 但 bid/ask list 重算)
- 按 price key 聚合 bid/ask, 同 price 累加 volume + order_count + detail
- bid 高价优先, ask 低价优先, 截断到
max_depth - bid/ask timestamp 取多 source 最大值
max_depth = 0 → 不截断 (C++ 行为, line 1579-1583 if nMaxDepth > 0).
max_depth = 40 → crypto LV2 broker-level cache 用 (line 1014).