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:
Ryan O'Hara-Reid
2019-05-31 16:06:10 +10:00
committed by Adrian Gallagher
parent 416fbbd5ae
commit a80acb16de
19 changed files with 54 additions and 50 deletions

View File

@@ -266,15 +266,15 @@ func (g *Gateio) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Cancel
return cancelAllOrdersResponse, err
}
uniqueSymbols := make(map[string]string)
uniqueSymbols := make(map[string]int)
for i := range openOrders.Orders {
uniqueSymbols[openOrders.Orders[i].CurrencyPair] = openOrders.Orders[i].CurrencyPair
uniqueSymbols[openOrders.Orders[i].CurrencyPair]++
}
for unique := range uniqueSymbols {
err = g.CancelAllExistingOrders(-1, uniqueSymbols[unique])
err = g.CancelAllExistingOrders(-1, unique)
if err != nil {
return cancelAllOrdersResponse, err
cancelAllOrdersResponse.OrderStatus[unique] = err.Error()
}
}