Fix spot bot

This commit is contained in:
2025-12-04 21:21:48 +07:00
parent a07d7ede18
commit b44e1f66a7
13 changed files with 117 additions and 47 deletions

View File

@@ -544,6 +544,18 @@ public class SpotBot : TradingBotBase, ITradingBot
return;
}
// Ensure account is loaded before accessing Account.Exchange
if (Account == null)
{
Logger.LogWarning("Cannot update signals: Account is null. Loading account...");
await LoadAccountAsync();
if (Account == null)
{
Logger.LogError("Cannot update signals: Account failed to load");
return;
}
}
// Live trading: use ScenarioRunnerGrain to get signals
await ServiceScopeHelpers.WithScopedService<IGrainFactory>(_scopeFactory, async grainFactory =>
{