mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 15:11:07 +00:00
General fixes for CancelAllOrders exchange wrapper function (#313)
* General fixes for CancelAllOrders * Fix error shadowing issue * Initialise order status map and rm reduntant initialisations
This commit is contained in:
committed by
Adrian Gallagher
parent
416fbbd5ae
commit
a80acb16de
@@ -202,9 +202,7 @@ func (l *LakeBTC) CancelOrder(order *exchange.OrderCancellation) error {
|
||||
|
||||
// CancelAllOrders cancels all orders associated with a currency pair
|
||||
func (l *LakeBTC) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error) {
|
||||
cancelAllOrdersResponse := exchange.CancelAllOrdersResponse{
|
||||
OrderStatus: make(map[string]string),
|
||||
}
|
||||
var cancelAllOrdersResponse exchange.CancelAllOrdersResponse
|
||||
openOrders, err := l.GetOpenOrders()
|
||||
if err != nil {
|
||||
return cancelAllOrdersResponse, err
|
||||
@@ -212,8 +210,7 @@ func (l *LakeBTC) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Cance
|
||||
|
||||
var ordersToCancel []string
|
||||
for _, order := range openOrders {
|
||||
orderIDString := strconv.FormatInt(order.ID, 10)
|
||||
ordersToCancel = append(ordersToCancel, orderIDString)
|
||||
ordersToCancel = append(ordersToCancel, strconv.FormatInt(order.ID, 10))
|
||||
}
|
||||
|
||||
return cancelAllOrdersResponse, l.CancelExistingOrders(ordersToCancel)
|
||||
|
||||
Reference in New Issue
Block a user