From f6a3be6ff5a0743b1f0179ab485ab5b456afb856 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 16 Jun 2023 18:08:25 +0800 Subject: [PATCH] xfunding: improve checkAndRestorePositionRisks --- pkg/strategy/xfunding/strategy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/strategy/xfunding/strategy.go b/pkg/strategy/xfunding/strategy.go index 1a2634d78..f59136dd2 100644 --- a/pkg/strategy/xfunding/strategy.go +++ b/pkg/strategy/xfunding/strategy.go @@ -1135,6 +1135,11 @@ func (s *Strategy) checkAndRestorePositionRisks(ctx context.Context) error { log.Infof("fetched futures position risks: %+v", positionRisks) + if len(positionRisks) == 0 { + s.FuturesPosition.Reset() + return nil + } + for _, positionRisk := range positionRisks { if positionRisk.Symbol != s.Symbol { continue