Skip to content

Commit

Permalink
feat(bigone): add CancelOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
Akagi201 committed Dec 25, 2017
1 parent 3276f4d commit 9332072
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bigone/bigone.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,20 @@ func (c *Client) GetOrders(ctx context.Context, quote string, base string, limit
})
return orders, nil
}

// CancelOrder Cancel an Order for DELETE https://api.big.one/orders/{id}
func (c *Client) CancelOrder(ctx context.Context, quote string, base string, orderID string) error {
req, err := c.newPrivateRequest(ctx, "DELETE", "orders/"+strings.ToUpper(quote)+"-"+strings.ToUpper(base), nil, nil)
if err != nil {
return err
}

body, err := c.getResponse(req)
if err != nil {
return err
}

log.Debugf("Response body: %v", string(body))

return nil
}
6 changes: 6 additions & 0 deletions cmd/trader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,12 @@ func main() {
log.Fatalf("big.one get orders eth-btc failed, err: %v", err)
}
log.Infof("big.one get orders eth-btc success, orders: %+v", orders)

err = c.CancelOrder(ctx, "eth", "btc", id)
if err != nil {
log.Fatalf("big.one cancel order eth-btc failed, err: %v", err)
}
log.Info("big.one cancel order eth-btc success")
}
}
}

0 comments on commit 9332072

Please sign in to comment.