From 659e8cc715c1f2868b379620b42bd50bd5129d2e Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Thu, 21 Sep 2023 10:04:03 +0700 Subject: [PATCH] Kraken: Move SeedAssets from Setup to Start Having SeedAssets in Setup is cruel and unusual because it calls the API. Most other interactive data seeding happens in Start. This made it so that fixing and creating unit tests for Kraken was painfully slow, particularly on flaky internet. --- exchanges/kraken/kraken_wrapper.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/exchanges/kraken/kraken_wrapper.go b/exchanges/kraken/kraken_wrapper.go index eb9de5e320f..eb942977f57 100644 --- a/exchanges/kraken/kraken_wrapper.go +++ b/exchanges/kraken/kraken_wrapper.go @@ -210,11 +210,6 @@ func (k *Kraken) Setup(exch *config.Exchange) error { return err } - err = k.SeedAssets(context.TODO()) - if err != nil { - return err - } - wsRunningURL, err := k.API.Endpoints.GetURL(exchange.WebsocketSpot) if err != nil { return err @@ -272,6 +267,11 @@ func (k *Kraken) Run(ctx context.Context) { k.PrintEnabledPairs() } + if err := k.SeedAssets(context.TODO()); err != nil { + log.Errorf(log.ExchangeSys, "%s failed to Seed Assets; err: %s", k.Name, err) + return + } + forceUpdate := false if !k.BypassConfigFormatUpgrades { format, err := k.GetPairFormat(asset.UseDefault(), false) @@ -349,6 +349,12 @@ func (k *Kraken) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) e return common.ErrNotYetImplemented } + if !assetTranslator.Seeded() { + if err := k.SeedAssets(ctx); err != nil { + return err + } + } + pairInfo, err := k.fetchSpotPairInfo(ctx) if err != nil { return fmt.Errorf("%s failed to load %s pair execution limits. Err: %s", k.Name, a, err)