Fix ROI
This commit is contained in:
@@ -350,17 +350,20 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
try
|
||||
{
|
||||
var agentGrain = GrainFactory.GetGrain<IAgentGrain>(_state.State.User.Id);
|
||||
var balanceCheckResult = await agentGrain.CheckAndEnsureEthBalanceAsync(_state.State.Identifier, _tradingBot.Account.Name);
|
||||
var balanceCheckResult =
|
||||
await agentGrain.CheckAndEnsureEthBalanceAsync(_state.State.Identifier, _tradingBot.Account.Name);
|
||||
|
||||
if (!balanceCheckResult.IsSuccessful)
|
||||
{
|
||||
// Log the specific reason for the failure
|
||||
await _tradingBot.LogWarning($"Balance check failed: {balanceCheckResult.Message} (Reason: {balanceCheckResult.FailureReason})");
|
||||
|
||||
await _tradingBot.LogWarning(
|
||||
$"Balance check failed: {balanceCheckResult.Message} (Reason: {balanceCheckResult.FailureReason})");
|
||||
|
||||
// Check if the bot should stop due to this failure
|
||||
if (balanceCheckResult.ShouldStopBot)
|
||||
{
|
||||
await _tradingBot.LogWarning($"Stopping bot due to balance check failure: {balanceCheckResult.Message}");
|
||||
await _tradingBot.LogWarning(
|
||||
$"Stopping bot due to balance check failure: {balanceCheckResult.Message}");
|
||||
await StopAsync();
|
||||
return;
|
||||
}
|
||||
@@ -371,10 +374,6 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _tradingBot.LogInformation($"Balance check successful: {balanceCheckResult.Message}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user