Skip to content

Commit 1bd2e8c

Browse files
authored
Merge pull request #2598 from c9s/dboy/xfundingv2/instance-tag
2 parents 88662ac + ab29e19 commit 1bd2e8c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

pkg/strategy/xfundingv2/strategy.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"os"
88
"sort"
9-
"strings"
109
"sync"
1110
"time"
1211

@@ -64,6 +63,8 @@ type Strategy struct {
6463
DryRun bool `json:"dryRun"`
6564
ClosingAllOnStartup bool `json:"closingAllOnStartup"`
6665

66+
InstanceTag string `json:"instanceTag"`
67+
6768
// Session configuration
6869
SpotSession string `json:"spotSession"`
6970
FuturesSession string `json:"futuresSession"`
@@ -168,8 +169,7 @@ func (s *Strategy) ID() string {
168169
}
169170

170171
func (s *Strategy) InstanceID() string {
171-
symbols := strings.Join(s.CandidateSymbols, "_")
172-
return fmt.Sprintf("%s-%s-%s-futures", ID, symbols, s.MarketSelectionConfig.FuturesDirection)
172+
return fmt.Sprintf("%s-%s-%s-futures", ID, s.InstanceTag, s.MarketSelectionConfig.FuturesDirection)
173173
}
174174

175175
func (s *Strategy) Defaults() error {
@@ -299,6 +299,10 @@ func (s *Strategy) Validate() error {
299299
if s.MaxClosingLossRatio.Sign() > 0 {
300300
return fmt.Errorf("maxClosingLossRatio should be negative: %s", s.MaxClosingLossRatio)
301301
}
302+
303+
if s.InstanceTag == "" {
304+
return errors.New("instanceTag is required")
305+
}
302306
return nil
303307
}
304308

0 commit comments

Comments
 (0)