Fix scenario exec
This commit is contained in:
@@ -96,7 +96,8 @@ public class TradingBotBase : ITradingBot
|
||||
await LogInformation(startupMessage);
|
||||
|
||||
// Notify AgentGrain about bot startup
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.BotStarted, $"Bot: {Config.Name}, Ticker: {Config.Ticker}");
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.BotStarted,
|
||||
$"Bot: {Config.Name}, Ticker: {Config.Ticker}");
|
||||
break;
|
||||
|
||||
case BotStatus.Running:
|
||||
@@ -170,15 +171,11 @@ public class TradingBotBase : ITradingBot
|
||||
|
||||
public async Task Run()
|
||||
{
|
||||
if (!Config.IsForBacktest)
|
||||
{
|
||||
await LoadLastCandle();
|
||||
}
|
||||
|
||||
// Update signals for live trading only
|
||||
if (!Config.IsForBacktest)
|
||||
{
|
||||
await UpdateSignals();
|
||||
await LoadLastCandle();
|
||||
}
|
||||
|
||||
if (!Config.IsForWatchingOnly)
|
||||
@@ -770,7 +767,8 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
|
||||
// Notify AgentGrain about position opening
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.PositionOpened, $"Signal: {signal.Identifier}");
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.PositionOpened,
|
||||
$"Signal: {signal.Identifier}");
|
||||
|
||||
Logger.LogInformation($"Position requested");
|
||||
return position; // Return the created position without adding to list
|
||||
@@ -1204,8 +1202,11 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
|
||||
// Notify AgentGrain about position closing
|
||||
var pnlInfo = position.ProfitAndLoss?.Realized != null ? $"PnL: {position.ProfitAndLoss.Realized:F2}" : "PnL: Unknown";
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.PositionClosed, $"Signal: {position.SignalIdentifier}, {pnlInfo}");
|
||||
var pnlInfo = position.ProfitAndLoss?.Realized != null
|
||||
? $"PnL: {position.ProfitAndLoss.Realized:F2}"
|
||||
: "PnL: Unknown";
|
||||
await NotifyAgentGrainAsync(AgentSummaryEventType.PositionClosed,
|
||||
$"Signal: {position.SignalIdentifier}, {pnlInfo}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1921,7 +1922,8 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Failed to send agent notification: {EventType} for bot {BotId}", eventType, Identifier);
|
||||
Logger.LogError(ex, "Failed to send agent notification: {EventType} for bot {BotId}", eventType,
|
||||
Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ public class PriceFetcherInitializer : IHostedService
|
||||
// Initialize grains for different timeframes
|
||||
var timeframes = new[]
|
||||
{
|
||||
Timeframe.FiveMinutes,
|
||||
Timeframe.FifteenMinutes,
|
||||
Timeframe.OneHour,
|
||||
Timeframe.FourHour,
|
||||
|
||||
Reference in New Issue
Block a user