Add stats for kaigen

This commit is contained in:
2025-04-24 22:40:10 +07:00
parent 86692b60fa
commit 1d14d31af2
13 changed files with 483 additions and 8 deletions

View File

@@ -48,6 +48,7 @@ public class TradingBot : Bot, ITradingBot
public Scenario Scenario { get; set; }
public Dictionary<DateTime, decimal> WalletBalances { get; set; }
public Dictionary<StrategyType, StrategiesResultBase> StrategiesValues { get; set; }
public DateTime StartupTime { get; set; }
public TradingBot(
string accountName,
@@ -139,6 +140,8 @@ public class TradingBot : Bot, ITradingBot
else
{
Account = account;
// Set the User property from the account
User = account.User;
}
}
@@ -806,7 +809,8 @@ public class TradingBot : Bot, ITradingBot
AccountName = AccountName,
IsForWatchingOnly = IsForWatchingOnly,
WalletBalances = WalletBalances,
MoneyManagement = MoneyManagement
MoneyManagement = MoneyManagement,
StartupTime = DateTime.Now
};
BotService.SaveOrUpdateBotBackup(Name, BotType, JsonConvert.SerializeObject(data));
}
@@ -823,6 +827,12 @@ public class TradingBot : Bot, ITradingBot
ScenarioName = data.ScenarioName;
AccountName = data.AccountName;
IsForWatchingOnly = data.IsForWatchingOnly;
// Restore the startup time if it was previously saved
if (data.StartupTime != DateTime.MinValue)
{
StartupTime = data.StartupTime;
}
}
/// <summary>
@@ -883,4 +893,5 @@ public class TradingBotBackup
public bool IsForWatchingOnly { get; set; }
public Dictionary<DateTime, decimal> WalletBalances { get; set; }
public MoneyManagement MoneyManagement { get; set; }
public DateTime StartupTime { get; set; }
}