mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
binance: fix margin order cancel
This commit is contained in:
parent
1a820936c4
commit
2ef4d713f8
|
@ -535,10 +535,10 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
|
|||
return err
|
||||
}
|
||||
|
||||
for _, o := range orders {
|
||||
var req = e.Client.NewCancelOrderService()
|
||||
|
||||
// Mandatory
|
||||
for _, o := range orders {
|
||||
if e.IsMargin {
|
||||
var req = e.Client.NewCancelMarginOrderService()
|
||||
req.Symbol(o.Symbol)
|
||||
|
||||
if o.OrderID > 0 {
|
||||
|
@ -552,6 +552,22 @@ func (e *Exchange) CancelOrders(ctx context.Context, orders ...types.Order) (err
|
|||
log.WithError(_err).Errorf("order cancel error")
|
||||
err = multierr.Append(err, _err)
|
||||
}
|
||||
} else {
|
||||
var req = e.Client.NewCancelOrderService()
|
||||
req.Symbol(o.Symbol)
|
||||
|
||||
if o.OrderID > 0 {
|
||||
req.OrderID(int64(o.OrderID))
|
||||
} else if len(o.ClientOrderID) > 0 {
|
||||
req.NewClientOrderID(o.ClientOrderID)
|
||||
}
|
||||
|
||||
_, _err := req.Do(ctx)
|
||||
if _err != nil {
|
||||
log.WithError(_err).Errorf("order cancel error")
|
||||
err = multierr.Append(err, _err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue
Block a user