@@ -495,7 +495,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
495
495
Quantity : newQuantity ,
496
496
Tag : orderTag ,
497
497
GroupID : s .OrderGroupID ,
498
- ClientOrderID : uuid . New (). String (),
498
+ ClientOrderID : s . newClientOrderID (),
499
499
}
500
500
501
501
s .logger .Infof ("SUBMIT GRID REVERSE ORDER: %s" , orderForm .String ())
@@ -1253,7 +1253,7 @@ func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoin
1253
1253
TimeInForce : types .TimeInForceGTC ,
1254
1254
Tag : orderTag ,
1255
1255
GroupID : s .OrderGroupID ,
1256
- ClientOrderID : uuid . New (). String (),
1256
+ ClientOrderID : s . newClientOrderID (),
1257
1257
})
1258
1258
usedBase = usedBase .Add (quantity )
1259
1259
} else {
@@ -1271,7 +1271,7 @@ func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoin
1271
1271
TimeInForce : types .TimeInForceGTC ,
1272
1272
Tag : orderTag ,
1273
1273
GroupID : s .OrderGroupID ,
1274
- ClientOrderID : uuid . New (). String (),
1274
+ ClientOrderID : s . newClientOrderID (),
1275
1275
})
1276
1276
quoteQuantity := quantity .Mul (nextPrice )
1277
1277
usedQuote = usedQuote .Add (quoteQuantity )
@@ -1305,7 +1305,7 @@ func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoin
1305
1305
TimeInForce : types .TimeInForceGTC ,
1306
1306
Tag : orderTag ,
1307
1307
GroupID : s .OrderGroupID ,
1308
- ClientOrderID : uuid . New (). String (),
1308
+ ClientOrderID : s . newClientOrderID (),
1309
1309
})
1310
1310
usedQuote = usedQuote .Add (quoteQuantity )
1311
1311
}
@@ -2119,6 +2119,13 @@ func (s *Strategy) findDuplicatedPriceOpenOrders(openOrders []types.Order) (dupO
2119
2119
return dupOrders
2120
2120
}
2121
2121
2122
+ func (s * Strategy ) newClientOrderID () string {
2123
+ if s .session != nil && s .session .ExchangeName == types .ExchangeMax {
2124
+ return uuid .New ().String ()
2125
+ }
2126
+ return ""
2127
+ }
2128
+
2122
2129
func generalBackoff (ctx context.Context , op backoff.Operation ) (err error ) {
2123
2130
err = backoff .Retry (op , backoff .WithContext (
2124
2131
backoff .WithMaxRetries (
@@ -2145,4 +2152,4 @@ func queryOpenOrdersUntilSuccessful(ctx context.Context, ex types.Exchange, symb
2145
2152
2146
2153
err = generalBackoff (ctx , op )
2147
2154
return openOrders , err
2148
- }
2155
+ }
0 commit comments