Fix backtest spot
This commit is contained in:
@@ -536,7 +536,7 @@ public class AgentGrain : Grain, IAgentGrain
|
||||
}
|
||||
|
||||
// Check each bot for open positions
|
||||
foreach (var botEntry in userBots)
|
||||
foreach (var botEntry in userBots.Where(b => b.Status == BotStatus.Running))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -173,6 +173,18 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
{
|
||||
// Handle fallback for empty AccountName before creating the trading bot instance
|
||||
var config = _state.State.Config;
|
||||
|
||||
if (config.TradingType == TradingType.BacktestFutures)
|
||||
{
|
||||
config.TradingType = TradingType.Futures;
|
||||
_state.State.Config = config;
|
||||
}
|
||||
else if (config.TradingType == TradingType.BacktestSpot)
|
||||
{
|
||||
config.TradingType = TradingType.Spot;
|
||||
_state.State.Config = config;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(config.AccountName))
|
||||
{
|
||||
// Fallback: Get the first account for the user
|
||||
@@ -531,7 +543,7 @@ public class LiveTradingBotGrain : Grain, ILiveTradingBotGrain, IRemindable
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var logger = scope.ServiceProvider.GetRequiredService<ILogger<TradingBotBase>>();
|
||||
var streamProvider = this.GetStreamProvider("ManagingStreamProvider");
|
||||
|
||||
|
||||
// Create the trading bot instance based on TradingType
|
||||
TradingBotBase tradingBot = config.TradingType switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user