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

@@ -240,7 +240,6 @@ func (e *EXMO) ModifyOrder(action *exchange.ModifyOrder) (string, error) {
// CancelOrder cancels an order by its corresponding ID number
func (e *EXMO) CancelOrder(order *exchange.OrderCancellation) error {
orderIDInt, err := strconv.ParseInt(order.OrderID, 10, 64)
if err != nil {
return err
}
@@ -253,6 +252,7 @@ func (e *EXMO) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAl
cancelAllOrdersResponse := exchange.CancelAllOrdersResponse{
OrderStatus: make(map[string]string),
}
openOrders, err := e.GetOpenOrders()
if err != nil {
return cancelAllOrdersResponse, err
@@ -292,7 +292,10 @@ func (e *EXMO) GetDepositAddress(cryptocurrency currency.Code, _ string) (string
// WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is
// submitted
func (e *EXMO) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error) {
resp, err := e.WithdrawCryptocurrency(withdrawRequest.Currency.String(), withdrawRequest.Address, withdrawRequest.AddressTag, withdrawRequest.Amount)
resp, err := e.WithdrawCryptocurrency(withdrawRequest.Currency.String(),
withdrawRequest.Address,
withdrawRequest.AddressTag,
withdrawRequest.Amount)
return fmt.Sprintf("%v", resp), err
}
@@ -329,6 +332,7 @@ func (e *EXMO) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]e
if err != nil {
return nil, err
}
var orders []exchange.OrderDetail
for _, order := range resp {
symbol := currency.NewPairDelimiter(order.Pair, "_")