mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
Fix balance calculation
This commit is contained in:
parent
9f6d9028fa
commit
ca31179b40
|
@ -142,12 +142,12 @@ func (s *Strategy) generateGridBuyOrders(session *bbgo.ExchangeSession) ([]types
|
|||
Price: price,
|
||||
TimeInForce: "GTC",
|
||||
}
|
||||
quotaQuantity := fixedpoint.NewFromFloat(order.Quantity).MulFloat64(price)
|
||||
if quoteBalance < quotaQuantity {
|
||||
quoteQuantity := fixedpoint.NewFromFloat(order.Quantity).MulFloat64(price)
|
||||
if quoteBalance < quoteQuantity {
|
||||
log.Infof("quote balance %f is not enough, stop generating buy orders", quoteBalance.Float64())
|
||||
break
|
||||
}
|
||||
quoteBalance = quotaQuantity.Sub(quotaQuantity)
|
||||
quoteBalance = quoteBalance.Sub(quoteQuantity)
|
||||
log.Infof("submitting order: %s", order.String())
|
||||
orders = append(orders, order)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user