diff --git a/.appveyor.yml b/.appveyor.yml index a222a294..4ff08318 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,10 +2,17 @@ build: off clone_folder: c:\gopath\src\github.com\thrasher-\gocryptotrader +cache: + - '%APPDATA%\npm-cache' + - '%GOPATH%\pkg\mod' + - '%LOCALAPPDATA%\go-build' + - c:\gopath\src\github.com\thrasher-\gocryptotrader\web\node_modules + environment: GOPATH: c:\gopath GO111MODULE: on NODEJS_VER: 10.15.3 + APPVEYOR_SAVE_CACHE_ON_ERROR: true stack: go 1.12.3 @@ -21,7 +28,7 @@ before_test: test_script: # test back-end - - go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15.0 + - go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0 - '%GOPATH%\bin\golangci-lint.exe run --verbose' - go test -race ./... diff --git a/.golangci.yml b/.golangci.yml index ccb81b9d..a0835d4f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -78,4 +78,4 @@ issues: - gosec service: - golangci-lint-version: 1.15.x \ No newline at end of file + golangci-lint-version: 1.16.x \ No newline at end of file diff --git a/Makefile b/Makefile index 01801fe0..4d7624b1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ LDFLAGS = -ldflags "-w -s" GCTPKG = github.com/thrasher-/gocryptotrader -LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15.0 +LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0 LINTBIN = $(GOPATH)/bin/golangci-lint GCTLISTENPORT=9050 GCTPROFILERLISTENPORT=8085 diff --git a/config/config_test.go b/config/config_test.go index b5028938..4f8bb9fc 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -751,7 +751,7 @@ func TestReadConfig(t *testing.T) { err = readConfig.ReadConfig("bla") if err == nil { - t.Error("Test failed. TestReadConfig " + err.Error()) + t.Error("Test failed. TestReadConfig error cannot be nil") } err = readConfig.ReadConfig("") diff --git a/exchanges/btcmarkets/btcmarkets_types.go b/exchanges/btcmarkets/btcmarkets_types.go index 203663f1..95f72a76 100644 --- a/exchanges/btcmarkets/btcmarkets_types.go +++ b/exchanges/btcmarkets/btcmarkets_types.go @@ -78,7 +78,7 @@ type OrderToGo struct { // Order holds order information type Order struct { - ID int64 `json:"id"` + ID string `json:"id"` Currency string `json:"currency"` Instrument string `json:"instrument"` OrderSide string `json:"orderSide"` diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index a79cc1bb..a7d0cb4d 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -323,7 +323,12 @@ func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Ca var orderList []int64 for i := range openOrders { - orderList = append(orderList, openOrders[i].ID) + orderIDInt, err := strconv.ParseInt(openOrders[i].ID, 10, 64) + if err != nil { + cancelAllOrdersResponse.OrderStatus[openOrders[i].ID] = err.Error() + continue + } + orderList = append(orderList, orderIDInt) } if len(orderList) > 0 { @@ -333,8 +338,8 @@ func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.Ca } for i := range orders { - if err != nil { - cancelAllOrdersResponse.OrderStatus[strconv.FormatInt(orders[i].ID, 10)] = err.Error() + if !orders[i].Success { + cancelAllOrdersResponse.OrderStatus[strconv.FormatInt(orders[i].ID, 10)] = orders[i].ErrorMessage } } } @@ -376,7 +381,7 @@ func (b *BTCMarkets) GetOrderInfo(orderID string) (exchange.OrderDetail, error) OrderDetail.Amount = orders[i].Volume OrderDetail.OrderDate = orderDate OrderDetail.Exchange = b.GetName() - OrderDetail.ID = strconv.FormatInt(orders[i].ID, 10) + OrderDetail.ID = orders[i].ID OrderDetail.RemainingAmount = orders[i].OpenVolume OrderDetail.OrderSide = side OrderDetail.OrderType = orderType @@ -448,7 +453,7 @@ func (b *BTCMarkets) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest orderType := exchange.OrderType(strings.ToUpper(resp[i].OrderType)) openOrder := exchange.OrderDetail{ - ID: strconv.FormatInt(resp[i].ID, 10), + ID: resp[i].ID, Amount: resp[i].Volume, Exchange: b.Name, RemainingAmount: resp[i].OpenVolume, @@ -517,7 +522,7 @@ func (b *BTCMarkets) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest orderType := exchange.OrderType(strings.ToUpper(respOrders[i].OrderType)) openOrder := exchange.OrderDetail{ - ID: strconv.FormatInt(respOrders[i].ID, 10), + ID: respOrders[i].ID, Amount: respOrders[i].Volume, Exchange: b.Name, RemainingAmount: respOrders[i].OpenVolume, diff --git a/exchanges/btse/btse_websocket.go b/exchanges/btse/btse_websocket.go index 28ca7d65..0308ee07 100644 --- a/exchanges/btse/btse_websocket.go +++ b/exchanges/btse/btse_websocket.go @@ -49,10 +49,6 @@ func (b *BTSE) WsConnect() error { b.Name, err) } - if err != nil { - return err - } - go b.WsHandleData() b.GenerateDefaultSubscriptions() diff --git a/exchanges/huobi/huobi_wrapper.go b/exchanges/huobi/huobi_wrapper.go index 6c256834..81238591 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -152,12 +152,6 @@ func (h *HUOBI) Run() { } exchCfg.BaseCurrencies = currency.Currencies{currency.USD} h.BaseCurrencies = currency.Currencies{currency.USD} - - err = cfg.UpdateExchangeConfig(exchCfg) - if err != nil { - log.Errorf("%s failed to update config. %s\n", h.Name, err) - return - } } if forceUpdate { diff --git a/exchanges/localbitcoins/localbitcoins_wrapper.go b/exchanges/localbitcoins/localbitcoins_wrapper.go index 1f5b6d9a..a34b5917 100644 --- a/exchanges/localbitcoins/localbitcoins_wrapper.go +++ b/exchanges/localbitcoins/localbitcoins_wrapper.go @@ -284,9 +284,8 @@ func (l *LocalBitcoins) SubmitOrder(p currency.Pair, side exchange.OrderSide, _ if err != nil { return submitOrderResponse, err } - if err == nil { - submitOrderResponse.IsOrderPlaced = true - } + + submitOrderResponse.IsOrderPlaced = true // Now to figure out what ad we just submitted // The only details we have are the params above