grid2: add UpdateZeroOrderFee option

This commit is contained in:
c9s 2023-03-30 22:42:27 +08:00
parent c3f38c0dd0
commit bf00f93f76
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -163,6 +163,11 @@ type Strategy struct {
// it makes sure that your grid configuration is profitable. // it makes sure that your grid configuration is profitable.
FeeRate fixedpoint.Value `json:"feeRate"` FeeRate fixedpoint.Value `json:"feeRate"`
// UpdateZeroOrderFee - this option adds an extra retry when the order fee returns zero
// sometimes the fee is not ready yet, the exchange did not finish the fee calculation.
// and there is a delay between the fee is calculated
UpdateZeroOrderFee bool `json:"updateZeroOrderFee"`
SkipSpreadCheck bool `json:"skipSpreadCheck"` SkipSpreadCheck bool `json:"skipSpreadCheck"`
RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"` RecoverGridByScanningTrades bool `json:"recoverGridByScanningTrades"`
@ -425,7 +430,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
fee.String(), feeCurrency) fee.String(), feeCurrency)
// do 1 time retry // do 1 time retry
if fee.IsZero() || feeCurrency == "" { if s.UpdateZeroOrderFee && (fee.IsZero() || feeCurrency == "") {
time.Sleep(queryOrderTradesRetryDelay) time.Sleep(queryOrderTradesRetryDelay)
fee, feeCurrency = s.aggregateOrderFee(o) fee, feeCurrency = s.aggregateOrderFee(o)