grid2: add queryOrderTradesRetryDelay

This commit is contained in:
c9s 2023-03-30 11:24:02 +08:00
parent 9e1d25ea5a
commit c3f38c0dd0
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -34,6 +34,8 @@ const maxNumberOfOrderTradesQueryTries = 10
const historyRollbackDuration = 3 * 24 * time.Hour const historyRollbackDuration = 3 * 24 * time.Hour
const historyRollbackOrderIdRange = 1000 const historyRollbackOrderIdRange = 1000
const queryOrderTradesRetryDelay = 500 * time.Millisecond
func init() { func init() {
// Register the pointer of the strategy struct, // Register the pointer of the strategy struct,
// so that bbgo knows what struct to be used to unmarshal the configs (YAML or JSON) // so that bbgo knows what struct to be used to unmarshal the configs (YAML or JSON)
@ -422,7 +424,10 @@ func (s *Strategy) processFilledOrder(o types.Order) {
o.OrderID, o.Side, o.OrderID, o.Side,
fee.String(), feeCurrency) fee.String(), feeCurrency)
// do 1 time retry
if fee.IsZero() || feeCurrency == "" { if fee.IsZero() || feeCurrency == "" {
time.Sleep(queryOrderTradesRetryDelay)
fee, feeCurrency = s.aggregateOrderFee(o) fee, feeCurrency = s.aggregateOrderFee(o)
if !fee.IsZero() { if !fee.IsZero() {
s.logger.Infof("FIXED GRID ORDER #%d %s FEE: %s %s", s.logger.Infof("FIXED GRID ORDER #%d %s FEE: %s %s",