Skip to content

Commit

Permalink
Kraken: Move SeedAssets from Setup to Start
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gbjk committed Oct 1, 2023
1 parent 7f2aa63 commit 659e8cc
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions exchanges/kraken/kraken_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 659e8cc

Please sign in to comment.