From b8dfb4f1117004ca2ac5bd296b2674ed69778b06 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Wed, 24 Sep 2025 01:32:14 +0700 Subject: [PATCH] Fix historic total positions --- .../Grains/PlatformSummaryGrain.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Managing.Application/Grains/PlatformSummaryGrain.cs b/src/Managing.Application/Grains/PlatformSummaryGrain.cs index 7e4a93d8..79438feb 100644 --- a/src/Managing.Application/Grains/PlatformSummaryGrain.cs +++ b/src/Managing.Application/Grains/PlatformSummaryGrain.cs @@ -55,11 +55,13 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable _logger.LogInformation("Daily reminder scheduled - Next daily: {NextDaily}", nextDailyTime); - // Initial data load if state is empty - if (_state.State.LastUpdated == default) - { - await RefreshDataAsync(); - } + await RefreshDataAsync(); + + // // Initial data load if state is empty + // if (_state.State.LastUpdated == default) + // { + // await RefreshDataAsync(); + // } } public async Task GetPlatformSummaryAsync() @@ -187,7 +189,7 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable if (openPositions?.Any() == true) { - var positionCount = openPositions.Count(); + var positionCount = allPositions.Count(); // Calculate open interest as the sum of leveraged position notional values // Open interest = sum of (position size * price * leverage) for all open positions @@ -203,7 +205,7 @@ public class PlatformSummaryGrain : Grain, IPlatformSummaryGrain, IRemindable else { _logger.LogDebug("No open positions found for metrics calculation"); - return (0m, 0); + return (0m, allPositions.Count()); } } catch (Exception ex)