grid2: only for positive non-zero fee

This commit is contained in:
c9s 2023-07-31 18:12:28 +08:00
parent 43b8e7870d
commit 4560b47556
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -484,7 +484,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
// use the profit to buy more inventory in the grid // use the profit to buy more inventory in the grid
if s.Compound || s.EarnBase { if s.Compound || s.EarnBase {
// if it's not using the platform fee currency, reduce the quote quantity for the buy order // if it's not using the platform fee currency, reduce the quote quantity for the buy order
if feeCurrency == s.Market.QuoteCurrency { if feeCurrency == s.Market.QuoteCurrency && fee.Sign() > 0 {
orderExecutedQuoteAmount = orderExecutedQuoteAmount.Sub(fee) orderExecutedQuoteAmount = orderExecutedQuoteAmount.Sub(fee)
} }
@ -517,7 +517,7 @@ func (s *Strategy) processFilledOrder(o types.Order) {
} }
} }
if feeCurrency == s.Market.BaseCurrency { if feeCurrency == s.Market.BaseCurrency && fee.Sign() > 0 {
newQuantity = newQuantity.Sub(fee) newQuantity = newQuantity.Sub(fee)
} }