mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
always check restQuantity
This commit is contained in:
parent
638cc40516
commit
aa340f0db3
|
@ -152,6 +152,13 @@ func (e *TwapExecution) newBestPriceOrder() (orderForm types.SubmitOrder, err er
|
|||
|
||||
minQuantity := fixedpoint.NewFromFloat(e.market.MinQuantity)
|
||||
restQuantity := e.TargetQuantity - fixedpoint.Abs(e.position.Base)
|
||||
|
||||
if restQuantity == 0 {
|
||||
if e.cancelContextIfTargetQuantityFilled() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if restQuantity < minQuantity {
|
||||
return orderForm, fmt.Errorf("can not continue placing orders, rest quantity %f is less than the min quantity %f", restQuantity.Float64(), minQuantity.Float64())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user