From 99e45a9a1f7c61f00f9659bfe50b556c1b9a475e Mon Sep 17 00:00:00 2001 From: Robert O'Leary Date: Wed, 3 Jan 2018 22:49:16 +0100 Subject: [PATCH 1/2] Fixes price/quantity mixup in order book. --- service_market.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_market.go b/service_market.go index 510d718..ee7e1a5 100644 --- a/service_market.go +++ b/service_market.go @@ -81,7 +81,7 @@ func (as *apiService) OrderBook(obr OrderBookRequest) (*OrderBook, error) { if err != nil { return nil, err } - quantity, err := floatFromString(rawPrice) + quantity, err := floatFromString(rawQuantity) if err != nil { return nil, err } From 61ac20bb988051c6b002bfb384827a4f6a7c34c8 Mon Sep 17 00:00:00 2001 From: Robert O'Leary Date: Wed, 3 Jan 2018 23:35:47 +0100 Subject: [PATCH 2/2] Fixes market order not working --- service_account.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/service_account.go b/service_account.go index a93635f..8fdc606 100644 --- a/service_account.go +++ b/service_account.go @@ -29,9 +29,7 @@ func (as *apiService) NewOrder(or NewOrderRequest) (*ProcessedOrder, error) { params["symbol"] = or.Symbol params["side"] = string(or.Side) params["type"] = string(or.Type) - params["timeInForce"] = string(or.TimeInForce) params["quantity"] = strconv.FormatFloat(or.Quantity, 'f', 10, 64) - params["price"] = strconv.FormatFloat(or.Price, 'f', 10, 64) params["timestamp"] = strconv.FormatInt(unixMillis(or.Timestamp), 10) if or.NewClientOrderID != "" { params["newClientOrderId"] = or.NewClientOrderID @@ -42,6 +40,12 @@ func (as *apiService) NewOrder(or NewOrderRequest) (*ProcessedOrder, error) { if or.IcebergQty != 0 { params["icebergQty"] = strconv.FormatFloat(or.IcebergQty, 'f', 10, 64) } + if string(or.TimeInForce) != "" { + params["timeInForce"] = string(or.TimeInForce) + } + if or.Price > 0 { + params["price"] = strconv.FormatFloat(or.Price, 'f', 10, 64) + } res, err := as.request("POST", "api/v3/order", params, true, true) if err != nil {