mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 23:16:54 +00:00
golangci-lint/CI: Bump versions and introduce new linters (#798)
* golangci-lint/CI: Bump versions
Fix remaining linter issues
* Specifically set AppVeyor version
* Fix the infamous typos 👀
* Add go env cmd to AppVeyor
* Add go version cmd to AppVeyor
* Specify AppVeyor image, adjust linters
* Update go get to go install due to deprecation
* Bump golangci-lint timeout time for AppVeyor
* Change NW contract to NQ
* Address nitters
* GetRandomPair -> Pair{}
* Address nits
* Address time nitterinos plus additional tweaks
* More time inception upgrades!
* Bending time and space
This commit is contained in:
@@ -57,6 +57,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func setupWsTests(t *testing.T) {
|
||||
t.Helper()
|
||||
if wsSetupRan {
|
||||
return
|
||||
}
|
||||
@@ -2196,8 +2197,7 @@ func TestQueryWithdrawQuota(t *testing.T) {
|
||||
// TestWsGetAccountsList connects to WS, logs in, gets account list
|
||||
func TestWsGetAccountsList(t *testing.T) {
|
||||
setupWsTests(t)
|
||||
_, err := h.wsGetAccountsList()
|
||||
if err != nil {
|
||||
if _, err := h.wsGetAccountsList(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ func (h *HUOBI) wsHandleData(respRaw []byte) error {
|
||||
return err
|
||||
}
|
||||
h.Websocket.DataHandler <- stream.KlineData{
|
||||
Timestamp: time.Unix(0, kline.Timestamp*int64(time.Millisecond)),
|
||||
Timestamp: time.UnixMilli(kline.Timestamp),
|
||||
Exchange: h.Name,
|
||||
AssetType: a,
|
||||
Pair: p,
|
||||
@@ -388,12 +388,11 @@ func (h *HUOBI) wsHandleData(respRaw []byte) error {
|
||||
Exchange: h.Name,
|
||||
AssetType: a,
|
||||
CurrencyPair: p,
|
||||
Timestamp: time.Unix(0,
|
||||
t.Tick.Data[i].Timestamp*int64(time.Millisecond)),
|
||||
Amount: t.Tick.Data[i].Amount,
|
||||
Price: t.Tick.Data[i].Price,
|
||||
Side: side,
|
||||
TID: strconv.FormatFloat(t.Tick.Data[i].TradeID, 'f', -1, 64),
|
||||
Timestamp: time.UnixMilli(t.Tick.Data[i].Timestamp),
|
||||
Amount: t.Tick.Data[i].Amount,
|
||||
Price: t.Tick.Data[i].Price,
|
||||
Side: side,
|
||||
TID: strconv.FormatFloat(t.Tick.Data[i].TradeID, 'f', -1, 64),
|
||||
})
|
||||
}
|
||||
return trade.AddTradesToBuffer(h.Name, trades...)
|
||||
@@ -427,7 +426,7 @@ func (h *HUOBI) wsHandleData(respRaw []byte) error {
|
||||
QuoteVolume: wsTicker.Tick.Volume,
|
||||
High: wsTicker.Tick.High,
|
||||
Low: wsTicker.Tick.Low,
|
||||
LastUpdated: time.Unix(0, wsTicker.Timestamp*int64(time.Millisecond)),
|
||||
LastUpdated: time.UnixMilli(wsTicker.Timestamp),
|
||||
AssetType: a,
|
||||
Pair: p,
|
||||
}
|
||||
|
||||
@@ -793,8 +793,7 @@ func (h *HUOBI) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (ac
|
||||
}
|
||||
acc.AssetType = assetType
|
||||
info.Accounts = append(info.Accounts, acc)
|
||||
err := account.Process(&info)
|
||||
if err != nil {
|
||||
if err := account.Process(&info); err != nil {
|
||||
return info, err
|
||||
}
|
||||
return info, nil
|
||||
@@ -844,7 +843,7 @@ func (h *HUOBI) GetRecentTrades(ctx context.Context, p currency.Pair, assetType
|
||||
Side: side,
|
||||
Price: tradeData[i].Trades[j].Price,
|
||||
Amount: tradeData[i].Trades[j].Amount,
|
||||
Timestamp: time.Unix(0, tradeData[i].Timestamp*int64(time.Millisecond)),
|
||||
Timestamp: time.UnixMilli(tradeData[i].Timestamp),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1183,7 +1182,7 @@ func (h *HUOBI) GetOrderInfo(ctx context.Context, orderID string, pair currency.
|
||||
Pair: p,
|
||||
Type: orderType,
|
||||
Side: orderSide,
|
||||
Date: time.Unix(0, respData.CreatedAt*int64(time.Millisecond)),
|
||||
Date: time.UnixMilli(respData.CreatedAt),
|
||||
Status: orderStatus,
|
||||
Price: respData.Price,
|
||||
Amount: respData.Amount,
|
||||
@@ -1349,7 +1348,7 @@ func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest
|
||||
Pair: req.Pairs[i],
|
||||
Type: orderType,
|
||||
Side: orderSide,
|
||||
Date: time.Unix(0, resp.Data[j].CreatedAt*int64(time.Millisecond)),
|
||||
Date: time.UnixMilli(resp.Data[j].CreatedAt),
|
||||
Status: orderStatus,
|
||||
Price: resp.Data[j].Price,
|
||||
Amount: resp.Data[j].OrderAmount,
|
||||
@@ -1377,7 +1376,7 @@ func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest
|
||||
Pair: req.Pairs[i],
|
||||
Exchange: h.Name,
|
||||
ExecutedAmount: resp[x].FilledAmount,
|
||||
Date: time.Unix(0, resp[x].CreatedAt*int64(time.Millisecond)),
|
||||
Date: time.UnixMilli(resp[x].CreatedAt),
|
||||
Status: order.Status(resp[x].State),
|
||||
AccountID: strconv.FormatInt(resp[x].AccountID, 10),
|
||||
Fee: resp[x].FilledFees,
|
||||
@@ -1389,7 +1388,7 @@ func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest
|
||||
}
|
||||
case asset.CoinMarginedFutures:
|
||||
for x := range req.Pairs {
|
||||
var currentPage int64 = 0
|
||||
var currentPage int64
|
||||
for done := false; !done; {
|
||||
openOrders, err := h.GetSwapOpenOrders(ctx,
|
||||
req.Pairs[x], currentPage, 50)
|
||||
@@ -1429,7 +1428,7 @@ func (h *HUOBI) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest
|
||||
}
|
||||
case asset.Futures:
|
||||
for x := range req.Pairs {
|
||||
var currentPage int64 = 0
|
||||
var currentPage int64
|
||||
for done := false; !done; {
|
||||
openOrders, err := h.FGetOpenOrders(ctx,
|
||||
req.Pairs[x].Base, currentPage, 50)
|
||||
@@ -1508,7 +1507,7 @@ func (h *HUOBI) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest
|
||||
Pair: req.Pairs[i],
|
||||
Exchange: h.Name,
|
||||
ExecutedAmount: resp[x].FilledAmount,
|
||||
Date: time.Unix(0, resp[x].CreatedAt*int64(time.Millisecond)),
|
||||
Date: time.UnixMilli(resp[x].CreatedAt),
|
||||
Status: order.Status(resp[x].State),
|
||||
AccountID: strconv.FormatInt(resp[x].AccountID, 10),
|
||||
Fee: resp[x].FilledFees,
|
||||
@@ -1519,7 +1518,7 @@ func (h *HUOBI) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest
|
||||
}
|
||||
case asset.CoinMarginedFutures:
|
||||
for x := range req.Pairs {
|
||||
var currentPage int64 = 0
|
||||
var currentPage int64
|
||||
for done := false; !done; {
|
||||
orderHistory, err := h.GetSwapOrderHistory(ctx,
|
||||
req.Pairs[x],
|
||||
@@ -1570,7 +1569,7 @@ func (h *HUOBI) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest
|
||||
}
|
||||
case asset.Futures:
|
||||
for x := range req.Pairs {
|
||||
var currentPage int64 = 0
|
||||
var currentPage int64
|
||||
for done := false; !done; {
|
||||
openOrders, err := h.FGetOrderHistory(ctx,
|
||||
req.Pairs[x],
|
||||
|
||||
Reference in New Issue
Block a user