From c08222699ca9ea70696a7c96688830facc331486 Mon Sep 17 00:00:00 2001 From: Vadim Zhuk Date: Wed, 22 May 2019 01:23:51 +0300 Subject: [PATCH] Huobi/HuobiHadax/Binance: Fix GetActiveOrders orders date (#304) * fix balance responce * Fixed OrderHistory unmarshalling on the GateIo * fix int convertation in the GetOrderHistory function * fix issue on order submit : Binance exchange raw response: {"code":-1102,"msg":"Mandatory parameter 'timeInForce' was not sent, was empty/null, or malformed."} * Okgroup: fix issue on empty notional GetSpotOrderResponse * Okgroup: fix issue with empty order status. order start is required for orderHistory request * HUOBU: fix order currency mapping in GetActiveOrders method * OKGroup: fix currency name on GetAccountInfo * ZB: fixed wrong error code on order send method * OKGroup: add missing fields to GetActiveOrders mapping * huobi: add missing fields to GetActiveOrders/GetOrderHistory response mapping * gateio: add order status field to GetActiveOrders response * gateio: fix orderId on SubmitOrder response * - poloniex: fix 422 on private API call - poloniex: fix empty order history * - poloniex: fix 422 on private API call (revert) * GateIo: Fix unmarshalling issue * Huobi: removing redundant breaks * Huobi: fix rangeValCopy in GetActiveOrders/GetOrderHistory methods * - poloniex: fix 422 on private API call * Revert "- poloniex: fix 422 on private API call" This reverts commit 4748227a Took 39 minutes * Replace nonce increment with mutex to atomic incrementation Took 20 minutes * Fix ZB order unmarshaling Took 6 minutes * Fix CancelSpotOrderResponse unmarshaling on OKGroup Took 2 minutes * fix OrderDate on huobi Took 3 minutes * fix OrderDate on binance Took 1 minute * fix OrderDate on huobihadax Took 24 minutes --- exchanges/binance/binance_wrapper.go | 4 ++-- exchanges/huobi/huobi_wrapper.go | 4 ++-- exchanges/huobihadax/huobihadax_wrapper.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index 2833a3c4..d7de79f8 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -347,7 +347,7 @@ func (b *Binance) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ( for i := range resp { orderSide := exchange.OrderSide(strings.ToUpper(resp[i].Side)) orderType := exchange.OrderType(strings.ToUpper(resp[i].Type)) - orderDate := time.Unix(int64(resp[i].Time), 0) + orderDate := time.Unix(0, int64(resp[i].Time)*int64(time.Millisecond)) orders = append(orders, exchange.OrderDetail{ Amount: resp[i].OrigQty, @@ -387,7 +387,7 @@ func (b *Binance) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ( for i := range resp { orderSide := exchange.OrderSide(strings.ToUpper(resp[i].Side)) orderType := exchange.OrderType(strings.ToUpper(resp[i].Type)) - orderDate := time.Unix(int64(resp[i].Time), 0) + orderDate := time.Unix(0, int64(resp[i].Time)*int64(time.Millisecond)) // New orders are covered in GetOpenOrders if resp[i].Status == "NEW" { continue diff --git a/exchanges/huobi/huobi_wrapper.go b/exchanges/huobi/huobi_wrapper.go index a92cadaf..e1c5a02f 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -429,7 +429,7 @@ func (h *HUOBI) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([] CurrencyPair: c, Exchange: h.Name, ExecutedAmount: resp[i].FilledAmount, - OrderDate: time.Unix(resp[i].CreatedAt, 0), + OrderDate: time.Unix(0, resp[i].CreatedAt*int64(time.Millisecond)), Status: resp[i].State, AccountID: strconv.FormatFloat(resp[i].AccountID, 'f', -1, 64), Fee: resp[i].FilledFees, @@ -477,7 +477,7 @@ func (h *HUOBI) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([] CurrencyPair: c, Exchange: h.Name, ExecutedAmount: resp[i].FilledAmount, - OrderDate: time.Unix(resp[i].CreatedAt, 0), + OrderDate: time.Unix(0, resp[i].CreatedAt*int64(time.Millisecond)), Status: resp[i].State, AccountID: strconv.FormatFloat(resp[i].AccountID, 'f', -1, 64), Fee: resp[i].FilledFees, diff --git a/exchanges/huobihadax/huobihadax_wrapper.go b/exchanges/huobihadax/huobihadax_wrapper.go index 03d354e7..190ac046 100644 --- a/exchanges/huobihadax/huobihadax_wrapper.go +++ b/exchanges/huobihadax/huobihadax_wrapper.go @@ -385,7 +385,7 @@ func (h *HUOBIHADAX) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest for i := range allOrders { symbol := currency.NewPairDelimiter(allOrders[i].Symbol, h.ConfigCurrencyPairFormat.Delimiter) - orderDate := time.Unix(allOrders[i].CreatedAt, 0) + orderDate := time.Unix(0, allOrders[i].CreatedAt*int64(time.Millisecond)) orders = append(orders, exchange.OrderDetail{ ID: fmt.Sprintf("%v", allOrders[i].ID), @@ -433,7 +433,7 @@ func (h *HUOBIHADAX) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest for i := range allOrders { symbol := currency.NewPairDelimiter(allOrders[i].Symbol, h.ConfigCurrencyPairFormat.Delimiter) - orderDate := time.Unix(allOrders[i].CreatedAt, 0) + orderDate := time.Unix(0, allOrders[i].CreatedAt*int64(time.Millisecond)) orders = append(orders, exchange.OrderDetail{ ID: fmt.Sprintf("%v", allOrders[i].ID),