portfolio: Fix CryptoID balance issue and assertify tests (#1861)

* portfolio: Fix CryptoID balance issue and assertify tests

* portfolio: Expand context usage, enhance tests and a few other minor improvements

* portfolio: Further improvements and enhance common.IsValidCryptoAddress

* config, portfolio: Use v6.DefaultConfig, switch to context.WithCancel
This commit is contained in:
Adrian Gallagher
2025-03-28 12:41:01 +11:00
committed by GitHub
parent 06afde1460
commit cc05f7e6fd
16 changed files with 723 additions and 845 deletions

View File

@@ -409,7 +409,7 @@ func (bot *Engine) Start() error {
if bot.Settings.EnablePortfolioManager {
if bot.portfolioManager == nil {
if p, err := setupPortfolioManager(bot.ExchangeManager, bot.Settings.PortfolioManagerDelay, &bot.Config.Portfolio); err != nil {
if p, err := setupPortfolioManager(bot.ExchangeManager, bot.Settings.PortfolioManagerDelay, bot.Config.Portfolio); err != nil {
gctlog.Errorf(gctlog.Global, "portfolio manager unable to setup: %s", err)
} else {
bot.portfolioManager = p
@@ -586,7 +586,7 @@ func (bot *Engine) Stop() {
gctlog.Debugln(gctlog.Global, "Engine shutting down..")
if len(bot.portfolioManager.GetAddresses()) != 0 {
bot.Config.Portfolio = *bot.portfolioManager.GetPortfolio()
bot.Config.Portfolio = bot.portfolioManager.GetPortfolio()
}
if bot.gctScriptManager.IsRunning() {