1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2026-02-16 22:23:54 +00:00

Fixed exception when initial trade snapshot has no items in TradeTracker

This commit is contained in:
Jkorf 2025-10-27 11:59:54 +01:00
parent 99bf6d7c75
commit 04e4ddf525

View File

@ -325,9 +325,12 @@ namespace CryptoExchange.Net.Trackers.Trades
if (Period != null) if (Period != null)
items = items.Where(e => e.Timestamp >= DateTime.UtcNow.Add(-Period.Value)); items = items.Where(e => e.Timestamp >= DateTime.UtcNow.Add(-Period.Value));
_snapshotId = data.Max(d => d.Timestamp.Ticks); if (items.Any())
foreach (var item in items.OrderBy(d => d.Timestamp)) {
_data.Add(item); _snapshotId = data.Max(d => d.Timestamp.Ticks);
foreach (var item in items.OrderBy(d => d.Timestamp))
_data.Add(item);
}
_snapshotSet = true; _snapshotSet = true;
_changed = true; _changed = true;