diff --git a/.appveyor.yml b/.appveyor.yml index fa4b4c53..f396064b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -55,7 +55,7 @@ before_test: test_script: # test back-end - - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0 + - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 - '%GOPATH%\bin\golangci-lint.exe run --verbose' - ps: >- if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') { diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 94fb004b..2bb1e02d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -12,4 +12,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.51.0 + version: v1.52.2 diff --git a/Makefile b/Makefile index 9d2880fa..ddc30b18 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ LDFLAGS = -ldflags "-w -s" GCTPKG = github.com/thrasher-corp/gocryptotrader -LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0 +LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 LINTBIN = $(GOPATH)/bin/golangci-lint GCTLISTENPORT=9050 GCTPROFILERLISTENPORT=8085 diff --git a/backtester/engine/live.go b/backtester/engine/live.go index edf6b9c9..658d79c8 100644 --- a/backtester/engine/live.go +++ b/backtester/engine/live.go @@ -495,9 +495,8 @@ func (c *liveDataSourceDataHandler) loadCandleData(timeToRetrieve time.Time) (bo if i < c.dataRequestRetryTolerance { log.Errorf(common.Data, "%v %v %v failed to retrieve data %v of %v attempts: %v", c.exchangeName, c.asset, c.pair, i, c.dataRequestRetryTolerance, err) continue - } else { - return false, err } + return false, err } break } diff --git a/backtester/eventhandlers/statistics/currencystatistics_test.go b/backtester/eventhandlers/statistics/currencystatistics_test.go index d6ad2e62..52e8ab31 100644 --- a/backtester/eventhandlers/statistics/currencystatistics_test.go +++ b/backtester/eventhandlers/statistics/currencystatistics_test.go @@ -156,7 +156,7 @@ func TestCalculateResults(t *testing.T) { } } -func TestPrintResults(t *testing.T) { +func TestPrintResults(_ *testing.T) { cs := CurrencyPairStatistic{} tt1 := time.Now() tt2 := time.Now().Add(gctkline.OneDay.Duration()) diff --git a/backtester/eventhandlers/strategies/strategies_test.go b/backtester/eventhandlers/strategies/strategies_test.go index 2bd8e622..9dd2b61f 100644 --- a/backtester/eventhandlers/strategies/strategies_test.go +++ b/backtester/eventhandlers/strategies/strategies_test.go @@ -126,10 +126,10 @@ func (s *customStrategy) SupportsSimultaneousProcessing() bool { func (s *customStrategy) OnSignal(d data.Handler, _ funding.IFundingTransferer, _ portfolio.Handler) (signal.Event, error) { return s.createSignal(d) } -func (s *customStrategy) OnSimultaneousSignals(d []data.Handler, f funding.IFundingTransferer, p portfolio.Handler) ([]signal.Event, error) { +func (s *customStrategy) OnSimultaneousSignals(_ []data.Handler, _ funding.IFundingTransferer, _ portfolio.Handler) ([]signal.Event, error) { return nil, nil } -func (s *customStrategy) createSignal(d data.Handler) (*signal.Signal, error) { +func (s *customStrategy) createSignal(_ data.Handler) (*signal.Signal, error) { return nil, nil } func (s *customStrategy) SetCustomSettings(map[string]interface{}) error { diff --git a/backtester/funding/funding_test.go b/backtester/funding/funding_test.go index 6a0eccfd..4b409643 100644 --- a/backtester/funding/funding_test.go +++ b/backtester/funding/funding_test.go @@ -1049,7 +1049,7 @@ func (f *fakeEvent) GetInterval() gctkline.Interval { return gctkline. func (f *fakeEvent) GetAssetType() asset.Item { return asset.Spot } func (f *fakeEvent) AppendReason(string) {} func (f *fakeEvent) GetClosePrice() decimal.Decimal { return elite } -func (f *fakeEvent) AppendReasonf(s string, i ...interface{}) {} +func (f *fakeEvent) AppendReasonf(_ string, _ ...interface{}) {} func (f *fakeEvent) GetBase() *event.Base { return &event.Base{} } func (f *fakeEvent) GetUnderlyingPair() currency.Pair { return pair } func (f *fakeEvent) GetConcatReasons() string { return "" } diff --git a/backtester/plugins/strategies/example/example-strategy.go b/backtester/plugins/strategies/example/example-strategy.go index f5ad6b8f..e4e240f3 100644 --- a/backtester/plugins/strategies/example/example-strategy.go +++ b/backtester/plugins/strategies/example/example-strategy.go @@ -46,7 +46,7 @@ func (s *CustomStrategy) OnSignal(d data.Handler, _ funding.IFundingTransferer, // OnSimultaneousSignals analyses multiple data points simultaneously, allowing flexibility // in allowing a strategy to only place an order for X currency if Y currency's price is Z -func (s *CustomStrategy) OnSimultaneousSignals(d []data.Handler, f funding.IFundingTransferer, p portfolio.Handler) ([]signal.Event, error) { +func (s *CustomStrategy) OnSimultaneousSignals(d []data.Handler, _ funding.IFundingTransferer, _ portfolio.Handler) ([]signal.Event, error) { response := make([]signal.Event, len(d)) for i := range d { sig, err := s.createSignal(d[i]) diff --git a/backtester/plugins/strategies/loader_test.go b/backtester/plugins/strategies/loader_test.go index 129dd96f..d8839adb 100644 --- a/backtester/plugins/strategies/loader_test.go +++ b/backtester/plugins/strategies/loader_test.go @@ -50,11 +50,11 @@ func (s *CustomStrategy) SupportsSimultaneousProcessing() bool { func (s *CustomStrategy) OnSignal(d data.Handler, _ funding.IFundingTransferer, _ portfolio.Handler) (signal.Event, error) { return s.createSignal(d) } -func (s *CustomStrategy) OnSimultaneousSignals(d []data.Handler, f funding.IFundingTransferer, p portfolio.Handler) ([]signal.Event, error) { +func (s *CustomStrategy) OnSimultaneousSignals(_ []data.Handler, _ funding.IFundingTransferer, _ portfolio.Handler) ([]signal.Event, error) { return nil, nil } -func (s *CustomStrategy) createSignal(d data.Handler) (*signal.Signal, error) { +func (s *CustomStrategy) createSignal(_ data.Handler) (*signal.Signal, error) { return nil, nil } diff --git a/backtester/report/report.go b/backtester/report/report.go index c09378dd..e398622e 100644 --- a/backtester/report/report.go +++ b/backtester/report/report.go @@ -144,7 +144,7 @@ func (d *Data) enhanceCandles() error { Asset: lookup.Asset, Pair: lookup.Pair, Interval: lookup.Interval, - Watermark: fmt.Sprintf("%s - %s - %s", strings.Title(lookup.Exchange), lookup.Asset.String(), lookup.Pair.Upper()), //nolint:staticcheck // Ignore Title usage warning + Watermark: fmt.Sprintf("%s - %s - %s", strings.Title(lookup.Exchange), lookup.Asset.String(), lookup.Pair.Upper()), } statsForCandles := diff --git a/cmd/documentation/documentation.go b/cmd/documentation/documentation.go index a8071a70..12cfb156 100644 --- a/cmd/documentation/documentation.go +++ b/cmd/documentation/documentation.go @@ -492,7 +492,7 @@ func GetPackageName(name string, capital bool) string { i = len(newStrings) - 1 } if capital { - return strings.Replace(strings.Title(newStrings[i]), "_", " ", -1) //nolint:staticcheck // Ignore Title usage warning + return strings.Replace(strings.Title(newStrings[i]), "_", " ", -1) } return newStrings[i] } diff --git a/cmd/exchange_template/exchange_template.go b/cmd/exchange_template/exchange_template.go index b429e0ab..6c5f806d 100644 --- a/cmd/exchange_template/exchange_template.go +++ b/cmd/exchange_template/exchange_template.go @@ -146,7 +146,7 @@ func makeExchange(exchangeDirectory string, configTestFile *config.Config, exch fmt.Printf("Output directory: %s\n", exchangeDirectory) - exch.CapitalName = strings.Title(exch.Name) //nolint:staticcheck // Ignore Title usage warning + exch.CapitalName = strings.Title(exch.Name) exch.Variable = exch.Name[0:2] newExchConfig := &config.Exchange{} newExchConfig.Name = exch.CapitalName diff --git a/communications/base/base_test.go b/communications/base/base_test.go index 24c0856c..6d1ca1a5 100644 --- a/communications/base/base_test.go +++ b/communications/base/base_test.go @@ -9,7 +9,7 @@ var ( b Base ) -func TestStart(t *testing.T) { +func TestStart(_ *testing.T) { b = Base{ Name: "test", Enabled: true, @@ -71,7 +71,7 @@ func (p *CommunicationProvider) Connect() error { return nil } -func (p *CommunicationProvider) PushEvent(e Event) error { +func (p *CommunicationProvider) PushEvent(_ Event) error { p.PushEventCalled = true return nil } diff --git a/currency/coinmarketcap/coinmarketcap_test.go b/currency/coinmarketcap/coinmarketcap_test.go index 9779c968..4cdd7bdb 100644 --- a/currency/coinmarketcap/coinmarketcap_test.go +++ b/currency/coinmarketcap/coinmarketcap_test.go @@ -28,7 +28,7 @@ func areAPICredtionalsSet(minAllowable uint8) bool { return false } -func TestSetDefaults(t *testing.T) { +func TestSetDefaults(_ *testing.T) { c.SetDefaults() } diff --git a/currency/forexprovider/fixer.io/fixer_test.go b/currency/forexprovider/fixer.io/fixer_test.go index 49a5ae4e..98afc083 100644 --- a/currency/forexprovider/fixer.io/fixer_test.go +++ b/currency/forexprovider/fixer.io/fixer_test.go @@ -13,6 +13,7 @@ var f Fixer var isSetup bool +//nolint:gocritic // Only used as a testing helper function in this package func setup(t *testing.T) { t.Helper() if !isSetup { diff --git a/database/repository/audit/audit_test.go b/database/repository/audit/audit_test.go index 22292602..24f24d7f 100644 --- a/database/repository/audit/audit_test.go +++ b/database/repository/audit/audit_test.go @@ -99,6 +99,7 @@ func TestAudit(t *testing.T) { } } +//nolint:gocritic // Only used as a testing helper function in this package func writeAudit(t *testing.T) { t.Helper() var wg sync.WaitGroup @@ -116,6 +117,7 @@ func writeAudit(t *testing.T) { wg.Wait() } +//nolint:gocritic // Only used as a testing helper function in this package func readHelper(t *testing.T) { t.Helper() diff --git a/database/repository/withdraw/withdraw_test.go b/database/repository/withdraw/withdraw_test.go index 3cb04869..09d5f13b 100644 --- a/database/repository/withdraw/withdraw_test.go +++ b/database/repository/withdraw/withdraw_test.go @@ -153,6 +153,8 @@ func seedWithdrawData() { Event(resp) } } + +//nolint:gocritic // Only used as a testing helper function in this package func withdrawHelper(t *testing.T) { t.Helper() seedWithdrawData() diff --git a/engine/apiserver.go b/engine/apiserver.go index 982b82f8..d658e3b1 100644 --- a/engine/apiserver.go +++ b/engine/apiserver.go @@ -794,7 +794,7 @@ func wsSaveConfig(client *websocketClient, data interface{}) error { return client.SendWebsocketMessage(wsResp) } -func wsGetAccountInfo(client *websocketClient, data interface{}) error { +func wsGetAccountInfo(client *websocketClient, _ interface{}) error { accountInfo := getAllActiveAccounts(client.exchangeManager) wsResp := WebsocketEventResponse{ Event: "GetAccountInfo", @@ -803,7 +803,7 @@ func wsGetAccountInfo(client *websocketClient, data interface{}) error { return client.SendWebsocketMessage(wsResp) } -func wsGetTickers(client *websocketClient, data interface{}) error { +func wsGetTickers(client *websocketClient, _ interface{}) error { wsResp := WebsocketEventResponse{ Event: "GetTickers", } @@ -863,7 +863,7 @@ func wsGetTicker(client *websocketClient, data interface{}) error { return client.SendWebsocketMessage(wsResp) } -func wsGetOrderbooks(client *websocketClient, data interface{}) error { +func wsGetOrderbooks(client *websocketClient, _ interface{}) error { wsResp := WebsocketEventResponse{ Event: "GetOrderbooks", } @@ -923,7 +923,7 @@ func wsGetOrderbook(client *websocketClient, data interface{}) error { return nil } -func wsGetExchangeRates(client *websocketClient, data interface{}) error { +func wsGetExchangeRates(client *websocketClient, _ interface{}) error { wsResp := WebsocketEventResponse{ Event: "GetExchangeRates", } @@ -937,7 +937,7 @@ func wsGetExchangeRates(client *websocketClient, data interface{}) error { return client.SendWebsocketMessage(wsResp) } -func wsGetPortfolio(client *websocketClient, data interface{}) error { +func wsGetPortfolio(client *websocketClient, _ interface{}) error { wsResp := WebsocketEventResponse{ Event: "GetPortfolio", } diff --git a/engine/currency_state_manager_test.go b/engine/currency_state_manager_test.go index b23bc1ff..6f5663c2 100644 --- a/engine/currency_state_manager_test.go +++ b/engine/currency_state_manager_test.go @@ -86,35 +86,35 @@ func (f *fakerino) GetCurrencyStateSnapshot() ([]currencystate.Snapshot, error) }, nil } -func (f *fakerino) CanWithdraw(c currency.Code, a asset.Item) error { +func (f *fakerino) CanWithdraw(_ currency.Code, _ asset.Item) error { if f.errorMe { return errExchange } return nil } -func (f *fakerino) CanDeposit(c currency.Code, a asset.Item) error { +func (f *fakerino) CanDeposit(_ currency.Code, _ asset.Item) error { if f.errorMe { return errExchange } return nil } -func (f *fakerino) CanTrade(c currency.Code, a asset.Item) error { +func (f *fakerino) CanTrade(_ currency.Code, _ asset.Item) error { if f.errorMe { return errExchange } return nil } -func (f *fakerino) CanTradePair(p currency.Pair, a asset.Item) error { +func (f *fakerino) CanTradePair(_ currency.Pair, _ asset.Item) error { if f.errorMe { return errExchange } return nil } -func (f *fakerino) GetAvailablePairs(a asset.Item) (currency.Pairs, error) { +func (f *fakerino) GetAvailablePairs(_ asset.Item) (currency.Pairs, error) { if f.GetAvailablePairsError { return nil, errExchange } @@ -366,7 +366,7 @@ func TestCanTradePairRPC(t *testing.T) { } } -func TestUpdate(t *testing.T) { +func TestUpdate(_ *testing.T) { man := &CurrencyStateManager{} var wg sync.WaitGroup wg.Add(3) diff --git a/engine/database_connection_test.go b/engine/database_connection_test.go index 9418aa4f..52a9d77c 100644 --- a/engine/database_connection_test.go +++ b/engine/database_connection_test.go @@ -10,6 +10,7 @@ import ( "github.com/thrasher-corp/gocryptotrader/database/drivers" ) +//nolint:gocritic // Only used as a testing helper function in this package func CreateDatabase(t *testing.T) { t.Helper() // fun workarounds to globals ruining testing diff --git a/engine/datahistory_manager_test.go b/engine/datahistory_manager_test.go index d39760e3..0a7782d0 100644 --- a/engine/datahistory_manager_test.go +++ b/engine/datahistory_manager_test.go @@ -1561,7 +1561,7 @@ type dhmExchange struct { exchange.IBotExchange } -func (f dhmExchange) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { +func (f dhmExchange) GetHistoricCandlesExtended(_ context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { return &kline.Item{ Exchange: testExchange, Pair: p, @@ -1596,7 +1596,7 @@ func (f dhmExchange) GetHistoricCandlesExtended(ctx context.Context, p currency. }, nil } -func (f dhmExchange) GetHistoricTrades(ctx context.Context, p currency.Pair, a asset.Item, startTime, endTime time.Time) ([]trade.Data, error) { +func (f dhmExchange) GetHistoricTrades(_ context.Context, p currency.Pair, a asset.Item, startTime, _ time.Time) ([]trade.Data, error) { return []trade.Data{ { Exchange: testExchange, diff --git a/engine/helpers_test.go b/engine/helpers_test.go index 8b1c643a..d5511ee9 100644 --- a/engine/helpers_test.go +++ b/engine/helpers_test.go @@ -1034,7 +1034,7 @@ func (f fakeDepositExchange) GetAvailableTransferChains(_ context.Context, c cur return []string{"BITCOIN"}, nil } -func (f fakeDepositExchange) GetDepositAddress(_ context.Context, c currency.Code, chain, accountID string) (*deposit.Address, error) { +func (f fakeDepositExchange) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error) { if f.ThrowDepositAddressError { return nil, errors.New("unable to get deposit address") } diff --git a/engine/order_manager_test.go b/engine/order_manager_test.go index 2daf865b..943cf1d1 100644 --- a/engine/order_manager_test.go +++ b/engine/order_manager_test.go @@ -29,11 +29,11 @@ type omfExchange struct { // CancelOrder overrides testExchange's cancel order function // to do the bare minimum required with no API calls or credentials required -func (f omfExchange) CancelOrder(ctx context.Context, o *order.Cancel) error { +func (f omfExchange) CancelOrder(_ context.Context, _ *order.Cancel) error { return nil } -func (f omfExchange) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { +func (f omfExchange) FetchTicker(_ context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { return &ticker.Price{ Last: 1337, High: 1337, @@ -60,7 +60,7 @@ func (f omfExchange) FetchTicker(ctx context.Context, p currency.Pair, a asset.I // GetOrderInfo overrides testExchange's get order function // to do the bare minimum required with no API calls or credentials required -func (f omfExchange) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (f omfExchange) GetOrderInfo(_ context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { switch orderID { case "": return order.Detail{}, errors.New("") @@ -98,7 +98,7 @@ func (f omfExchange) GetOrderInfo(ctx context.Context, orderID string, pair curr } // GetActiveOrders overrides the function used by processOrders to return 1 active order -func (f omfExchange) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) (order.FilteredOrders, error) { +func (f omfExchange) GetActiveOrders(_ context.Context, _ *order.GetOrdersRequest) (order.FilteredOrders, error) { return []order.Detail{{ Exchange: testExchange, Pair: currency.Pair{Base: currency.BTC, Quote: currency.USD}, @@ -111,7 +111,7 @@ func (f omfExchange) GetActiveOrders(ctx context.Context, req *order.GetOrdersRe }}, nil } -func (f omfExchange) ModifyOrder(ctx context.Context, action *order.Modify) (*order.ModifyResponse, error) { +func (f omfExchange) ModifyOrder(_ context.Context, action *order.Modify) (*order.ModifyResponse, error) { modResp, err := action.DeriveModifyResponse() if err != nil { return nil, err @@ -120,7 +120,7 @@ func (f omfExchange) ModifyOrder(ctx context.Context, action *order.Modify) (*or return modResp, nil } -func (f omfExchange) GetFuturesPositions(ctx context.Context, req *order.PositionsRequest) ([]order.PositionDetails, error) { +func (f omfExchange) GetFuturesPositions(_ context.Context, req *order.PositionsRequest) ([]order.PositionDetails, error) { id, err := uuid.NewV4() if err != nil { return nil, err diff --git a/engine/rpcserver.go b/engine/rpcserver.go index 79b29eb3..485de844 100644 --- a/engine/rpcserver.go +++ b/engine/rpcserver.go @@ -1589,7 +1589,7 @@ func (s *RPCServer) AddEvent(_ context.Context, r *gctrpc.AddEventRequest) (*gct } // RemoveEvent removes an event, specified by an event ID -func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.GenericResponse, error) { +func (s *RPCServer) RemoveEvent(_ context.Context, r *gctrpc.RemoveEventRequest) (*gctrpc.GenericResponse, error) { if !s.eventManager.Remove(r.Id) { return nil, fmt.Errorf("event %d not removed", r.Id) } @@ -1599,7 +1599,7 @@ func (s *RPCServer) RemoveEvent(ctx context.Context, r *gctrpc.RemoveEventReques // GetCryptocurrencyDepositAddresses returns a list of cryptocurrency deposit // addresses specified by an exchange -func (s *RPCServer) GetCryptocurrencyDepositAddresses(ctx context.Context, r *gctrpc.GetCryptocurrencyDepositAddressesRequest) (*gctrpc.GetCryptocurrencyDepositAddressesResponse, error) { +func (s *RPCServer) GetCryptocurrencyDepositAddresses(_ context.Context, r *gctrpc.GetCryptocurrencyDepositAddressesRequest) (*gctrpc.GetCryptocurrencyDepositAddressesResponse, error) { exch, err := s.GetExchangeByName(r.Exchange) if err != nil { return nil, err @@ -5329,7 +5329,7 @@ func (s *RPCServer) GetMarginRatesHistory(ctx context.Context, r *gctrpc.GetMarg // GetOrderbookMovement using the requested amount simulates a buy or sell and // returns the nominal/impact percentages and costings. -func (s *RPCServer) GetOrderbookMovement(ctx context.Context, r *gctrpc.GetOrderbookMovementRequest) (*gctrpc.GetOrderbookMovementResponse, error) { +func (s *RPCServer) GetOrderbookMovement(_ context.Context, r *gctrpc.GetOrderbookMovementRequest) (*gctrpc.GetOrderbookMovementResponse, error) { exch, err := s.GetExchangeByName(r.Exchange) if err != nil { return nil, err @@ -5406,7 +5406,7 @@ func (s *RPCServer) GetOrderbookMovement(ctx context.Context, r *gctrpc.GetOrder // GetOrderbookAmountByNominal using the requested nominal percentage requirement // returns the amount on orderbook that can fit without exceeding that value. -func (s *RPCServer) GetOrderbookAmountByNominal(ctx context.Context, r *gctrpc.GetOrderbookAmountByNominalRequest) (*gctrpc.GetOrderbookAmountByNominalResponse, error) { +func (s *RPCServer) GetOrderbookAmountByNominal(_ context.Context, r *gctrpc.GetOrderbookAmountByNominalRequest) (*gctrpc.GetOrderbookAmountByNominalResponse, error) { exch, err := s.GetExchangeByName(r.Exchange) if err != nil { return nil, err @@ -5479,7 +5479,7 @@ func (s *RPCServer) GetOrderbookAmountByNominal(ctx context.Context, r *gctrpc.G // GetOrderbookAmountByImpact using the requested impact percentage requirement // determines the amount on orderbook that can fit that will slip the orderbook. -func (s *RPCServer) GetOrderbookAmountByImpact(ctx context.Context, r *gctrpc.GetOrderbookAmountByImpactRequest) (*gctrpc.GetOrderbookAmountByImpactResponse, error) { +func (s *RPCServer) GetOrderbookAmountByImpact(_ context.Context, r *gctrpc.GetOrderbookAmountByImpactRequest) (*gctrpc.GetOrderbookAmountByImpactResponse, error) { exch, err := s.GetExchangeByName(r.Exchange) if err != nil { return nil, err diff --git a/engine/rpcserver_test.go b/engine/rpcserver_test.go index 89d4d7f5..1a7ffb27 100644 --- a/engine/rpcserver_test.go +++ b/engine/rpcserver_test.go @@ -75,7 +75,7 @@ func (f fExchange) GetPositionSummary(context.Context, *order.PositionSummaryReq }, nil } -func (f fExchange) GetFuturesPositions(ctx context.Context, req *order.PositionsRequest) ([]order.PositionDetails, error) { +func (f fExchange) GetFuturesPositions(_ context.Context, req *order.PositionsRequest) ([]order.PositionDetails, error) { id, err := uuid.NewV4() if err != nil { return nil, err @@ -110,7 +110,7 @@ func (f fExchange) GetFuturesPositions(ctx context.Context, req *order.Positions return resp, nil } -func (f fExchange) GetFundingRates(ctx context.Context, request *order.FundingRatesRequest) ([]order.FundingRates, error) { +func (f fExchange) GetFundingRates(_ context.Context, request *order.FundingRatesRequest) ([]order.FundingRates, error) { leet := decimal.NewFromInt(1337) return []order.FundingRates{ { @@ -141,7 +141,7 @@ func (f fExchange) GetFundingRates(ctx context.Context, request *order.FundingRa }, nil } -func (f fExchange) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { +func (f fExchange) GetHistoricCandles(_ context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { return &kline.Item{ Exchange: fakeExchangeName, Pair: p, @@ -176,7 +176,7 @@ func generateCandles(amount int, timeStart time.Time, interval kline.Interval) [ return candy } -func (f fExchange) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { +func (f fExchange) GetHistoricCandlesExtended(_ context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, _ time.Time) (*kline.Item, error) { if interval == 0 { return nil, errExpectedTestError } @@ -220,7 +220,7 @@ func (f fExchange) GetMarginRatesHistory(context.Context, *margin.RateHistoryReq return resp, nil } -func (f fExchange) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { +func (f fExchange) FetchTicker(_ context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { return &ticker.Price{ Last: 1337, High: 1337, @@ -311,7 +311,7 @@ func (f fExchange) CalculateTotalCollateral(context.Context, *order.TotalCollate // UpdateAccountInfo overrides testExchange's update account info function // to do the bare minimum required with no API calls or credentials required -func (f fExchange) UpdateAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error) { +func (f fExchange) UpdateAccountInfo(_ context.Context, a asset.Item) (account.Holdings, error) { if a == asset.Futures { return account.Holdings{}, errAssetTypeDisabled } @@ -338,22 +338,22 @@ func (f fExchange) GetCurrencyStateSnapshot() ([]currencystate.Snapshot, error) } // CanTradePair overrides interface function -func (f fExchange) CanTradePair(p currency.Pair, a asset.Item) error { +func (f fExchange) CanTradePair(_ currency.Pair, _ asset.Item) error { return nil } // CanTrade overrides interface function -func (f fExchange) CanTrade(c currency.Code, a asset.Item) error { +func (f fExchange) CanTrade(_ currency.Code, _ asset.Item) error { return nil } // CanWithdraw overrides interface function -func (f fExchange) CanWithdraw(c currency.Code, a asset.Item) error { +func (f fExchange) CanWithdraw(_ currency.Code, _ asset.Item) error { return nil } // CanDeposit overrides interface function -func (f fExchange) CanDeposit(c currency.Code, a asset.Item) error { +func (f fExchange) CanDeposit(_ currency.Code, _ asset.Item) error { return nil } @@ -1132,8 +1132,8 @@ func (d *dummyServer) SetHeader(metadata.MD) error { return nil } func (d *dummyServer) SendHeader(metadata.MD) error { return nil } func (d *dummyServer) SetTrailer(metadata.MD) {} func (d *dummyServer) Context() context.Context { return context.Background() } -func (d *dummyServer) SendMsg(m interface{}) error { return nil } -func (d *dummyServer) RecvMsg(m interface{}) error { return nil } +func (d *dummyServer) SendMsg(_ interface{}) error { return nil } +func (d *dummyServer) RecvMsg(_ interface{}) error { return nil } func TestGetHistoricTrades(t *testing.T) { engerino := RPCTestSetup(t) diff --git a/exchanges/alphapoint/alphapoint.go b/exchanges/alphapoint/alphapoint.go index 74cfd21c..1b669e12 100644 --- a/exchanges/alphapoint/alphapoint.go +++ b/exchanges/alphapoint/alphapoint.go @@ -540,7 +540,7 @@ func (a *Alphapoint) GetOrderFee(ctx context.Context, symbol, side string, quant } // SendHTTPRequest sends an unauthenticated HTTP request -func (a *Alphapoint) SendHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, data map[string]interface{}, result interface{}) error { +func (a *Alphapoint) SendHTTPRequest(_ context.Context, ep exchange.URL, method, path string, data map[string]interface{}, result interface{}) error { endpoint, err := a.API.Endpoints.GetURL(ep) if err != nil { return err diff --git a/exchanges/alphapoint/alphapoint_wrapper.go b/exchanges/alphapoint/alphapoint_wrapper.go index 07dbab8c..e962072a 100644 --- a/exchanges/alphapoint/alphapoint_wrapper.go +++ b/exchanges/alphapoint/alphapoint_wrapper.go @@ -23,7 +23,7 @@ import ( ) // GetDefaultConfig returns a default exchange config for Alphapoint -func (a *Alphapoint) GetDefaultConfig(ctx context.Context) (*config.Exchange, error) { +func (a *Alphapoint) GetDefaultConfig(_ context.Context) (*config.Exchange, error) { return nil, common.ErrFunctionNotSupported } @@ -87,7 +87,7 @@ func (a *Alphapoint) FetchTradablePairs(_ context.Context, _ asset.Item) (curren // UpdateTradablePairs updates the exchanges available pairs and stores // them in the exchanges config -func (a *Alphapoint) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error { +func (a *Alphapoint) UpdateTradablePairs(_ context.Context, _ bool) error { return common.ErrFunctionNotSupported } @@ -145,7 +145,7 @@ func (a *Alphapoint) FetchAccountInfo(ctx context.Context, assetType asset.Item) } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (a *Alphapoint) UpdateTickers(assetType asset.Item) error { +func (a *Alphapoint) UpdateTickers(_ asset.Item) error { return common.ErrFunctionNotSupported } @@ -230,13 +230,13 @@ func (a *Alphapoint) FetchOrderbook(ctx context.Context, p currency.Pair, assetT // GetFundingHistory returns funding history, deposits and // withdrawals -func (a *Alphapoint) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (a *Alphapoint) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { // https://alphapoint.github.io/slate/#generatetreasuryactivityreport return nil, common.ErrNotYetImplemented } // GetWithdrawalsHistory returns previous withdrawals data -func (a *Alphapoint) GetWithdrawalsHistory(ctx context.Context, c currency.Code, as asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (a *Alphapoint) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -294,7 +294,7 @@ func (a *Alphapoint) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (a *Alphapoint) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (a *Alphapoint) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -308,7 +308,7 @@ func (a *Alphapoint) CancelAllOrders(ctx context.Context, orderCancellation *ord } // GetOrderInfo returns order information based on order ID -func (a *Alphapoint) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (float64, error) { +func (a *Alphapoint) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (float64, error) { orders, err := a.GetOrders(ctx) if err != nil { return 0, err diff --git a/exchanges/binance/binance_wrapper.go b/exchanges/binance/binance_wrapper.go index 97479720..aa5cdd8a 100644 --- a/exchanges/binance/binance_wrapper.go +++ b/exchanges/binance/binance_wrapper.go @@ -807,12 +807,12 @@ func (b *Binance) FetchAccountInfo(ctx context.Context, assetType asset.Item) (a // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *Binance) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *Binance) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Binance) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Binance) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { w, err := b.WithdrawHistory(ctx, c, "", time.Time{}, time.Time{}, 0, 10000) if err != nil { return nil, err @@ -1114,7 +1114,7 @@ func (b *Binance) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *Binance) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *Binance) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } diff --git a/exchanges/binanceus/binanceus_wrapper.go b/exchanges/binanceus/binanceus_wrapper.go index 478fd170..c23e09cb 100644 --- a/exchanges/binanceus/binanceus_wrapper.go +++ b/exchanges/binanceus/binanceus_wrapper.go @@ -475,7 +475,7 @@ func (bi *Binanceus) FetchAccountInfo(ctx context.Context, assetType asset.Item) } // GetFundingHistory returns funding history, deposits and withdrawals -func (bi *Binanceus) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (bi *Binanceus) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } @@ -639,7 +639,7 @@ func (bi *Binanceus) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels orders by their corresponding ID numbers -func (bi *Binanceus) CancelBatchOrders(ctx context.Context, orders []order.Cancel) (order.CancelBatchResponse, error) { +func (bi *Binanceus) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrFunctionNotSupported } @@ -761,13 +761,13 @@ func (bi *Binanceus) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRe // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted. But, GCT has no concept of withdrawal via SEN // the fiat withdrawal end point of Binance.US is built to submit a USD withdraw request via Silvergate Exchange Network (SEN). // So, this method is not implemented. -func (bi *Binanceus) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (bi *Binanceus) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrNotYetImplemented } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted // But, GCT has no concept of withdrawal via SEN the fiat withdrawal end point of Binance.US is built to submit a USD withdraw request via Silvergate Exchange Network (SEN). -func (bi *Binanceus) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (bi *Binanceus) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrNotYetImplemented } @@ -843,7 +843,7 @@ func (bi *Binanceus) GetActiveOrders(ctx context.Context, getOrdersRequest *orde } // GetOrderHistory retrieves account order information Can Limit response to specific order status -func (bi *Binanceus) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) (order.FilteredOrders, error) { +func (bi *Binanceus) GetOrderHistory(_ context.Context, _ *order.GetOrdersRequest) (order.FilteredOrders, error) { // An endpoint like /api/v3/allOrders does not exist in the binance us // so This end point is left unimplemented return nil, common.ErrFunctionNotSupported diff --git a/exchanges/bitfinex/bitfinex_test.go b/exchanges/bitfinex/bitfinex_test.go index 6d239576..45ee8ba3 100644 --- a/exchanges/bitfinex/bitfinex_test.go +++ b/exchanges/bitfinex/bitfinex_test.go @@ -1085,6 +1085,7 @@ func TestWsAuth(t *testing.T) { runAuth(t) } +//nolint:gocritic // Only used as a testing helper function in this package func runAuth(t *testing.T) { t.Helper() setupWs() diff --git a/exchanges/bitfinex/bitfinex_wrapper.go b/exchanges/bitfinex/bitfinex_wrapper.go index 16c88bb8..73642163 100644 --- a/exchanges/bitfinex/bitfinex_wrapper.go +++ b/exchanges/bitfinex/bitfinex_wrapper.go @@ -553,12 +553,12 @@ func (b *Bitfinex) FetchAccountInfo(ctx context.Context, assetType asset.Item) ( // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *Bitfinex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *Bitfinex) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Bitfinex) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Bitfinex) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -691,7 +691,7 @@ func (b *Bitfinex) SubmitOrder(ctx context.Context, o *order.Submit) (*order.Sub // ModifyOrder will allow of changing orderbook placement and limit to // market conversion -func (b *Bitfinex) ModifyOrder(ctx context.Context, action *order.Modify) (*order.ModifyResponse, error) { +func (b *Bitfinex) ModifyOrder(_ context.Context, action *order.Modify) (*order.ModifyResponse, error) { if !b.Websocket.CanUseAuthenticatedWebsocketForWrapper() { return nil, common.ErrNotYetImplemented } @@ -739,7 +739,7 @@ func (b *Bitfinex) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *Bitfinex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *Bitfinex) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -755,7 +755,7 @@ func (b *Bitfinex) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order. } // GetOrderInfo returns order information based on order ID -func (b *Bitfinex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *Bitfinex) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/bitflyer/bitflyer_wrapper.go b/exchanges/bitflyer/bitflyer_wrapper.go index def9571e..5b7b3499 100644 --- a/exchanges/bitflyer/bitflyer_wrapper.go +++ b/exchanges/bitflyer/bitflyer_wrapper.go @@ -202,7 +202,7 @@ func (b *Bitflyer) UpdateTradablePairs(ctx context.Context, forceUpdate bool) er } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (b *Bitflyer) UpdateTickers(ctx context.Context, a asset.Item) error { +func (b *Bitflyer) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } diff --git a/exchanges/bithumb/bithumb_wrapper.go b/exchanges/bithumb/bithumb_wrapper.go index 3f29be5d..2529254d 100644 --- a/exchanges/bithumb/bithumb_wrapper.go +++ b/exchanges/bithumb/bithumb_wrapper.go @@ -237,7 +237,7 @@ func (b *Bithumb) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (b *Bithumb) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (b *Bithumb) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { currencies, err := b.GetTradablePairs(ctx) if err != nil { return nil, err @@ -427,12 +427,12 @@ func (b *Bithumb) FetchAccountInfo(ctx context.Context, assetType asset.Item) (a // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *Bithumb) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *Bithumb) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Bithumb) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Bithumb) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -532,7 +532,7 @@ func (b *Bithumb) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *Bithumb) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *Bithumb) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -579,7 +579,7 @@ func (b *Bithumb) CancelAllOrders(ctx context.Context, orderCancellation *order. } // GetOrderInfo returns order information based on order ID -func (b *Bithumb) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *Bithumb) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/bitmex/bitmex_parameters.go b/exchanges/bitmex/bitmex_parameters.go index a0afd6c9..74425c5c 100644 --- a/exchanges/bitmex/bitmex_parameters.go +++ b/exchanges/bitmex/bitmex_parameters.go @@ -168,7 +168,7 @@ func (p ChatSendParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p ChatSendParams) ToURLVals(path string) (string, error) { +func (p ChatSendParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -247,7 +247,7 @@ func (p LeaderboardGetParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p LeaderboardGetParams) ToURLVals(path string) (string, error) { +func (p LeaderboardGetParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -339,7 +339,7 @@ func (p *OrderNewParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *OrderNewParams) ToURLVals(path string) (string, error) { +func (p *OrderNewParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -404,7 +404,7 @@ func (p *OrderAmendParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *OrderAmendParams) ToURLVals(path string) (string, error) { +func (p *OrderAmendParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -432,7 +432,7 @@ func (p OrderCancelParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderCancelParams) ToURLVals(path string) (string, error) { +func (p OrderCancelParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -463,7 +463,7 @@ func (p OrderCancelAllParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderCancelAllParams) ToURLVals(path string) (string, error) { +func (p OrderCancelAllParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -485,7 +485,7 @@ func (p OrderAmendBulkParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderAmendBulkParams) ToURLVals(path string) (string, error) { +func (p OrderAmendBulkParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -507,7 +507,7 @@ func (p OrderNewBulkParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderNewBulkParams) ToURLVals(path string) (string, error) { +func (p OrderNewBulkParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -530,7 +530,7 @@ func (p OrderCancelAllAfterParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderCancelAllAfterParams) ToURLVals(path string) (string, error) { +func (p OrderCancelAllAfterParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -556,7 +556,7 @@ func (p OrderClosePositionParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p OrderClosePositionParams) ToURLVals(path string) (string, error) { +func (p OrderClosePositionParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -615,7 +615,7 @@ func (p PositionGetParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p PositionGetParams) ToURLVals(path string) (string, error) { +func (p PositionGetParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -641,7 +641,7 @@ func (p PositionIsolateMarginParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p PositionIsolateMarginParams) ToURLVals(path string) (string, error) { +func (p PositionIsolateMarginParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -668,7 +668,7 @@ func (p PositionUpdateLeverageParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p PositionUpdateLeverageParams) ToURLVals(path string) (string, error) { +func (p PositionUpdateLeverageParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -694,7 +694,7 @@ func (p PositionUpdateRiskLimitParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p PositionUpdateRiskLimitParams) ToURLVals(path string) (string, error) { +func (p PositionUpdateRiskLimitParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -720,7 +720,7 @@ func (p PositionTransferIsolatedMarginParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p PositionTransferIsolatedMarginParams) ToURLVals(path string) (string, error) { +func (p PositionTransferIsolatedMarginParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -780,7 +780,7 @@ func (p *QuoteGetBucketedParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *QuoteGetBucketedParams) ToURLVals(path string) (string, error) { +func (p *QuoteGetBucketedParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -841,7 +841,7 @@ func (p *TradeGetBucketedParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *TradeGetBucketedParams) ToURLVals(path string) (string, error) { +func (p *TradeGetBucketedParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -878,7 +878,7 @@ func (p *UserUpdateParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *UserUpdateParams) ToURLVals(path string) (string, error) { +func (p *UserUpdateParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -899,7 +899,7 @@ func (p UserTokenParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserTokenParams) ToURLVals(path string) (string, error) { +func (p UserTokenParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -921,7 +921,7 @@ func (p UserCheckReferralCodeParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserCheckReferralCodeParams) ToURLVals(path string) (string, error) { +func (p UserCheckReferralCodeParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -947,7 +947,7 @@ func (p UserConfirmTFAParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserConfirmTFAParams) ToURLVals(path string) (string, error) { +func (p UserConfirmTFAParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -968,7 +968,7 @@ func (p UserCurrencyParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserCurrencyParams) ToURLVals(path string) (string, error) { +func (p UserCurrencyParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -993,7 +993,7 @@ func (p UserPreferencesParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserPreferencesParams) ToURLVals(path string) (string, error) { +func (p UserPreferencesParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -1030,7 +1030,7 @@ func (p UserRequestWithdrawalParams) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p UserRequestWithdrawalParams) ToURLVals(path string) (string, error) { +func (p UserRequestWithdrawalParams) ToURLVals(_ string) (string, error) { return "", nil } @@ -1058,7 +1058,7 @@ func (p *OrdersRequest) VerifyData() error { // ToURLVals converts struct values to url.values and encodes it on the supplied // path -func (p *OrdersRequest) ToURLVals(path string) (string, error) { +func (p *OrdersRequest) ToURLVals(_ string) (string, error) { return "", nil } diff --git a/exchanges/bitmex/bitmex_wrapper.go b/exchanges/bitmex/bitmex_wrapper.go index d4c216a1..2a182781 100644 --- a/exchanges/bitmex/bitmex_wrapper.go +++ b/exchanges/bitmex/bitmex_wrapper.go @@ -335,7 +335,7 @@ func (b *Bitmex) FetchTradablePairs(ctx context.Context, a asset.Item) (currency // UpdateTradablePairs updates the exchanges available pairs and stores // them in the exchanges config -func (b *Bitmex) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error { +func (b *Bitmex) UpdateTradablePairs(ctx context.Context, _ bool) error { assets := b.GetAssetTypes(false) for x := range assets { @@ -551,12 +551,12 @@ func (b *Bitmex) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *Bitmex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *Bitmex) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrNotYetImplemented } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Bitmex) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Bitmex) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -715,7 +715,7 @@ func (b *Bitmex) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *Bitmex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *Bitmex) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -740,7 +740,7 @@ func (b *Bitmex) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Ca } // GetOrderInfo returns order information based on order ID -func (b *Bitmex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *Bitmex) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/bitstamp/bitstamp_wrapper.go b/exchanges/bitstamp/bitstamp_wrapper.go index 6c0840a7..0901771c 100644 --- a/exchanges/bitstamp/bitstamp_wrapper.go +++ b/exchanges/bitstamp/bitstamp_wrapper.go @@ -280,7 +280,7 @@ func (b *Bitstamp) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (b *Bitstamp) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (b *Bitstamp) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { symbols, err := b.GetTradingPairs(ctx) if err != nil { return nil, err @@ -312,7 +312,7 @@ func (b *Bitstamp) UpdateTradablePairs(ctx context.Context, forceUpdate bool) er } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (b *Bitstamp) UpdateTickers(ctx context.Context, a asset.Item) error { +func (b *Bitstamp) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -481,12 +481,12 @@ func (b *Bitstamp) FetchAccountInfo(ctx context.Context, assetType asset.Item) ( // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *Bitstamp) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *Bitstamp) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Bitstamp) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Bitstamp) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -578,7 +578,7 @@ func (b *Bitstamp) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *Bitstamp) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *Bitstamp) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -596,7 +596,7 @@ func (b *Bitstamp) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order. } // GetOrderInfo returns order information based on order ID -func (b *Bitstamp) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *Bitstamp) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/bittrex/bittrex_test.go b/exchanges/bittrex/bittrex_test.go index 9494dc05..cad8e9e8 100644 --- a/exchanges/bittrex/bittrex_test.go +++ b/exchanges/bittrex/bittrex_test.go @@ -604,6 +604,7 @@ func TestModifyOrder(t *testing.T) { } } +//nolint:gocritic // Only used as a testing helper function in this package func WithdrawCryptocurrencyFunds(t *testing.T) { t.Helper() withdrawCryptoRequest := withdraw.Request{ diff --git a/exchanges/bittrex/bittrex_wrapper.go b/exchanges/bittrex/bittrex_wrapper.go index ae1c76b3..67cfd2ab 100644 --- a/exchanges/bittrex/bittrex_wrapper.go +++ b/exchanges/bittrex/bittrex_wrapper.go @@ -289,7 +289,7 @@ func (b *Bittrex) UpdateTradablePairs(ctx context.Context, forceUpdate bool) err } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (b *Bittrex) UpdateTickers(ctx context.Context, a asset.Item) error { +func (b *Bittrex) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -511,7 +511,7 @@ func (b *Bittrex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory } // GetWithdrawalsHistory returns previous withdrawals data -func (b *Bittrex) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *Bittrex) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -644,7 +644,7 @@ func (b *Bittrex) CancelAllOrders(ctx context.Context, orderCancellation *order. } // GetOrderInfo returns information on a current open order -func (b *Bittrex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *Bittrex) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (order.Detail, error) { orderData, err := b.GetOrder(ctx, orderID) if err != nil { return order.Detail{}, err diff --git a/exchanges/btcmarkets/btcmarkets_wrapper.go b/exchanges/btcmarkets/btcmarkets_wrapper.go index 1dbbf474..86543398 100644 --- a/exchanges/btcmarkets/btcmarkets_wrapper.go +++ b/exchanges/btcmarkets/btcmarkets_wrapper.go @@ -491,12 +491,12 @@ func (b *BTCMarkets) FetchAccountInfo(ctx context.Context, assetType asset.Item) // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *BTCMarkets) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *BTCMarkets) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (b *BTCMarkets) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *BTCMarkets) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -644,7 +644,7 @@ func (b *BTCMarkets) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *BTCMarkets) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *BTCMarkets) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -679,7 +679,7 @@ func (b *BTCMarkets) CancelAllOrders(ctx context.Context, _ *order.Cancel) (orde } // GetOrderInfo returns order information based on order ID -func (b *BTCMarkets) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *BTCMarkets) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var resp order.Detail o, err := b.FetchOrder(ctx, orderID) if err != nil { @@ -738,7 +738,7 @@ func (b *BTCMarkets) GetOrderInfo(ctx context.Context, orderID string, pair curr } // GetDepositAddress returns a deposit address for a specified currency -func (b *BTCMarkets) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, accountID, _ string) (*deposit.Address, error) { +func (b *BTCMarkets) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, _, _ string) (*deposit.Address, error) { depositAddr, err := b.FetchDepositAddress(ctx, cryptocurrency, -1, -1, -1) if err != nil { return nil, err diff --git a/exchanges/btse/btse_wrapper.go b/exchanges/btse/btse_wrapper.go index ebab925e..29190d6f 100644 --- a/exchanges/btse/btse_wrapper.go +++ b/exchanges/btse/btse_wrapper.go @@ -437,7 +437,7 @@ func (b *BTSE) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acco // GetFundingHistory returns funding history, deposits and // withdrawals -func (b *BTSE) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (b *BTSE) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } @@ -452,7 +452,7 @@ func (b *BTSE) withinLimits(pair currency.Pair, amount float64) bool { } // GetWithdrawalsHistory returns previous withdrawals data -func (b *BTSE) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (b *BTSE) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -573,7 +573,7 @@ func (b *BTSE) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (b *BTSE) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (b *BTSE) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -617,7 +617,7 @@ func orderIntToType(i int) order.Type { } // GetOrderInfo returns order information based on order ID -func (b *BTSE) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (b *BTSE) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (order.Detail, error) { o, err := b.GetOrders(ctx, "", orderID, "") if err != nil { return order.Detail{}, err @@ -701,7 +701,7 @@ func (b *BTSE) GetOrderInfo(ctx context.Context, orderID string, pair currency.P } // GetDepositAddress returns a deposit address for a specified currency -func (b *BTSE) GetDepositAddress(ctx context.Context, c currency.Code, accountID, _ string) (*deposit.Address, error) { +func (b *BTSE) GetDepositAddress(ctx context.Context, c currency.Code, _, _ string) (*deposit.Address, error) { address, err := b.GetWalletAddress(ctx, c.String()) if err != nil { return nil, err diff --git a/exchanges/bybit/bybit_wrapper.go b/exchanges/bybit/bybit_wrapper.go index 2fb642c9..978461e1 100644 --- a/exchanges/bybit/bybit_wrapper.go +++ b/exchanges/bybit/bybit_wrapper.go @@ -794,7 +794,7 @@ func (by *Bybit) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac // GetFundingHistory returns funding history, deposits and // withdrawals -func (by *Bybit) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (by *Bybit) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrNotYetImplemented } @@ -920,7 +920,7 @@ func (by *Bybit) GetRecentTrades(ctx context.Context, p currency.Pair, assetType } // GetHistoricTrades returns historic trade data within the timeframe provided -func (by *Bybit) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error) { +func (by *Bybit) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error) { return nil, common.ErrFunctionNotSupported } @@ -1132,7 +1132,7 @@ func (by *Bybit) CancelOrder(ctx context.Context, ord *order.Cancel) error { } // CancelBatchOrders cancels orders by their corresponding ID numbers -func (by *Bybit) CancelBatchOrders(ctx context.Context, orders []order.Cancel) (order.CancelBatchResponse, error) { +func (by *Bybit) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -1415,13 +1415,13 @@ func (by *Bybit) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawReques // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (by *Bybit) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (by *Bybit) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is // submitted -func (by *Bybit) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (by *Bybit) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrFunctionNotSupported } @@ -1754,7 +1754,7 @@ func (by *Bybit) GetOrderHistory(ctx context.Context, req *order.GetOrdersReques } // GetFeeByType returns an estimate of fee based on the type of transaction -func (by *Bybit) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error) { +func (by *Bybit) GetFeeByType(_ context.Context, _ *exchange.FeeBuilder) (float64, error) { return 0, common.ErrNotYetImplemented } @@ -1765,7 +1765,7 @@ func (by *Bybit) ValidateCredentials(ctx context.Context, assetType asset.Item) } // FormatExchangeKlineInterval returns Interval to exchange formatted string -func (by *Bybit) FormatExchangeKlineInterval(ctx context.Context, interval kline.Interval) string { +func (by *Bybit) FormatExchangeKlineInterval(_ context.Context, interval kline.Interval) string { switch interval { case kline.OneMin: return "1m" @@ -1799,7 +1799,7 @@ func (by *Bybit) FormatExchangeKlineInterval(ctx context.Context, interval kline } // FormatExchangeKlineIntervalFutures returns Interval to exchange formatted string for future assets -func (by *Bybit) FormatExchangeKlineIntervalFutures(ctx context.Context, interval kline.Interval) string { +func (by *Bybit) FormatExchangeKlineIntervalFutures(_ context.Context, interval kline.Interval) string { switch interval { case kline.OneMin: return "1" diff --git a/exchanges/coinbasepro/coinbasepro_wrapper.go b/exchanges/coinbasepro/coinbasepro_wrapper.go index f21918d0..960972ad 100644 --- a/exchanges/coinbasepro/coinbasepro_wrapper.go +++ b/exchanges/coinbasepro/coinbasepro_wrapper.go @@ -284,7 +284,7 @@ func (c *CoinbasePro) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (c *CoinbasePro) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (c *CoinbasePro) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { products, err := c.GetProducts(ctx) if err != nil { return nil, err @@ -369,7 +369,7 @@ func (c *CoinbasePro) FetchAccountInfo(ctx context.Context, assetType asset.Item } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (c *CoinbasePro) UpdateTickers(ctx context.Context, a asset.Item) error { +func (c *CoinbasePro) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -589,7 +589,7 @@ func (c *CoinbasePro) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (c *CoinbasePro) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (c *CoinbasePro) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } diff --git a/exchanges/coinut/coinut_wrapper.go b/exchanges/coinut/coinut_wrapper.go index 50315abd..e4e5f142 100644 --- a/exchanges/coinut/coinut_wrapper.go +++ b/exchanges/coinut/coinut_wrapper.go @@ -263,7 +263,7 @@ func (c *COINUT) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (c *COINUT) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (c *COINUT) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { var resp Instruments var err error if c.Websocket.IsConnected() { @@ -411,7 +411,7 @@ func (c *COINUT) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (c *COINUT) UpdateTickers(ctx context.Context, a asset.Item) error { +func (c *COINUT) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -525,7 +525,7 @@ func (c *COINUT) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType // GetFundingHistory returns funding history, deposits and // withdrawals -func (c *COINUT) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (c *COINUT) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } diff --git a/exchanges/currencystate/currency_state_test.go b/exchanges/currencystate/currency_state_test.go index ae260891..d251fb32 100644 --- a/exchanges/currencystate/currency_state_test.go +++ b/exchanges/currencystate/currency_state_test.go @@ -301,7 +301,7 @@ func TestCurrencyGetState(t *testing.T) { } } -func TestAlerting(t *testing.T) { +func TestAlerting(_ *testing.T) { c := Currency{} var start, finish sync.WaitGroup start.Add(3) diff --git a/exchanges/exchange.go b/exchanges/exchange.go index 2f6038bc..65c579df 100644 --- a/exchanges/exchange.go +++ b/exchanges/exchange.go @@ -1413,7 +1413,7 @@ func (a *AssetWebsocketSupport) IsAssetWebsocketSupported(aType asset.Item) bool } // UpdateCurrencyStates updates currency states -func (b *Base) UpdateCurrencyStates(ctx context.Context, a asset.Item) error { +func (b *Base) UpdateCurrencyStates(_ context.Context, _ asset.Item) error { return common.ErrNotYetImplemented } @@ -1440,12 +1440,12 @@ func (b *Base) ScaleCollateral(context.Context, *order.CollateralCalculator) (*o // CalculateTotalCollateral takes in n collateral calculators to determine an overall // standing in a singular currency -func (b *Base) CalculateTotalCollateral(ctx context.Context, calculator *order.TotalCollateralCalculator) (*order.TotalCollateralResponse, error) { +func (b *Base) CalculateTotalCollateral(_ context.Context, _ *order.TotalCollateralCalculator) (*order.TotalCollateralResponse, error) { return nil, common.ErrNotYetImplemented } // GetCollateralCurrencyForContract returns the collateral currency for an asset and contract pair -func (b *Base) GetCollateralCurrencyForContract(a asset.Item, cp currency.Pair) (currency.Code, asset.Item, error) { +func (b *Base) GetCollateralCurrencyForContract(_ asset.Item, _ currency.Pair) (currency.Code, asset.Item, error) { return currency.Code{}, asset.Empty, common.ErrNotYetImplemented } diff --git a/exchanges/exmo/exmo_wrapper.go b/exchanges/exmo/exmo_wrapper.go index 2fa3624a..1c773cfd 100644 --- a/exchanges/exmo/exmo_wrapper.go +++ b/exchanges/exmo/exmo_wrapper.go @@ -414,12 +414,12 @@ func (e *EXMO) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acco // GetFundingHistory returns funding history, deposits and // withdrawals -func (e *EXMO) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (e *EXMO) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (e *EXMO) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (e *EXMO) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -522,7 +522,7 @@ func (e *EXMO) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (e *EXMO) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (e *EXMO) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -548,7 +548,7 @@ func (e *EXMO) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Canc } // GetOrderInfo returns order information based on order ID -func (e *EXMO) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (e *EXMO) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/gateio/gateio_wrapper.go b/exchanges/gateio/gateio_wrapper.go index cb23245a..30560b50 100644 --- a/exchanges/gateio/gateio_wrapper.go +++ b/exchanges/gateio/gateio_wrapper.go @@ -457,12 +457,12 @@ func (g *Gateio) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac // GetFundingHistory returns funding history, deposits and // withdrawals -func (g *Gateio) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (g *Gateio) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (g *Gateio) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (g *Gateio) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -578,7 +578,7 @@ func (g *Gateio) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (g *Gateio) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (g *Gateio) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -608,7 +608,7 @@ func (g *Gateio) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Ca } // GetOrderInfo returns order information based on order ID -func (g *Gateio) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (g *Gateio) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, assetType asset.Item) (order.Detail, error) { var orderDetail order.Detail orders, err := g.GetOpenOrders(ctx, "") if err != nil { diff --git a/exchanges/gemini/gemini_wrapper.go b/exchanges/gemini/gemini_wrapper.go index 893a42cf..8d362cf5 100644 --- a/exchanges/gemini/gemini_wrapper.go +++ b/exchanges/gemini/gemini_wrapper.go @@ -363,7 +363,7 @@ func (g *Gemini) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (g *Gemini) UpdateTickers(ctx context.Context, a asset.Item) error { +func (g *Gemini) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -466,12 +466,12 @@ func (g *Gemini) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType // GetFundingHistory returns funding history, deposits and // withdrawals -func (g *Gemini) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (g *Gemini) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (g *Gemini) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (g *Gemini) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -597,7 +597,7 @@ func (g *Gemini) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (g *Gemini) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (g *Gemini) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -619,7 +619,7 @@ func (g *Gemini) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Ca } // GetOrderInfo returns order information based on order ID -func (g *Gemini) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (g *Gemini) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/hitbtc/hitbtc_test.go b/exchanges/hitbtc/hitbtc_test.go index b735a1af..fa53e114 100644 --- a/exchanges/hitbtc/hitbtc_test.go +++ b/exchanges/hitbtc/hitbtc_test.go @@ -466,6 +466,8 @@ func TestGetDepositAddress(t *testing.T) { } } } + +//nolint:gocritic // Only used as a testing helper function in this package func setupWsAuth(t *testing.T) { t.Helper() if wsSetupRan { diff --git a/exchanges/hitbtc/hitbtc_wrapper.go b/exchanges/hitbtc/hitbtc_wrapper.go index bae3e726..e9f7812e 100644 --- a/exchanges/hitbtc/hitbtc_wrapper.go +++ b/exchanges/hitbtc/hitbtc_wrapper.go @@ -283,7 +283,7 @@ func (h *HitBTC) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (h *HitBTC) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (h *HitBTC) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { symbols, err := h.GetSymbolsDetailed(ctx) if err != nil { return nil, err @@ -479,12 +479,12 @@ func (h *HitBTC) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac // GetFundingHistory returns funding history, deposits and // withdrawals -func (h *HitBTC) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (h *HitBTC) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (h *HitBTC) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (h *HitBTC) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -632,7 +632,7 @@ func (h *HitBTC) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (h *HitBTC) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (h *HitBTC) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -660,7 +660,7 @@ func (h *HitBTC) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Ca } // GetOrderInfo returns order information based on order ID -func (h *HitBTC) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (h *HitBTC) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/huobi/huobi_wrapper.go b/exchanges/huobi/huobi_wrapper.go index 6e608822..d0530fa8 100644 --- a/exchanges/huobi/huobi_wrapper.go +++ b/exchanges/huobi/huobi_wrapper.go @@ -425,7 +425,7 @@ func (h *HUOBI) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (h *HUOBI) UpdateTickers(ctx context.Context, a asset.Item) error { +func (h *HUOBI) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -820,12 +820,12 @@ func (h *HUOBI) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acc // GetFundingHistory returns funding history, deposits and // withdrawals -func (h *HUOBI) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (h *HUOBI) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (h *HUOBI) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (h *HUOBI) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -1034,7 +1034,7 @@ func (h *HUOBI) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (h *HUOBI) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (h *HUOBI) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } diff --git a/exchanges/itbit/itbit_wrapper.go b/exchanges/itbit/itbit_wrapper.go index d2237923..e2c22e1a 100644 --- a/exchanges/itbit/itbit_wrapper.go +++ b/exchanges/itbit/itbit_wrapper.go @@ -129,25 +129,25 @@ func (i *ItBit) Start(ctx context.Context, wg *sync.WaitGroup) error { } // Run implements the ItBit wrapper -func (i *ItBit) Run(ctx context.Context) { +func (i *ItBit) Run(_ context.Context) { if i.Verbose { i.PrintEnabledPairs() } } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (i *ItBit) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (i *ItBit) FetchTradablePairs(_ context.Context, _ asset.Item) (currency.Pairs, error) { return nil, common.ErrFunctionNotSupported } // UpdateTradablePairs updates the exchanges available pairs and stores // them in the exchanges config -func (i *ItBit) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error { +func (i *ItBit) UpdateTradablePairs(_ context.Context, _ bool) error { return common.ErrFunctionNotSupported } // UpdateTickers updates the ticker for all currency pairs of a given asset type -func (i *ItBit) UpdateTickers(ctx context.Context, a asset.Item) error { +func (i *ItBit) UpdateTickers(_ context.Context, _ asset.Item) error { return common.ErrFunctionNotSupported } @@ -325,12 +325,12 @@ func (i *ItBit) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acc // GetFundingHistory returns funding history, deposits and // withdrawals -func (i *ItBit) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (i *ItBit) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (i *ItBit) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (i *ItBit) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -445,7 +445,7 @@ func (i *ItBit) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (i *ItBit) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (i *ItBit) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -480,7 +480,7 @@ func (i *ItBit) CancelAllOrders(ctx context.Context, orderCancellation *order.Ca } // GetOrderInfo returns order information based on order ID -func (i *ItBit) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (i *ItBit) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/exchanges/kline/kline_test.go b/exchanges/kline/kline_test.go index 0c55c354..076df458 100644 --- a/exchanges/kline/kline_test.go +++ b/exchanges/kline/kline_test.go @@ -877,9 +877,8 @@ func BenchmarkJustifyIntervalTimeStoringUnixValues1(b *testing.B) { tt2 := time.Now().Add(-time.Hour) tt3 := time.Now().Add(time.Hour) for i := 0; i < b.N; i++ { - if tt1.Unix() == tt2.Unix() || //nolint:staticcheck // it is a benchmark to demonstrate inefficiency in calling - (tt1.Unix() > tt2.Unix() && tt1.Unix() < tt3.Unix()) { - + if tt1.Unix() == tt2.Unix() || (tt1.Unix() > tt2.Unix() && tt1.Unix() < tt3.Unix()) { + continue } } } @@ -893,8 +892,8 @@ func BenchmarkJustifyIntervalTimeStoringUnixValues2(b *testing.B) { tt2 := time.Now().Add(-time.Hour).Unix() tt3 := time.Now().Add(time.Hour).Unix() for i := 0; i < b.N; i++ { - if tt1 >= tt2 && tt1 <= tt3 { //nolint:staticcheck // it is a benchmark to demonstrate inefficiency in calling - + if tt1 >= tt2 && tt1 <= tt3 { + continue } } } diff --git a/exchanges/kraken/kraken_wrapper.go b/exchanges/kraken/kraken_wrapper.go index deaa1407..044b5c87 100644 --- a/exchanges/kraken/kraken_wrapper.go +++ b/exchanges/kraken/kraken_wrapper.go @@ -657,12 +657,12 @@ func (k *Kraken) FetchAccountInfo(ctx context.Context, assetType asset.Item) (ac // GetFundingHistory returns funding history, deposits and // withdrawals -func (k *Kraken) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (k *Kraken) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (k *Kraken) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (k *Kraken) GetWithdrawalsHistory(ctx context.Context, c currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { withdrawals, err := k.WithdrawStatus(ctx, c, "") for i := range withdrawals { resp = append(resp, exchange.WithdrawalHistory{ @@ -831,7 +831,7 @@ func (k *Kraken) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (k *Kraken) CancelBatchOrders(ctx context.Context, orders []order.Cancel) (order.CancelBatchResponse, error) { +func (k *Kraken) CancelBatchOrders(_ context.Context, orders []order.Cancel) (order.CancelBatchResponse, error) { if !k.Websocket.CanUseAuthenticatedWebsocketForWrapper() { return order.CancelBatchResponse{}, common.ErrFunctionNotSupported } @@ -897,7 +897,7 @@ func (k *Kraken) CancelAllOrders(ctx context.Context, req *order.Cancel) (order. } // GetOrderInfo returns information on a current open order -func (k *Kraken) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (k *Kraken) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, assetType asset.Item) (order.Detail, error) { var orderDetail order.Detail switch assetType { case asset.Spot: diff --git a/exchanges/lbank/lbank_wrapper.go b/exchanges/lbank/lbank_wrapper.go index 278a1d92..3540ec12 100644 --- a/exchanges/lbank/lbank_wrapper.go +++ b/exchanges/lbank/lbank_wrapper.go @@ -184,7 +184,7 @@ func (l *Lbank) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (l *Lbank) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (l *Lbank) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { currencies, err := l.GetCurrencyPairs(ctx) if err != nil { return nil, err @@ -381,12 +381,12 @@ func (l *Lbank) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acc // GetFundingHistory returns funding history, deposits and // withdrawals -func (l *Lbank) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (l *Lbank) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (l *Lbank) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (l *Lbank) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -507,7 +507,7 @@ func (l *Lbank) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (l *Lbank) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (l *Lbank) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -573,7 +573,7 @@ func (l *Lbank) CancelAllOrders(ctx context.Context, o *order.Cancel) (order.Can } // GetOrderInfo returns order information based on order ID -func (l *Lbank) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (l *Lbank) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var resp order.Detail orderIDs, err := l.getAllOpenOrderID(ctx) if err != nil { diff --git a/exchanges/okcoin/okcoin_wrapper.go b/exchanges/okcoin/okcoin_wrapper.go index 5f96483e..9f63249d 100644 --- a/exchanges/okcoin/okcoin_wrapper.go +++ b/exchanges/okcoin/okcoin_wrapper.go @@ -768,7 +768,7 @@ func (o *OKCoin) CancelAllOrders(ctx context.Context, orderCancellation *order.C } // GetOrderInfo returns order information based on order ID -func (o *OKCoin) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (o *OKCoin) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, assetType asset.Item) (order.Detail, error) { var resp order.Detail if assetType != asset.Spot { return resp, fmt.Errorf("%s %w", assetType, asset.ErrNotSupported) @@ -870,7 +870,7 @@ func (o *OKCoin) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *with } // GetWithdrawalsHistory returns previous withdrawals data -func (o *OKCoin) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error) { +func (o *OKCoin) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) { return nil, common.ErrNotYetImplemented } diff --git a/exchanges/okx/okx.go b/exchanges/okx/okx.go index feef58cf..c4937f0f 100644 --- a/exchanges/okx/okx.go +++ b/exchanges/okx/okx.go @@ -1445,7 +1445,7 @@ func (ok *Okx) GetFundsTransferState(ctx context.Context, transferID, clientID s } // GetAssetBillsDetails Query the billing record, you can get the latest 1 month historical data -func (ok *Okx) GetAssetBillsDetails(ctx context.Context, currency, clientID, clientSecret string, after, before time.Time, billType, limit int64) ([]AssetBillDetail, error) { +func (ok *Okx) GetAssetBillsDetails(ctx context.Context, currency, clientID string, after, before time.Time, billType, limit int64) ([]AssetBillDetail, error) { params := url.Values{} billTypeMap := map[int64]bool{1: true, 2: true, 13: true, 20: true, 21: true, 28: true, 47: true, 48: true, 49: true, 50: true, 51: true, 52: true, 53: true, 54: true, 61: true, 68: true, 69: true, 72: true, 73: true, 74: true, 75: true, 76: true, 77: true, 78: true, 79: true, 80: true, 81: true, 82: true, 83: true, 84: true, 85: true, 86: true, 87: true, 88: true, 89: true, 90: true, 91: true, 92: true, 93: true, 94: true, 95: true, 96: true, 97: true, 98: true, 99: true, 102: true, 103: true, 104: true, 105: true, 106: true, 107: true, 108: true, 109: true, 110: true, 111: true, 112: true, 113: true, 114: true, 115: true, 116: true, 117: true, 118: true, 119: true, 120: true, 121: true, 122: true, 123: true, 124: true, 125: true, 126: true, 127: true, 128: true, 129: true, 130: true, 131: true, 132: true, 133: true, 134: true, 135: true, 136: true, 137: true, 138: true, 139: true, 141: true, 142: true, 143: true, 144: true, 145: true, 146: true, 147: true, 150: true, 151: true, 152: true, 153: true, 154: true, 155: true, 156: true, 157: true, 160: true, 161: true, 162: true, 163: true, 169: true, 170: true, 171: true, 172: true, 173: true, 174: true, 175: true, 176: true, 177: true, 178: true, 179: true, 180: true, 181: true, 182: true, 183: true, 184: true, 185: true, 186: true, 187: true, 188: true, 189: true, 193: true, 194: true, 195: true, 196: true, 197: true, 198: true, 199: true, 200: true, 211: true} if _, okay := billTypeMap[billType]; okay { @@ -2058,6 +2058,9 @@ func (ok *Okx) GetMaximumAvailableTradableAmount(ctx context.Context, instrument tradeMode != TradeModeCash { return nil, errInvalidTradeModeValue } + if reduceOnly { + params.Set("reduceOnly", "true") + } params.Set("tdMode", tradeMode) params.Set("px", strconv.FormatFloat(price, 'f', 0, 64)) var resp []MaximumTradableAmount diff --git a/exchanges/okx/okx_test.go b/exchanges/okx/okx_test.go index 5fe7a028..ce503e50 100644 --- a/exchanges/okx/okx_test.go +++ b/exchanges/okx/okx_test.go @@ -448,7 +448,7 @@ func TestPlaceOrder(t *testing.T) { } } -var placeMultipleOrderParamsJSON = `[{"instId":"BTC-USDT","tdMode":"cash","clOrdId":"b159","side":"buy","ordType":"limit","px":"2.15","sz":"2"},{"instId":"BTC-USDT","tdMode":"cash","clOrdId":"b15","side":"buy","ordType":"limit","px":"2.15","sz":"2"}]` +const placeMultipleOrderParamsJSON = `[{"instId":"BTC-USDT","tdMode":"cash","clOrdId":"b159","side":"buy","ordType":"limit","px":"2.15","sz":"2"},{"instId":"BTC-USDT","tdMode":"cash","clOrdId":"b15","side":"buy","ordType":"limit","px":"2.15","sz":"2"}]` func TestPlaceMultipleOrders(t *testing.T) { t.Parallel() @@ -788,7 +788,7 @@ func TestGetCounterparties(t *testing.T) { } } -var createRFQInputJSON = `{"anonymous": true,"counterparties":["Trader1","Trader2"],"clRfqId":"rfq01","legs":[{"sz":"25","side":"buy","instId":"BTCUSD-221208-100000-C"},{"sz":"150","side":"buy","instId":"ETH-USDT","tgtCcy":"base_ccy"}]}` +const createRFQInputJSON = `{"anonymous": true,"counterparties":["Trader1","Trader2"],"clRfqId":"rfq01","legs":[{"sz":"25","side":"buy","instId":"BTCUSD-221208-100000-C"},{"sz":"150","side":"buy","instId":"ETH-USDT","tgtCcy":"base_ccy"}]}` func TestCreateRFQ(t *testing.T) { t.Parallel() @@ -1084,7 +1084,7 @@ func TestGetAssetBillsDetails(t *testing.T) { if !areTestAPIKeysSet() { t.SkipNow() } - _, err := ok.GetAssetBillsDetails(context.Background(), "", "", "", time.Time{}, time.Time{}, 0, 1) + _, err := ok.GetAssetBillsDetails(context.Background(), "", "", time.Time{}, time.Time{}, 0, 1) if err != nil { t.Error("Okx GetAssetBillsDetail() error", err) } @@ -1679,7 +1679,7 @@ func TestGetCustodyTradingSubaccountList(t *testing.T) { } } -var gridTradingPlaceOrder = `{"instId": "BTC-USD-SWAP","algoOrdType": "contract_grid","maxPx": "5000","minPx": "400","gridNum": "10","runType": "1","sz": "200", "direction": "long","lever": "2"}` +const gridTradingPlaceOrder = `{"instId": "BTC-USD-SWAP","algoOrdType": "contract_grid","maxPx": "5000","minPx": "400","gridNum": "10","runType": "1","sz": "200", "direction": "long","lever": "2"}` func TestPlaceGridAlgoOrder(t *testing.T) { t.Parallel() @@ -1695,7 +1695,7 @@ func TestPlaceGridAlgoOrder(t *testing.T) { } } -var gridOrderAmendAlgo = `{ +const gridOrderAmendAlgo = `{ "algoId":"448965992920907776", "instId":"BTC-USDT", "slTriggerPx":"1200", @@ -1716,7 +1716,7 @@ func TestAmendGridAlgoOrder(t *testing.T) { } } -var stopGridAlgoOrderJSON = `{"algoId":"198273485", "instId":"BTC-USDT", "stopType":"1", "algoOrdType":"grid"}` +const stopGridAlgoOrderJSON = `{"algoId":"198273485", "instId":"BTC-USDT", "stopType":"1", "algoOrdType":"grid"}` func TestStopGridAlgoOrder(t *testing.T) { t.Parallel() @@ -1786,7 +1786,7 @@ func TestGetGridAlgoSubOrders(t *testing.T) { } } -var spotGridAlgoOrderPosition = `{"adl": "1","algoId": "449327675342323712","avgPx": "29215.0142857142857149","cTime": "1653400065917","ccy": "USDT","imr": "2045.386","instId": "BTC-USDT-SWAP","instType": "SWAP","last": "29206.7","lever": "5","liqPx": "661.1684795867162","markPx": "29213.9","mgnMode": "cross","mgnRatio": "217.19370606167573","mmr": "40.907720000000005","notionalUsd": "10216.70307","pos": "35","posSide": "net","uTime": "1653400066938","upl": "1.674999999999818","uplRatio": "0.0008190504784478"}` +const spotGridAlgoOrderPosition = `{"adl": "1","algoId": "449327675342323712","avgPx": "29215.0142857142857149","cTime": "1653400065917","ccy": "USDT","imr": "2045.386","instId": "BTC-USDT-SWAP","instType": "SWAP","last": "29206.7","lever": "5","liqPx": "661.1684795867162","markPx": "29213.9","mgnMode": "cross","mgnRatio": "217.19370606167573","mmr": "40.907720000000005","notionalUsd": "10216.70307","pos": "35","posSide": "net","uTime": "1653400066938","upl": "1.674999999999818","uplRatio": "0.0008190504784478"}` func TestGetGridAlgoOrderPositions(t *testing.T) { t.Parallel() @@ -1857,7 +1857,7 @@ func TestAdjustMarginBalance(t *testing.T) { } } -var gridAIParamJSON = `{"algoOrdType": "grid","annualizedRate": "1.5849","ccy": "USDT","direction": "", "duration": "7D","gridNum": "5","instId": "BTC-USDT","lever": "0","maxPx": "21373.3","minInvestment": "0.89557758", "minPx": "15544.2", "perMaxProfitRate": "0.0733865364573281","perMinProfitRate": "0.0561101403446263","runType": "1"}` +const gridAIParamJSON = `{"algoOrdType": "grid","annualizedRate": "1.5849","ccy": "USDT","direction": "", "duration": "7D","gridNum": "5","instId": "BTC-USDT","lever": "0","maxPx": "21373.3","minInvestment": "0.89557758", "minPx": "15544.2", "perMaxProfitRate": "0.0733865364573281","perMinProfitRate": "0.0561101403446263","runType": "1"}` func TestGetGridAIParameter(t *testing.T) { t.Parallel() @@ -2324,7 +2324,7 @@ func TestGetHistoricCandlesExtended(t *testing.T) { } } -var wsInstrumentPushData = `{"arg": {"channel": "instruments","instType": "FUTURES"},"data": [{"instType": "FUTURES","instId": "BTC-USD-191115","uly": "BTC-USD","category": "1","baseCcy": "","quoteCcy": "","settleCcy": "BTC","ctVal": "10","ctMult": "1","ctValCcy": "USD","optType": "","stk": "","listTime": "","expTime": "","tickSz": "0.01","lotSz": "1","minSz": "1","ctType": "linear","alias": "this_week","state": "live","maxLmtSz":"10000","maxMktSz":"99999","maxTwapSz":"99999","maxIcebergSz":"99999","maxTriggerSz":"9999","maxStopSz":"9999"}]}` +const wsInstrumentPushData = `{"arg": {"channel": "instruments","instType": "FUTURES"},"data": [{"instType": "FUTURES","instId": "BTC-USD-191115","uly": "BTC-USD","category": "1","baseCcy": "","quoteCcy": "","settleCcy": "BTC","ctVal": "10","ctMult": "1","ctValCcy": "USD","optType": "","stk": "","listTime": "","expTime": "","tickSz": "0.01","lotSz": "1","minSz": "1","ctType": "linear","alias": "this_week","state": "live","maxLmtSz":"10000","maxMktSz":"99999","maxTwapSz":"99999","maxIcebergSz":"99999","maxTriggerSz":"9999","maxStopSz":"9999"}]}` func TestWSInstruments(t *testing.T) { t.Parallel() @@ -2333,7 +2333,7 @@ func TestWSInstruments(t *testing.T) { } } -var tickerChannelPushData = `{"arg": {"channel": "tickers","instId": "LTC-USD-200327"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","last": "9999.99","lastSz": "0.1","askPx": "9999.99","askSz": "11","bidPx": "8888.88","bidSz": "5","open24h": "9000","high24h": "10000","low24h": "8888.88","volCcy24h": "2222","vol24h": "2222","sodUtc0": "2222","sodUtc8": "2222","ts": "1597026383085"}]}` +const tickerChannelPushData = `{"arg": {"channel": "tickers","instId": "LTC-USD-200327"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","last": "9999.99","lastSz": "0.1","askPx": "9999.99","askSz": "11","bidPx": "8888.88","bidSz": "5","open24h": "9000","high24h": "10000","low24h": "8888.88","volCcy24h": "2222","vol24h": "2222","sodUtc0": "2222","sodUtc8": "2222","ts": "1597026383085"}]}` func TestTickerChannel(t *testing.T) { t.Parallel() @@ -2342,7 +2342,7 @@ func TestTickerChannel(t *testing.T) { } } -var openInterestChannelPushData = `{"arg": {"channel": "open-interest","instId": "LTC-USD-SWAP"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","oi": "5000","oiCcy": "555.55","ts": "1597026383085"}]}` +const openInterestChannelPushData = `{"arg": {"channel": "open-interest","instId": "LTC-USD-SWAP"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","oi": "5000","oiCcy": "555.55","ts": "1597026383085"}]}` func TestOpenInterestPushData(t *testing.T) { t.Parallel() @@ -2351,7 +2351,7 @@ func TestOpenInterestPushData(t *testing.T) { } } -var candlesticksPushData = `{"arg": {"channel": "candle1D","instId": "BTC-USD-191227"},"data": [["1597026383085","8533.02","8553.74","8527.17","8548.26","45247","529.5858061"]]}` +const candlesticksPushData = `{"arg": {"channel": "candle1D","instId": "BTC-USD-191227"},"data": [["1597026383085","8533.02","8553.74","8527.17","8548.26","45247","529.5858061"]]}` func TestCandlestickPushData(t *testing.T) { t.Parallel() @@ -2360,7 +2360,7 @@ func TestCandlestickPushData(t *testing.T) { } } -var tradePushDataJSON = `{"arg": {"channel": "trades","instId": "BTC-USDT"},"data": [{"instId": "BTC-USDT","tradeId": "130639474","px": "42219.9","sz": "0.12060306","side": "buy","ts": "1630048897897"}]}` +const tradePushDataJSON = `{"arg": {"channel": "trades","instId": "BTC-USDT"},"data": [{"instId": "BTC-USDT","tradeId": "130639474","px": "42219.9","sz": "0.12060306","side": "buy","ts": "1630048897897"}]}` func TestTradePushData(t *testing.T) { t.Parallel() @@ -2369,7 +2369,7 @@ func TestTradePushData(t *testing.T) { } } -var estimatedDeliveryAndExercisePricePushDataJSON = `{"arg": {"args": "estimated-price","instType": "FUTURES","uly": "BTC-USD"},"data": [{"instType": "FUTURES","instId": "BTC-USD-170310","settlePx": "200","ts": "1597026383085"}]}` +const estimatedDeliveryAndExercisePricePushDataJSON = `{"arg": {"args": "estimated-price","instType": "FUTURES","uly": "BTC-USD"},"data": [{"instType": "FUTURES","instId": "BTC-USD-170310","settlePx": "200","ts": "1597026383085"}]}` func TestEstimatedDeliveryAndExercisePricePushData(t *testing.T) { t.Parallel() @@ -2378,7 +2378,7 @@ func TestEstimatedDeliveryAndExercisePricePushData(t *testing.T) { } } -var markPricePushData = `{"arg": {"channel": "mark-price","instId": "LTC-USD-190628"},"data": [{"instType": "FUTURES","instId": "LTC-USD-190628","markPx": "0.1","ts": "1597026383085"}]}` +const markPricePushData = `{"arg": {"channel": "mark-price","instId": "LTC-USD-190628"},"data": [{"instType": "FUTURES","instId": "LTC-USD-190628","markPx": "0.1","ts": "1597026383085"}]}` func TestMarkPricePushData(t *testing.T) { t.Parallel() @@ -2387,7 +2387,7 @@ func TestMarkPricePushData(t *testing.T) { } } -var markPriceCandlestickPushData = `{"arg": {"channel": "mark-price-candle1D","instId": "BTC-USD-190628"},"data": [["1597026383085", "3.721", "3.743", "3.677", "3.708"],["1597026383085", "3.731", "3.799", "3.494", "3.72"]]}` +const markPriceCandlestickPushData = `{"arg": {"channel": "mark-price-candle1D","instId": "BTC-USD-190628"},"data": [["1597026383085", "3.721", "3.743", "3.677", "3.708"],["1597026383085", "3.731", "3.799", "3.494", "3.72"]]}` func TestMarkPriceCandlestickPushData(t *testing.T) { t.Parallel() @@ -2396,7 +2396,7 @@ func TestMarkPriceCandlestickPushData(t *testing.T) { } } -var priceLimitPushDataJSON = `{ "arg": { "channel": "price-limit", "instId": "LTC-USD-190628" }, "data": [{ "instId": "LTC-USD-190628", "buyLmt": "200", "sellLmt": "300", "ts": "1597026383085" }]}` +const priceLimitPushDataJSON = `{ "arg": { "channel": "price-limit", "instId": "LTC-USD-190628" }, "data": [{ "instId": "LTC-USD-190628", "buyLmt": "200", "sellLmt": "300", "ts": "1597026383085" }]}` func TestPriceLimitPushData(t *testing.T) { t.Parallel() @@ -2405,8 +2405,8 @@ func TestPriceLimitPushData(t *testing.T) { } } -var testSnapshotOrderbookPushData = `{"arg":{"channel":"books","instId":"BTC-USDT"},"action":"snapshot","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` -var updateOrderBookPushDataJSON = `{"arg":{"channel":"books","instId":"BTC-USDT"},"action":"update","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` +const testSnapshotOrderbookPushData = `{"arg":{"channel":"books","instId":"BTC-USDT"},"action":"snapshot","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` +const updateOrderBookPushDataJSON = `{"arg":{"channel":"books","instId":"BTC-USDT"},"action":"update","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` func TestSnapshotAndUpdateOrderBookPushData(t *testing.T) { t.Parallel() @@ -2418,7 +2418,7 @@ func TestSnapshotAndUpdateOrderBookPushData(t *testing.T) { } } -var snapshotOrderBookPushData = `{"arg":{"channel":"books","instId":"TRX-USD-220812"},"action":"snapshot","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` +const snapshotOrderBookPushData = `{"arg":{"channel":"books","instId":"TRX-USD-220812"},"action":"snapshot","data":[{"asks":[["0.07026","5","0","1"],["0.07027","765","0","3"],["0.07028","110","0","1"],["0.0703","1264","0","1"],["0.07034","280","0","1"],["0.07035","2255","0","1"],["0.07036","28","0","1"],["0.07037","63","0","1"],["0.07039","137","0","2"],["0.0704","48","0","1"],["0.07041","32","0","1"],["0.07043","3985","0","1"],["0.07057","257","0","1"],["0.07058","7870","0","1"],["0.07059","161","0","1"],["0.07061","4539","0","1"],["0.07068","1438","0","3"],["0.07088","3162","0","1"],["0.07104","99","0","1"],["0.07108","5018","0","1"],["0.07115","1540","0","1"],["0.07129","5080","0","1"],["0.07145","1512","0","1"],["0.0715","5016","0","1"],["0.07171","5026","0","1"],["0.07192","5062","0","1"],["0.07197","1517","0","1"],["0.0726","1511","0","1"],["0.07314","10376","0","1"],["0.07354","1","0","1"],["0.07466","10277","0","1"],["0.07626","269","0","1"],["0.07636","269","0","1"],["0.0809","1","0","1"],["0.08899","1","0","1"],["0.09789","1","0","1"],["0.10768","1","0","1"]],"bids":[["0.07014","56","0","2"],["0.07011","608","0","1"],["0.07009","110","0","1"],["0.07006","1264","0","1"],["0.07004","2347","0","3"],["0.07003","279","0","1"],["0.07001","52","0","1"],["0.06997","91","0","1"],["0.06996","4242","0","2"],["0.06995","486","0","1"],["0.06992","161","0","1"],["0.06991","63","0","1"],["0.06988","7518","0","1"],["0.06976","186","0","1"],["0.06975","71","0","1"],["0.06973","1086","0","1"],["0.06961","513","0","2"],["0.06959","4603","0","1"],["0.0695","186","0","1"],["0.06946","3043","0","1"],["0.06939","103","0","1"],["0.0693","5053","0","1"],["0.06909","5039","0","1"],["0.06888","5037","0","1"],["0.06886","1526","0","1"],["0.06867","5008","0","1"],["0.06846","5065","0","1"],["0.06826","1572","0","1"],["0.06801","1565","0","1"],["0.06748","67","0","1"],["0.0674","111","0","1"],["0.0672","10038","0","1"],["0.06652","1","0","1"],["0.06625","1526","0","1"],["0.06619","10924","0","1"],["0.05986","1","0","1"],["0.05387","1","0","1"],["0.04848","1","0","1"],["0.04363","1","0","1"]],"ts":"1659792392540","checksum":-1462286744}]}` func TestSnapshotPushData(t *testing.T) { t.Parallel() @@ -2427,7 +2427,7 @@ func TestSnapshotPushData(t *testing.T) { } } -var calculateOrderbookChecksumUpdateorderbookJSON = `{"Bids":[{"Amount":56,"Price":0.07014,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":608,"Price":0.07011,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":110,"Price":0.07009,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1264,"Price":0.07006,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":2347,"Price":0.07004,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":279,"Price":0.07003,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":52,"Price":0.07001,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":91,"Price":0.06997,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":4242,"Price":0.06996,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":486,"Price":0.06995,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":161,"Price":0.06992,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":63,"Price":0.06991,"ID":0,"Period":0,"LiquidationOrders":0, +const calculateOrderbookChecksumUpdateorderbookJSON = `{"Bids":[{"Amount":56,"Price":0.07014,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":608,"Price":0.07011,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":110,"Price":0.07009,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1264,"Price":0.07006,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":2347,"Price":0.07004,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":279,"Price":0.07003,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":52,"Price":0.07001,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":91,"Price":0.06997,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":4242,"Price":0.06996,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":486,"Price":0.06995,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":161,"Price":0.06992,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":63,"Price":0.06991,"ID":0,"Period":0,"LiquidationOrders":0, "OrderCount":0},{"Amount":7518,"Price":0.06988,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":186,"Price":0.06976,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":71,"Price":0.06975,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1086,"Price":0.06973,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":513,"Price":0.06961,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":4603,"Price":0.06959,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":186,"Price":0.0695,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":3043,"Price":0.06946,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":103,"Price":0.06939,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5053,"Price":0.0693,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5039,"Price":0.06909,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5037,"Price":0.06888,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1526,"Price":0.06886,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5008,"Price":0.06867,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5065,"Price":0.06846,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1572,"Price":0.06826,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1565,"Price":0.06801,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":67,"Price":0.06748,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":111,"Price":0.0674,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":10038,"Price":0.0672,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.06652,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1526,"Price":0.06625,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":10924,"Price":0.06619,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.05986,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.05387,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.04848,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.04363,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0}],"Asks":[{"Amount":5,"Price":0.07026,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":765,"Price":0.07027,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":110,"Price":0.07028,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1264,"Price":0.0703,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":280,"Price":0.07034,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":2255,"Price":0.07035,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":28,"Price":0.07036,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":63,"Price":0.07037,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":137,"Price":0.07039,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":48,"Price":0.0704,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":32,"Price":0.07041,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":3985,"Price":0.07043,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":257,"Price":0.07057,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":7870,"Price":0.07058,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":161,"Price":0.07059,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":4539,"Price":0.07061,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1438,"Price":0.07068,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":3162,"Price":0.07088,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":99,"Price":0.07104,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5018,"Price":0.07108,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1540,"Price":0.07115,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5080,"Price":0.07129,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1512,"Price":0.07145,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5016,"Price":0.0715,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5026,"Price":0.07171,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":5062,"Price":0.07192,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1517,"Price":0.07197,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1511,"Price":0.0726,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":10376,"Price":0.07314,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.07354,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":10277,"Price":0.07466,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":269,"Price":0.07626,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":269,"Price":0.07636,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.0809,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.08899,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.09789,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0},{"Amount":1,"Price":0.10768,"ID":0,"Period":0,"LiquidationOrders":0,"OrderCount":0}],"Exchange":"Okx","Pair":"BTC-USDT","Asset":"spot","LastUpdated":"0001-01-01T00:00:00Z","LastUpdateID":0,"PriceDuplication":false,"IsFundingRate":false,"RestSnapshot":false,"IDAlignment":false}` func TestCalculateUpdateOrderbookChecksum(t *testing.T) { @@ -2446,7 +2446,7 @@ func TestCalculateUpdateOrderbookChecksum(t *testing.T) { } } -var optionSummaryPushDataJSON = `{"arg": {"channel": "opt-summary","uly": "BTC-USD"},"data": [{"instType": "OPTION","instId": "BTC-USD-200103-5500-C","uly": "BTC-USD","delta": "0.7494223636","gamma": "-0.6765419039","theta": "-0.0000809873","vega": "0.0000077307","deltaBS": "0.7494223636","gammaBS": "-0.6765419039","thetaBS": "-0.0000809873","vegaBS": "0.0000077307","realVol": "0","bidVol": "","askVol": "1.5625","markVol": "0.9987","lever": "4.0342","fwdPx": "39016.8143629068452065","ts": "1597026383085"}]}` +const optionSummaryPushDataJSON = `{"arg": {"channel": "opt-summary","uly": "BTC-USD"},"data": [{"instType": "OPTION","instId": "BTC-USD-200103-5500-C","uly": "BTC-USD","delta": "0.7494223636","gamma": "-0.6765419039","theta": "-0.0000809873","vega": "0.0000077307","deltaBS": "0.7494223636","gammaBS": "-0.6765419039","thetaBS": "-0.0000809873","vegaBS": "0.0000077307","realVol": "0","bidVol": "","askVol": "1.5625","markVol": "0.9987","lever": "4.0342","fwdPx": "39016.8143629068452065","ts": "1597026383085"}]}` func TestOptionSummaryPushData(t *testing.T) { t.Parallel() @@ -2455,7 +2455,7 @@ func TestOptionSummaryPushData(t *testing.T) { } } -var fundingRatePushDataJSON = `{"arg": {"channel": "funding-rate","instId": "BTC-USD-SWAP"},"data": [{"instType": "SWAP","instId": "BTC-USD-SWAP","fundingRate": "0.018","nextFundingRate": "","fundingTime": "1597026383085"}]}` +const fundingRatePushDataJSON = `{"arg": {"channel": "funding-rate","instId": "BTC-USD-SWAP"},"data": [{"instType": "SWAP","instId": "BTC-USD-SWAP","fundingRate": "0.018","nextFundingRate": "","fundingTime": "1597026383085"}]}` func TestFundingRatePushData(t *testing.T) { t.Parallel() @@ -2464,7 +2464,7 @@ func TestFundingRatePushData(t *testing.T) { } } -var indexCandlestickPushDataJSON = `{"arg": {"channel": "index-candle30m","instId": "BTC-USD"},"data": [["1597026383085", "3811.31", "3811.31", "3811.31", "3811.31"]]}` +const indexCandlestickPushDataJSON = `{"arg": {"channel": "index-candle30m","instId": "BTC-USD"},"data": [["1597026383085", "3811.31", "3811.31", "3811.31", "3811.31"]]}` func TestIndexCandlestickPushData(t *testing.T) { t.Parallel() @@ -2473,7 +2473,7 @@ func TestIndexCandlestickPushData(t *testing.T) { } } -var indexTickerPushDataJSON = `{"arg": {"channel": "index-tickers","instId": "BTC-USDT"},"data": [{"instId": "BTC-USDT","idxPx": "0.1","high24h": "0.5","low24h": "0.1","open24h": "0.1","sodUtc0": "0.1","sodUtc8": "0.1","ts": "1597026383085"}]}` +const indexTickerPushDataJSON = `{"arg": {"channel": "index-tickers","instId": "BTC-USDT"},"data": [{"instId": "BTC-USDT","idxPx": "0.1","high24h": "0.5","low24h": "0.1","open24h": "0.1","sodUtc0": "0.1","sodUtc8": "0.1","ts": "1597026383085"}]}` func TestIndexTickersPushData(t *testing.T) { t.Parallel() @@ -2482,7 +2482,7 @@ func TestIndexTickersPushData(t *testing.T) { } } -var statusPushDataJSON = `{"arg": {"channel": "status"},"data": [{"title": "Spot System Upgrade","state": "scheduled","begin": "1610019546","href": "","end": "1610019546","serviceType": "1","system": "classic","scheDesc": "","ts": "1597026383085"}]}` +const statusPushDataJSON = `{"arg": {"channel": "status"},"data": [{"title": "Spot System Upgrade","state": "scheduled","begin": "1610019546","href": "","end": "1610019546","serviceType": "1","system": "classic","scheDesc": "","ts": "1597026383085"}]}` func TestStatusPushData(t *testing.T) { t.Parallel() @@ -2491,7 +2491,7 @@ func TestStatusPushData(t *testing.T) { } } -var publicStructBlockTradesPushDataJSON = `{"arg":{"channel":"public-struc-block-trades"},"data":[{"cTime":"1608267227834","blockTdId":"1802896","legs":[{"px":"0.323","sz":"25.0","instId":"BTC-USD-20220114-13250-C","side":"sell","tradeId":"15102"},{"px":"0.666","sz":"25","instId":"BTC-USD-20220114-21125-C","side":"buy","tradeId":"15103"}]}]}` +const publicStructBlockTradesPushDataJSON = `{"arg":{"channel":"public-struc-block-trades"},"data":[{"cTime":"1608267227834","blockTdId":"1802896","legs":[{"px":"0.323","sz":"25.0","instId":"BTC-USD-20220114-13250-C","side":"sell","tradeId":"15102"},{"px":"0.666","sz":"25","instId":"BTC-USD-20220114-21125-C","side":"buy","tradeId":"15103"}]}]}` func TestPublicStructBlockTrades(t *testing.T) { t.Parallel() @@ -2500,7 +2500,7 @@ func TestPublicStructBlockTrades(t *testing.T) { } } -var blockTickerPushDataJSON = `{"arg": {"channel": "block-tickers"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","volCcy24h": "0","vol24h": "0","ts": "1597026383085"}]}` +const blockTickerPushDataJSON = `{"arg": {"channel": "block-tickers"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","volCcy24h": "0","vol24h": "0","ts": "1597026383085"}]}` func TestBlockTickerPushData(t *testing.T) { t.Parallel() @@ -2509,7 +2509,7 @@ func TestBlockTickerPushData(t *testing.T) { } } -var accountPushDataJSON = `{"arg": {"channel": "block-tickers"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","volCcy24h": "0","vol24h": "0","ts": "1597026383085"}]}` +const accountPushDataJSON = `{"arg": {"channel": "block-tickers"},"data": [{"instType": "SWAP","instId": "LTC-USD-SWAP","volCcy24h": "0","vol24h": "0","ts": "1597026383085"}]}` func TestAccountPushData(t *testing.T) { t.Parallel() @@ -2518,8 +2518,8 @@ func TestAccountPushData(t *testing.T) { } } -var positionPushDataJSON = `{"arg":{"channel":"positions","instType":"FUTURES"},"data":[{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` -var positionPushDataWithUnderlyingJSON = `{"arg": {"channel": "positions","uid": "77982378738415879","instType": "ANY"},"data": [{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","usdPx":"","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}, {"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-SWAP","instType":"SWAP","interest":"0","last":"2566.22","usdPx":"","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` +const positionPushDataJSON = `{"arg":{"channel":"positions","instType":"FUTURES"},"data":[{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` +const positionPushDataWithUnderlyingJSON = `{"arg": {"channel": "positions","uid": "77982378738415879","instType": "ANY"},"data": [{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","usdPx":"","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}, {"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-SWAP","instType":"SWAP","interest":"0","last":"2566.22","usdPx":"","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` func TestPositionPushData(t *testing.T) { t.Parallel() @@ -2531,7 +2531,7 @@ func TestPositionPushData(t *testing.T) { } } -var balanceAndPositionJSON = `{"arg": {"channel": "balance_and_position","uid": "77982378738415879"},"data": [{"pTime": "1597026383085","eventType": "snapshot","balData": [{"ccy": "BTC","cashBal": "1","uTime": "1597026383085"}],"posData": [{"posId": "1111111111","tradeId": "2","instId": "BTC-USD-191018","instType": "FUTURES","mgnMode": "cross","posSide": "long","pos": "10","ccy": "BTC","posCcy": "","avgPx": "3320","uTIme": "1597026383085"}]}]}` +const balanceAndPositionJSON = `{"arg": {"channel": "balance_and_position","uid": "77982378738415879"},"data": [{"pTime": "1597026383085","eventType": "snapshot","balData": [{"ccy": "BTC","cashBal": "1","uTime": "1597026383085"}],"posData": [{"posId": "1111111111","tradeId": "2","instId": "BTC-USD-191018","instType": "FUTURES","mgnMode": "cross","posSide": "long","pos": "10","ccy": "BTC","posCcy": "","avgPx": "3320","uTIme": "1597026383085"}]}]}` func TestBalanceAndPosition(t *testing.T) { t.Parallel() @@ -2540,7 +2540,7 @@ func TestBalanceAndPosition(t *testing.T) { } } -var orderPushDataJSON = `{"arg": { "channel": "orders", "instType": "SPOT", "instId": "BTC-USDT", "uid": "614488474791936"},"data": [ { "accFillSz": "0.001", "amendResult": "", "avgPx": "31527.1", "cTime": "1654084334977", "category": "normal", "ccy": "", "clOrdId": "", "code": "0", "execType": "M", "fee": "-0.02522168", "feeCcy": "USDT", "fillFee": "-0.02522168", "fillFeeCcy": "USDT", "fillNotionalUsd": "31.50818374", "fillPx": "31527.1", "fillSz": "0.001", "fillTime": "1654084353263", "instId": "BTC-USDT", "instType": "SPOT", "lever": "0", "msg": "", "notionalUsd": "31.50818374", "ordId": "452197707845865472", "ordType": "limit", "pnl": "0", "posSide": "", "px": "31527.1", "rebate": "0", "rebateCcy": "BTC", "reduceOnly": "false", "reqId": "", "side": "sell", "slOrdPx": "", "slTriggerPx": "", "slTriggerPxType": "last", "source": "", "state": "filled", "sz": "0.001", "tag": "", "tdMode": "cash", "tgtCcy": "", "tpOrdPx": "", "tpTriggerPx": "", "tpTriggerPxType": "last", "tradeId": "242589207", "uTime": "1654084353264" }]}` +const orderPushDataJSON = `{"arg": { "channel": "orders", "instType": "SPOT", "instId": "BTC-USDT", "uid": "614488474791936"},"data": [ { "accFillSz": "0.001", "amendResult": "", "avgPx": "31527.1", "cTime": "1654084334977", "category": "normal", "ccy": "", "clOrdId": "", "code": "0", "execType": "M", "fee": "-0.02522168", "feeCcy": "USDT", "fillFee": "-0.02522168", "fillFeeCcy": "USDT", "fillNotionalUsd": "31.50818374", "fillPx": "31527.1", "fillSz": "0.001", "fillTime": "1654084353263", "instId": "BTC-USDT", "instType": "SPOT", "lever": "0", "msg": "", "notionalUsd": "31.50818374", "ordId": "452197707845865472", "ordType": "limit", "pnl": "0", "posSide": "", "px": "31527.1", "rebate": "0", "rebateCcy": "BTC", "reduceOnly": "false", "reqId": "", "side": "sell", "slOrdPx": "", "slTriggerPx": "", "slTriggerPxType": "last", "source": "", "state": "filled", "sz": "0.001", "tag": "", "tdMode": "cash", "tgtCcy": "", "tpOrdPx": "", "tpTriggerPx": "", "tpTriggerPxType": "last", "tradeId": "242589207", "uTime": "1654084353264" }]}` func TestOrderPushData(t *testing.T) { t.Parallel() @@ -2549,7 +2549,7 @@ func TestOrderPushData(t *testing.T) { } } -var algoOrdersPushDataJSON = `{"arg": {"channel": "orders-algo","uid": "77982378738415879","instType": "FUTURES","instId": "BTC-USD-200329"},"data": [{"instType": "FUTURES","instId": "BTC-USD-200329","ordId": "312269865356374016","ccy": "BTC","algoId": "1234","px": "999","sz": "3","tdMode": "cross","tgtCcy": "","notionalUsd": "","ordType": "trigger","side": "buy","posSide": "long","state": "live","lever": "20","tpTriggerPx": "","tpTriggerPxType": "","tpOrdPx": "","slTriggerPx": "","slTriggerPxType": "","triggerPx": "99","triggerPxType": "last","ordPx": "12","actualSz": "","actualPx": "","tag": "adadadadad","actualSide": "","triggerTime": "1597026383085","cTime": "1597026383000"}]}` +const algoOrdersPushDataJSON = `{"arg": {"channel": "orders-algo","uid": "77982378738415879","instType": "FUTURES","instId": "BTC-USD-200329"},"data": [{"instType": "FUTURES","instId": "BTC-USD-200329","ordId": "312269865356374016","ccy": "BTC","algoId": "1234","px": "999","sz": "3","tdMode": "cross","tgtCcy": "","notionalUsd": "","ordType": "trigger","side": "buy","posSide": "long","state": "live","lever": "20","tpTriggerPx": "","tpTriggerPxType": "","tpOrdPx": "","slTriggerPx": "","slTriggerPxType": "","triggerPx": "99","triggerPxType": "last","ordPx": "12","actualSz": "","actualPx": "","tag": "adadadadad","actualSide": "","triggerTime": "1597026383085","cTime": "1597026383000"}]}` func TestAlgoOrderPushData(t *testing.T) { t.Parallel() @@ -2558,7 +2558,7 @@ func TestAlgoOrderPushData(t *testing.T) { } } -var advancedAlgoOrderPushDataJSON = `{"arg":{"channel":"algo-advance","uid": "77982378738415879","instType":"SPOT","instId":"BTC-USDT"},"data":[{"actualPx":"","actualSide":"","actualSz":"0","algoId":"355056228680335360","cTime":"1630924001545","ccy":"","count":"1","instId":"BTC-USDT","instType":"SPOT","lever":"0","notionalUsd":"","ordPx":"","ordType":"iceberg","pTime":"1630924295204","posSide":"net","pxLimit":"10","pxSpread":"1","pxVar":"","side":"buy","slOrdPx":"","slTriggerPx":"","state":"pause","sz":"0.1","szLimit":"0.1","tdMode":"cash","timeInterval":"","tpOrdPx":"","tpTriggerPx":"","tag": "adadadadad","triggerPx":"","triggerTime":"","callbackRatio":"","callbackSpread":"","activePx":"","moveTriggerPx":""}]}` +const advancedAlgoOrderPushDataJSON = `{"arg":{"channel":"algo-advance","uid": "77982378738415879","instType":"SPOT","instId":"BTC-USDT"},"data":[{"actualPx":"","actualSide":"","actualSz":"0","algoId":"355056228680335360","cTime":"1630924001545","ccy":"","count":"1","instId":"BTC-USDT","instType":"SPOT","lever":"0","notionalUsd":"","ordPx":"","ordType":"iceberg","pTime":"1630924295204","posSide":"net","pxLimit":"10","pxSpread":"1","pxVar":"","side":"buy","slOrdPx":"","slTriggerPx":"","state":"pause","sz":"0.1","szLimit":"0.1","tdMode":"cash","timeInterval":"","tpOrdPx":"","tpTriggerPx":"","tag": "adadadadad","triggerPx":"","triggerTime":"","callbackRatio":"","callbackSpread":"","activePx":"","moveTriggerPx":""}]}` func TestAdvancedAlgoOrderPushData(t *testing.T) { t.Parallel() @@ -2567,7 +2567,7 @@ func TestAdvancedAlgoOrderPushData(t *testing.T) { } } -var positionRiskPushDataJSON = `{"arg": {"channel": "liquidation-warning","uid": "77982378738415879","instType": "ANY"},"data": [{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}, {"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-SWAP","instType":"SWAP","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` +const positionRiskPushDataJSON = `{"arg": {"channel": "liquidation-warning","uid": "77982378738415879","instType": "ANY"},"data": [{"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-210430","instType":"FUTURES","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}, {"adl":"1","availPos":"1","avgPx":"2566.31","cTime":"1619507758793","ccy":"ETH","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","imr":"","instId":"ETH-USD-SWAP","instType":"SWAP","interest":"0","last":"2566.22","lever":"10","liab":"","liabCcy":"","liqPx":"2352.8496681818233","markPx":"2353.849","margin":"0.0003896645377994","mgnMode":"isolated","mgnRatio":"11.731726509588816","mmr":"0.0000311811092368","notionalUsd":"2276.2546609009605","optVal":"","pTime":"1619507761462","pos":"1","posCcy":"","posId":"307173036051017730","posSide":"long","thetaBS":"","thetaPA":"","tradeId":"109844","uTime":"1619507761462","upl":"-0.0000009932766034","uplRatio":"-0.0025490556801078","vegaBS":"","vegaPA":""}]}` func TestPositionRiskPushDataJSON(t *testing.T) { t.Parallel() @@ -2576,7 +2576,7 @@ func TestPositionRiskPushDataJSON(t *testing.T) { } } -var accountGreeksPushData = `{"arg": {"channel": "account-greeks","ccy": "BTC"},"data": [{"thetaBS": "","thetaPA":"","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","vegaBS":"", "vegaPA":"","ccy":"BTC","ts":"1620282889345"}]}` +const accountGreeksPushData = `{"arg": {"channel": "account-greeks","ccy": "BTC"},"data": [{"thetaBS": "","thetaPA":"","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","vegaBS":"", "vegaPA":"","ccy":"BTC","ts":"1620282889345"}]}` func TestAccountGreeksPushData(t *testing.T) { t.Parallel() @@ -2585,7 +2585,7 @@ func TestAccountGreeksPushData(t *testing.T) { } } -var rfqsPushDataJSON = `{"arg": {"channel": "account-greeks","ccy": "BTC"},"data": [{"thetaBS": "","thetaPA":"","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","vegaBS":"", "vegaPA":"","ccy":"BTC","ts":"1620282889345"}]}` +const rfqsPushDataJSON = `{"arg": {"channel": "account-greeks","ccy": "BTC"},"data": [{"thetaBS": "","thetaPA":"","deltaBS":"","deltaPA":"","gammaBS":"","gammaPA":"","vegaBS":"", "vegaPA":"","ccy":"BTC","ts":"1620282889345"}]}` func TestRfqs(t *testing.T) { t.Parallel() @@ -2594,7 +2594,7 @@ func TestRfqs(t *testing.T) { } } -var accountsPushDataJSON = `{ "arg": { "channel": "account", "ccy": "BTC", "uid": "77982378738415879" }, "data": [ { "uTime": "1597026383085", "totalEq": "41624.32", "isoEq": "3624.32", "adjEq": "41624.32", "ordFroz": "0", "imr": "4162.33", "mmr": "4", "notionalUsd": "", "mgnRatio": "41624.32", "details": [ { "availBal": "", "availEq": "1", "ccy": "BTC", "cashBal": "1", "uTime": "1617279471503", "disEq": "50559.01", "eq": "1", "eqUsd": "45078.3790756226851775", "frozenBal": "0", "interest": "0", "isoEq": "0", "liab": "0", "maxLoan": "", "mgnRatio": "", "notionalLever": "0.0022195262185864", "ordFrozen": "0", "upl": "0", "uplLiab": "0", "crossLiab": "0", "isoLiab": "0", "coinUsdPrice": "60000", "stgyEq":"0", "spotInUseAmt":"", "isoUpl":"" } ] } ]}` +const accountsPushDataJSON = `{ "arg": { "channel": "account", "ccy": "BTC", "uid": "77982378738415879" }, "data": [ { "uTime": "1597026383085", "totalEq": "41624.32", "isoEq": "3624.32", "adjEq": "41624.32", "ordFroz": "0", "imr": "4162.33", "mmr": "4", "notionalUsd": "", "mgnRatio": "41624.32", "details": [ { "availBal": "", "availEq": "1", "ccy": "BTC", "cashBal": "1", "uTime": "1617279471503", "disEq": "50559.01", "eq": "1", "eqUsd": "45078.3790756226851775", "frozenBal": "0", "interest": "0", "isoEq": "0", "liab": "0", "maxLoan": "", "mgnRatio": "", "notionalLever": "0.0022195262185864", "ordFrozen": "0", "upl": "0", "uplLiab": "0", "crossLiab": "0", "isoLiab": "0", "coinUsdPrice": "60000", "stgyEq":"0", "spotInUseAmt":"", "isoUpl":"" } ] } ]}` func TestAccounts(t *testing.T) { t.Parallel() @@ -2603,7 +2603,7 @@ func TestAccounts(t *testing.T) { } } -var quotesPushDataJSON = `{"arg":{"channel":"quotes"},"data":[{"validUntil":"1608997227854","uTime":"1608267227834","cTime":"1608267227834","legs":[{"px":"0.0023","sz":"25.0","instId":"BTC-USD-220114-25000-C","side":"sell","tgtCcy":""},{"px":"0.0045","sz":"25","instId":"BTC-USD-220114-35000-C","side":"buy","tgtCcy":""}],"quoteId":"25092","rfqId":"18753","traderCode":"SATS","quoteSide":"sell","state":"canceled","clQuoteId":""}]}` +const quotesPushDataJSON = `{"arg":{"channel":"quotes"},"data":[{"validUntil":"1608997227854","uTime":"1608267227834","cTime":"1608267227834","legs":[{"px":"0.0023","sz":"25.0","instId":"BTC-USD-220114-25000-C","side":"sell","tgtCcy":""},{"px":"0.0045","sz":"25","instId":"BTC-USD-220114-35000-C","side":"buy","tgtCcy":""}],"quoteId":"25092","rfqId":"18753","traderCode":"SATS","quoteSide":"sell","state":"canceled","clQuoteId":""}]}` func TestQuotesPushData(t *testing.T) { t.Parallel() @@ -2612,7 +2612,7 @@ func TestQuotesPushData(t *testing.T) { } } -var structureBlockTradesPushDataJSON = `{"arg":{"channel":"struc-block-trades"},"data":[{"cTime":"1608267227834","rfqId":"18753","clRfqId":"","quoteId":"25092","clQuoteId":"","blockTdId":"180184","tTraderCode":"ANAND","mTraderCode":"WAGMI","legs":[{"px":"0.0023","sz":"25.0","instId":"BTC-USD-20220630-60000-C","side":"sell","fee":"0.1001","feeCcy":"BTC","tradeId":"10211","tgtCcy":""},{"px":"0.0033","sz":"25","instId":"BTC-USD-20220630-50000-C","side":"buy","fee":"0.1001","feeCcy":"BTC","tradeId":"10212","tgtCcy":""}]}]}` +const structureBlockTradesPushDataJSON = `{"arg":{"channel":"struc-block-trades"},"data":[{"cTime":"1608267227834","rfqId":"18753","clRfqId":"","quoteId":"25092","clQuoteId":"","blockTdId":"180184","tTraderCode":"ANAND","mTraderCode":"WAGMI","legs":[{"px":"0.0023","sz":"25.0","instId":"BTC-USD-20220630-60000-C","side":"sell","fee":"0.1001","feeCcy":"BTC","tradeId":"10211","tgtCcy":""},{"px":"0.0033","sz":"25","instId":"BTC-USD-20220630-50000-C","side":"buy","fee":"0.1001","feeCcy":"BTC","tradeId":"10212","tgtCcy":""}]}]}` func TestStructureBlockTradesPushData(t *testing.T) { t.Parallel() @@ -2621,7 +2621,7 @@ func TestStructureBlockTradesPushData(t *testing.T) { } } -var spotGridAlgoOrdersPushDataJSON = `{"arg": {"channel": "grid-orders-spot","instType": "ANY"},"data": [{"algoId": "448965992920907776","algoOrdType": "grid","annualizedRate": "0","arbitrageNum": "0","baseSz": "0","cTime": "1653313834104","cancelType": "0","curBaseSz": "0.001776289214","curQuoteSz": "46.801755866","floatProfit": "-0.4953878967772","gridNum": "6","gridProfit": "0","instId": "BTC-USDC","instType": "SPOT","investment": "100","maxPx": "33444.8","minPx": "24323.5","pTime": "1653476023742","perMaxProfitRate": "0.060375293181491054543","perMinProfitRate": "0.0455275366818586","pnlRatio": "0","quoteSz": "100","runPx": "30478.1","runType": "1","singleAmt": "0.00059261","slTriggerPx": "","state": "running","stopResult": "0","stopType": "0","totalAnnualizedRate": "-0.9643551057262827","totalPnl": "-0.4953878967772","tpTriggerPx": "","tradeNum": "3","triggerTime": "1653378736894","uTime": "1653378736894"}]}` +const spotGridAlgoOrdersPushDataJSON = `{"arg": {"channel": "grid-orders-spot","instType": "ANY"},"data": [{"algoId": "448965992920907776","algoOrdType": "grid","annualizedRate": "0","arbitrageNum": "0","baseSz": "0","cTime": "1653313834104","cancelType": "0","curBaseSz": "0.001776289214","curQuoteSz": "46.801755866","floatProfit": "-0.4953878967772","gridNum": "6","gridProfit": "0","instId": "BTC-USDC","instType": "SPOT","investment": "100","maxPx": "33444.8","minPx": "24323.5","pTime": "1653476023742","perMaxProfitRate": "0.060375293181491054543","perMinProfitRate": "0.0455275366818586","pnlRatio": "0","quoteSz": "100","runPx": "30478.1","runType": "1","singleAmt": "0.00059261","slTriggerPx": "","state": "running","stopResult": "0","stopType": "0","totalAnnualizedRate": "-0.9643551057262827","totalPnl": "-0.4953878967772","tpTriggerPx": "","tradeNum": "3","triggerTime": "1653378736894","uTime": "1653378736894"}]}` func TestSpotGridAlgoOrdersPushData(t *testing.T) { t.Parallel() @@ -2630,7 +2630,7 @@ func TestSpotGridAlgoOrdersPushData(t *testing.T) { } } -var contractGridAlgoOrdersPushDataJSON = `{"arg": {"channel": "grid-orders-contract","instType": "ANY"},"data": [{"actualLever": "1.02","algoId": "449327675342323712","algoOrdType": "contract_grid","annualizedRate": "0.7572437878956523","arbitrageNum": "1","basePos": true,"cTime": "1653400065912","cancelType": "0","direction": "long","eq": "10129.419829834853","floatProfit": "109.537858234853","gridNum": "50","gridProfit": "19.8819716","instId": "BTC-USDT-SWAP","instType": "SWAP","investment": "10000","lever": "5","liqPx": "603.2149534767834","maxPx": "100000","minPx": "10","pTime": "1653484573918","perMaxProfitRate": "995.7080916791230692","perMinProfitRate": "0.0946277854875634","pnlRatio": "0.0129419829834853","runPx": "29216.3","runType": "1","singleAmt": "1","slTriggerPx": "","state": "running","stopType": "0","sz": "10000","tag": "","totalAnnualizedRate": "4.929207431970923","totalPnl": "129.419829834853","tpTriggerPx": "","tradeNum": "37","triggerTime": "1653400066940","uTime": "1653484573589","uly": "BTC-USDT"}]}` +const contractGridAlgoOrdersPushDataJSON = `{"arg": {"channel": "grid-orders-contract","instType": "ANY"},"data": [{"actualLever": "1.02","algoId": "449327675342323712","algoOrdType": "contract_grid","annualizedRate": "0.7572437878956523","arbitrageNum": "1","basePos": true,"cTime": "1653400065912","cancelType": "0","direction": "long","eq": "10129.419829834853","floatProfit": "109.537858234853","gridNum": "50","gridProfit": "19.8819716","instId": "BTC-USDT-SWAP","instType": "SWAP","investment": "10000","lever": "5","liqPx": "603.2149534767834","maxPx": "100000","minPx": "10","pTime": "1653484573918","perMaxProfitRate": "995.7080916791230692","perMinProfitRate": "0.0946277854875634","pnlRatio": "0.0129419829834853","runPx": "29216.3","runType": "1","singleAmt": "1","slTriggerPx": "","state": "running","stopType": "0","sz": "10000","tag": "","totalAnnualizedRate": "4.929207431970923","totalPnl": "129.419829834853","tpTriggerPx": "","tradeNum": "37","triggerTime": "1653400066940","uTime": "1653484573589","uly": "BTC-USDT"}]}` func TestContractGridAlgoOrdersPushData(t *testing.T) { t.Parallel() @@ -2639,7 +2639,7 @@ func TestContractGridAlgoOrdersPushData(t *testing.T) { } } -var gridPositionsPushDataJSON = `{"arg": {"channel": "grid-positions","uid": "44705892343619584","algoId": "449327675342323712"},"data": [{"adl": "1","algoId": "449327675342323712","avgPx": "29181.4638888888888895","cTime": "1653400065917","ccy": "USDT","imr": "2089.2690000000002","instId": "BTC-USDT-SWAP","instType": "SWAP","last": "29852.7","lever": "5","liqPx": "604.7617536513744","markPx": "29849.7","mgnMode": "cross","mgnRatio": "217.71740878394456","mmr": "41.78538","notionalUsd": "10435.794191550001","pTime": "1653536068723","pos": "35","posSide": "net","uTime": "1653445498682","upl": "232.83263888888962","uplRatio": "0.1139826489932205"}]}` +const gridPositionsPushDataJSON = `{"arg": {"channel": "grid-positions","uid": "44705892343619584","algoId": "449327675342323712"},"data": [{"adl": "1","algoId": "449327675342323712","avgPx": "29181.4638888888888895","cTime": "1653400065917","ccy": "USDT","imr": "2089.2690000000002","instId": "BTC-USDT-SWAP","instType": "SWAP","last": "29852.7","lever": "5","liqPx": "604.7617536513744","markPx": "29849.7","mgnMode": "cross","mgnRatio": "217.71740878394456","mmr": "41.78538","notionalUsd": "10435.794191550001","pTime": "1653536068723","pos": "35","posSide": "net","uTime": "1653445498682","upl": "232.83263888888962","uplRatio": "0.1139826489932205"}]}` func TestGridPositionsPushData(t *testing.T) { t.Parallel() @@ -2648,7 +2648,7 @@ func TestGridPositionsPushData(t *testing.T) { } } -var gridSubOrdersPushDataJSON = `{"arg": {"channel": "grid-sub-orders","uid": "44705892343619584","algoId": "449327675342323712"},"data": [{"accFillSz": "0","algoId": "449327675342323712","algoOrdType": "contract_grid","avgPx": "0","cTime": "1653445498664","ctVal": "0.01","fee": "0","feeCcy": "USDT","groupId": "-1","instId": "BTC-USDT-SWAP","instType": "SWAP","lever": "5","ordId": "449518234142904321","ordType": "limit","pTime": "1653486524502","pnl": "","posSide": "net","px": "28007.2","side": "buy","state": "live","sz": "1","tag":"","tdMode": "cross","uTime": "1653445498674"}]}` +const gridSubOrdersPushDataJSON = `{"arg": {"channel": "grid-sub-orders","uid": "44705892343619584","algoId": "449327675342323712"},"data": [{"accFillSz": "0","algoId": "449327675342323712","algoOrdType": "contract_grid","avgPx": "0","cTime": "1653445498664","ctVal": "0.01","fee": "0","feeCcy": "USDT","groupId": "-1","instId": "BTC-USDT-SWAP","instType": "SWAP","lever": "5","ordId": "449518234142904321","ordType": "limit","pTime": "1653486524502","pnl": "","posSide": "net","px": "28007.2","side": "buy","state": "live","sz": "1","tag":"","tdMode": "cross","uTime": "1653445498674"}]}` func TestGridSubOrdersPushData(t *testing.T) { t.Parallel() @@ -2868,7 +2868,7 @@ func TestWsAccountSubscription(t *testing.T) { } } -var placeOrderJSON = `{ "id": "1512", "op": "order", "args": [{ "instId":"BTC-USDC", "tdMode":"cash", "clOrdId":"b15", "side":"Buy", "ordType":"limit", "px":"2.15", "sz":"2"} ]}` +const placeOrderJSON = `{ "id": "1512", "op": "order", "args": [{ "instId":"BTC-USDC", "tdMode":"cash", "clOrdId":"b15", "side":"Buy", "ordType":"limit", "px":"2.15", "sz":"2"} ]}` func TestWsPlaceOrder(t *testing.T) { t.Parallel() @@ -2898,7 +2898,7 @@ func TestWsPlaceOrder(t *testing.T) { } } -var placeOrderArgs = `{ "id": "1513", "op": "batch-orders", "args": [ { "side": "buy", "instId": "BTC-USDT", "tdMode": "cash", "ordType": "market", "sz": "100" }, { "side": "buy", "instId": "LTC-USDT", "tdMode": "cash", "ordType": "market", "sz": "1" } ]}` +const placeOrderArgs = `{ "id": "1513", "op": "batch-orders", "args": [ { "side": "buy", "instId": "BTC-USDT", "tdMode": "cash", "ordType": "market", "sz": "100" }, { "side": "buy", "instId": "LTC-USDT", "tdMode": "cash", "ordType": "market", "sz": "1" } ]}` func TestWsPlaceMultipleOrder(t *testing.T) { t.Parallel() diff --git a/exchanges/okx/okx_websocket.go b/exchanges/okx/okx_websocket.go index 9217fdb3..6aeb03c7 100644 --- a/exchanges/okx/okx_websocket.go +++ b/exchanges/okx/okx_websocket.go @@ -34,9 +34,11 @@ var defaultSubscribedChannels = []string{ okxChannelCandle5m, okxChannelTickers, } -var candlestickChannelsMap = map[string]bool{okxChannelCandle1Y: true, okxChannelCandle6M: true, okxChannelCandle3M: true, okxChannelCandle1M: true, okxChannelCandle1W: true, okxChannelCandle1D: true, okxChannelCandle2D: true, okxChannelCandle3D: true, okxChannelCandle5D: true, okxChannelCandle12H: true, okxChannelCandle6H: true, okxChannelCandle4H: true, okxChannelCandle2H: true, okxChannelCandle1H: true, okxChannelCandle30m: true, okxChannelCandle15m: true, okxChannelCandle5m: true, okxChannelCandle3m: true, okxChannelCandle1m: true, okxChannelCandle1Yutc: true, okxChannelCandle3Mutc: true, okxChannelCandle1Mutc: true, okxChannelCandle1Wutc: true, okxChannelCandle1Dutc: true, okxChannelCandle2Dutc: true, okxChannelCandle3Dutc: true, okxChannelCandle5Dutc: true, okxChannelCandle12Hutc: true, okxChannelCandle6Hutc: true} -var candlesticksMarkPriceMap = map[string]bool{okxChannelMarkPriceCandle1Y: true, okxChannelMarkPriceCandle6M: true, okxChannelMarkPriceCandle3M: true, okxChannelMarkPriceCandle1M: true, okxChannelMarkPriceCandle1W: true, okxChannelMarkPriceCandle1D: true, okxChannelMarkPriceCandle2D: true, okxChannelMarkPriceCandle3D: true, okxChannelMarkPriceCandle5D: true, okxChannelMarkPriceCandle12H: true, okxChannelMarkPriceCandle6H: true, okxChannelMarkPriceCandle4H: true, okxChannelMarkPriceCandle2H: true, okxChannelMarkPriceCandle1H: true, okxChannelMarkPriceCandle30m: true, okxChannelMarkPriceCandle15m: true, okxChannelMarkPriceCandle5m: true, okxChannelMarkPriceCandle3m: true, okxChannelMarkPriceCandle1m: true, okxChannelMarkPriceCandle1Yutc: true, okxChannelMarkPriceCandle3Mutc: true, okxChannelMarkPriceCandle1Mutc: true, okxChannelMarkPriceCandle1Wutc: true, okxChannelMarkPriceCandle1Dutc: true, okxChannelMarkPriceCandle2Dutc: true, okxChannelMarkPriceCandle3Dutc: true, okxChannelMarkPriceCandle5Dutc: true, okxChannelMarkPriceCandle12Hutc: true, okxChannelMarkPriceCandle6Hutc: true} -var candlesticksIndexPriceMap = map[string]bool{okxChannelIndexCandle1Y: true, okxChannelIndexCandle6M: true, okxChannelIndexCandle3M: true, okxChannelIndexCandle1M: true, okxChannelIndexCandle1W: true, okxChannelIndexCandle1D: true, okxChannelIndexCandle2D: true, okxChannelIndexCandle3D: true, okxChannelIndexCandle5D: true, okxChannelIndexCandle12H: true, okxChannelIndexCandle6H: true, okxChannelIndexCandle4H: true, okxChannelIndexCandle2H: true, okxChannelIndexCandle1H: true, okxChannelIndexCandle30m: true, okxChannelIndexCandle15m: true, okxChannelIndexCandle5m: true, okxChannelIndexCandle3m: true, okxChannelIndexCandle1m: true, okxChannelIndexCandle1Yutc: true, okxChannelIndexCandle3Mutc: true, okxChannelIndexCandle1Mutc: true, okxChannelIndexCandle1Wutc: true, okxChannelIndexCandle1Dutc: true, okxChannelIndexCandle2Dutc: true, okxChannelIndexCandle3Dutc: true, okxChannelIndexCandle5Dutc: true, okxChannelIndexCandle12Hutc: true, okxChannelIndexCandle6Hutc: true} +var ( + candlestickChannelsMap = map[string]bool{okxChannelCandle1Y: true, okxChannelCandle6M: true, okxChannelCandle3M: true, okxChannelCandle1M: true, okxChannelCandle1W: true, okxChannelCandle1D: true, okxChannelCandle2D: true, okxChannelCandle3D: true, okxChannelCandle5D: true, okxChannelCandle12H: true, okxChannelCandle6H: true, okxChannelCandle4H: true, okxChannelCandle2H: true, okxChannelCandle1H: true, okxChannelCandle30m: true, okxChannelCandle15m: true, okxChannelCandle5m: true, okxChannelCandle3m: true, okxChannelCandle1m: true, okxChannelCandle1Yutc: true, okxChannelCandle3Mutc: true, okxChannelCandle1Mutc: true, okxChannelCandle1Wutc: true, okxChannelCandle1Dutc: true, okxChannelCandle2Dutc: true, okxChannelCandle3Dutc: true, okxChannelCandle5Dutc: true, okxChannelCandle12Hutc: true, okxChannelCandle6Hutc: true} + candlesticksMarkPriceMap = map[string]bool{okxChannelMarkPriceCandle1Y: true, okxChannelMarkPriceCandle6M: true, okxChannelMarkPriceCandle3M: true, okxChannelMarkPriceCandle1M: true, okxChannelMarkPriceCandle1W: true, okxChannelMarkPriceCandle1D: true, okxChannelMarkPriceCandle2D: true, okxChannelMarkPriceCandle3D: true, okxChannelMarkPriceCandle5D: true, okxChannelMarkPriceCandle12H: true, okxChannelMarkPriceCandle6H: true, okxChannelMarkPriceCandle4H: true, okxChannelMarkPriceCandle2H: true, okxChannelMarkPriceCandle1H: true, okxChannelMarkPriceCandle30m: true, okxChannelMarkPriceCandle15m: true, okxChannelMarkPriceCandle5m: true, okxChannelMarkPriceCandle3m: true, okxChannelMarkPriceCandle1m: true, okxChannelMarkPriceCandle1Yutc: true, okxChannelMarkPriceCandle3Mutc: true, okxChannelMarkPriceCandle1Mutc: true, okxChannelMarkPriceCandle1Wutc: true, okxChannelMarkPriceCandle1Dutc: true, okxChannelMarkPriceCandle2Dutc: true, okxChannelMarkPriceCandle3Dutc: true, okxChannelMarkPriceCandle5Dutc: true, okxChannelMarkPriceCandle12Hutc: true, okxChannelMarkPriceCandle6Hutc: true} + candlesticksIndexPriceMap = map[string]bool{okxChannelIndexCandle1Y: true, okxChannelIndexCandle6M: true, okxChannelIndexCandle3M: true, okxChannelIndexCandle1M: true, okxChannelIndexCandle1W: true, okxChannelIndexCandle1D: true, okxChannelIndexCandle2D: true, okxChannelIndexCandle3D: true, okxChannelIndexCandle5D: true, okxChannelIndexCandle12H: true, okxChannelIndexCandle6H: true, okxChannelIndexCandle4H: true, okxChannelIndexCandle2H: true, okxChannelIndexCandle1H: true, okxChannelIndexCandle30m: true, okxChannelIndexCandle15m: true, okxChannelIndexCandle5m: true, okxChannelIndexCandle3m: true, okxChannelIndexCandle1m: true, okxChannelIndexCandle1Yutc: true, okxChannelIndexCandle3Mutc: true, okxChannelIndexCandle1Mutc: true, okxChannelIndexCandle1Wutc: true, okxChannelIndexCandle1Dutc: true, okxChannelIndexCandle2Dutc: true, okxChannelIndexCandle3Dutc: true, okxChannelIndexCandle5Dutc: true, okxChannelIndexCandle12Hutc: true, okxChannelIndexCandle6Hutc: true} +) const ( // allowableIterations use the first 25 bids and asks in the full load to form a string @@ -1855,7 +1857,7 @@ func (ok *Okx) BalanceAndPositionSubscription(operation, uid string) error { } // WsOrderChannel for subscribing for orders. -func (ok *Okx) WsOrderChannel(operation string, assetType asset.Item, pair currency.Pair, instrumentID string) error { +func (ok *Okx) WsOrderChannel(operation string, assetType asset.Item, pair currency.Pair, _ string) error { return ok.wsAuthChannelSubscription(operation, okxChannelOrders, assetType, pair, "", "", wsSubscriptionParameters{InstrumentType: true, InstrumentID: true, Underlying: true}) } diff --git a/exchanges/okx/okx_wrapper.go b/exchanges/okx/okx_wrapper.go index 918ac3ad..54c9d4b8 100644 --- a/exchanges/okx/okx_wrapper.go +++ b/exchanges/okx/okx_wrapper.go @@ -268,7 +268,7 @@ func (ok *Okx) Run(ctx context.Context) { } // GetServerTime returns the current exchange server time. -func (ok *Okx) GetServerTime(ctx context.Context, ai asset.Item) (time.Time, error) { +func (ok *Okx) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error) { return ok.GetSystemTime(ctx) } @@ -1133,12 +1133,12 @@ func (ok *Okx) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest // WithdrawFiatFunds returns a withdrawal ID when a withdrawal is // submitted -func (ok *Okx) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (ok *Okx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrFunctionNotSupported } // WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted -func (ok *Okx) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (ok *Okx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, common.ErrFunctionNotSupported } diff --git a/exchanges/order/orders.go b/exchanges/order/orders.go index f7ce8d78..7644239d 100644 --- a/exchanges/order/orders.go +++ b/exchanges/order/orders.go @@ -631,7 +631,7 @@ func (t Type) Lower() string { // Title returns the type titleized, eg "Limit" func (t Type) Title() string { - return strings.Title(strings.ToLower(t.String())) //nolint:staticcheck // Ignore Title usage warning + return strings.Title(strings.ToLower(t.String())) } // String implements the stringer interface @@ -684,7 +684,7 @@ func (s Side) Lower() string { // Title returns the side titleized, eg "Buy" func (s Side) Title() string { - return strings.Title(strings.ToLower(s.String())) //nolint:staticcheck // Ignore Title usage warning + return strings.Title(strings.ToLower(s.String())) } // IsShort returns if the side is short @@ -1002,8 +1002,10 @@ func StringToOrderType(oType string) (Type, error) { return ImmediateOrCancel, nil case Stop.String(), "STOP LOSS", "STOP_LOSS", "EXCHANGE STOP": return Stop, nil - case StopLimit.String(), "EXCHANGE STOP LIMIT": + case StopLimit.String(), "EXCHANGE STOP LIMIT", "STOP_LIMIT": return StopLimit, nil + case StopMarket.String(), "STOP_MARKET": + return StopMarket, nil case TrailingStop.String(), "TRAILING STOP", "EXCHANGE TRAILING STOP": return TrailingStop, nil case FillOrKill.String(), "EXCHANGE FOK": diff --git a/exchanges/poloniex/poloniex_wrapper.go b/exchanges/poloniex/poloniex_wrapper.go index 4aed5398..1a1bae5d 100644 --- a/exchanges/poloniex/poloniex_wrapper.go +++ b/exchanges/poloniex/poloniex_wrapper.go @@ -264,7 +264,7 @@ func (p *Poloniex) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (p *Poloniex) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (p *Poloniex) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { resp, err := p.GetTicker(ctx) if err != nil { return nil, err @@ -466,12 +466,12 @@ func (p *Poloniex) FetchAccountInfo(ctx context.Context, assetType asset.Item) ( // GetFundingHistory returns funding history, deposits and // withdrawals -func (p *Poloniex) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (p *Poloniex) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (p *Poloniex) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (p *Poloniex) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -618,7 +618,7 @@ func (p *Poloniex) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (p *Poloniex) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (p *Poloniex) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -646,7 +646,7 @@ func (p *Poloniex) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order. } // GetOrderInfo returns order information based on order ID -func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, _ asset.Item) (order.Detail, error) { orderInfo := order.Detail{ Exchange: p.Name, Pair: pair, diff --git a/exchanges/sharedtestvalues/customex.go b/exchanges/sharedtestvalues/customex.go index cfcc540d..2936cecc 100644 --- a/exchanges/sharedtestvalues/customex.go +++ b/exchanges/sharedtestvalues/customex.go @@ -26,12 +26,12 @@ type CustomEx struct { } // Setup is a mock method for CustomEx -func (c *CustomEx) Setup(exch *config.Exchange) error { +func (c *CustomEx) Setup(_ *config.Exchange) error { return nil } // Start is a mock method for CustomEx -func (c *CustomEx) Start(ctx context.Context, wg *sync.WaitGroup) error { +func (c *CustomEx) Start(_ context.Context, _ *sync.WaitGroup) error { return nil } @@ -54,82 +54,82 @@ func (c *CustomEx) SetEnabled(bool) { } // ValidateCredentials is a mock method for CustomEx -func (c *CustomEx) ValidateCredentials(ctx context.Context, a asset.Item) error { +func (c *CustomEx) ValidateCredentials(_ context.Context, _ asset.Item) error { return nil } // FetchTicker is a mock method for CustomEx -func (c *CustomEx) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { +func (c *CustomEx) FetchTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error) { return nil, nil } // UpdateTickers is a mock method for CustomEx -func (c *CustomEx) UpdateTickers(ctx context.Context, a asset.Item) error { +func (c *CustomEx) UpdateTickers(_ context.Context, _ asset.Item) error { return nil } // UpdateTicker is a mock method for CustomEx -func (c *CustomEx) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) { +func (c *CustomEx) UpdateTicker(_ context.Context, _ currency.Pair, _ asset.Item) (*ticker.Price, error) { return nil, nil } // FetchOrderbook is a mock method for CustomEx -func (c *CustomEx) FetchOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error) { +func (c *CustomEx) FetchOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error) { return nil, nil } // UpdateOrderbook is a mock method for CustomEx -func (c *CustomEx) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error) { +func (c *CustomEx) UpdateOrderbook(_ context.Context, _ currency.Pair, _ asset.Item) (*orderbook.Base, error) { return nil, nil } // FetchTradablePairs is a mock method for CustomEx -func (c *CustomEx) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (c *CustomEx) FetchTradablePairs(_ context.Context, _ asset.Item) (currency.Pairs, error) { return nil, nil } // UpdateTradablePairs is a mock method for CustomEx -func (c *CustomEx) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error { +func (c *CustomEx) UpdateTradablePairs(_ context.Context, _ bool) error { return nil } // GetEnabledPairs is a mock method for CustomEx -func (c *CustomEx) GetEnabledPairs(a asset.Item) (currency.Pairs, error) { +func (c *CustomEx) GetEnabledPairs(_ asset.Item) (currency.Pairs, error) { return nil, nil } // GetAvailablePairs is a mock method for CustomEx -func (c *CustomEx) GetAvailablePairs(a asset.Item) (currency.Pairs, error) { +func (c *CustomEx) GetAvailablePairs(_ asset.Item) (currency.Pairs, error) { return nil, nil } // FetchAccountInfo is a mock method for CustomEx -func (c *CustomEx) FetchAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error) { +func (c *CustomEx) FetchAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error) { return account.Holdings{}, nil } // UpdateAccountInfo is a mock method for CustomEx -func (c *CustomEx) UpdateAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error) { +func (c *CustomEx) UpdateAccountInfo(_ context.Context, _ asset.Item) (account.Holdings, error) { return account.Holdings{}, nil } // SetPairs is a mock method for CustomEx -func (c *CustomEx) SetPairs(pairs currency.Pairs, a asset.Item, enabled bool) error { +func (c *CustomEx) SetPairs(_ currency.Pairs, _ asset.Item, _ bool) error { return nil } // GetAssetTypes is a mock method for CustomEx -func (c *CustomEx) GetAssetTypes(enabled bool) asset.Items { +func (c *CustomEx) GetAssetTypes(_ bool) asset.Items { return nil } // GetRecentTrades is a mock method for CustomEx -func (c *CustomEx) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.Item) ([]trade.Data, error) { +func (c *CustomEx) GetRecentTrades(_ context.Context, _ currency.Pair, _ asset.Item) ([]trade.Data, error) { return nil, nil } // GetHistoricTrades is a mock method for CustomEx -func (c *CustomEx) GetHistoricTrades(ctx context.Context, p currency.Pair, a asset.Item, startTime, endTime time.Time) ([]trade.Data, error) { +func (c *CustomEx) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error) { return nil, nil } @@ -144,7 +144,7 @@ func (c *CustomEx) SupportsRESTTickerBatchUpdates() bool { } // GetFeeByType is a mock method for CustomEx -func (c *CustomEx) GetFeeByType(ctx context.Context, f *exchange.FeeBuilder) (float64, error) { +func (c *CustomEx) GetFeeByType(_ context.Context, _ *exchange.FeeBuilder) (float64, error) { return 0.0, nil } @@ -164,17 +164,17 @@ func (c *CustomEx) FormatWithdrawPermissions() string { } // SupportsWithdrawPermissions is a mock method for CustomEx -func (c *CustomEx) SupportsWithdrawPermissions(permissions uint32) bool { +func (c *CustomEx) SupportsWithdrawPermissions(_ uint32) bool { return false } // GetFundingHistory is a mock method for CustomEx -func (c *CustomEx) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (c *CustomEx) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, nil } // SubmitOrder is a mock method for CustomEx -func (c *CustomEx) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error) { +func (c *CustomEx) SubmitOrder(_ context.Context, _ *order.Submit) (*order.SubmitResponse, error) { return nil, nil } @@ -184,62 +184,62 @@ func (c *CustomEx) ModifyOrder(_ context.Context, _ *order.Modify) (*order.Modif } // CancelOrder is a mock method for CustomEx -func (c *CustomEx) CancelOrder(ctx context.Context, o *order.Cancel) error { +func (c *CustomEx) CancelOrder(_ context.Context, _ *order.Cancel) error { return nil } // CancelBatchOrders is a mock method for CustomEx -func (c *CustomEx) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (c *CustomEx) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, nil } // CancelAllOrders is a mock method for CustomEx -func (c *CustomEx) CancelAllOrders(ctx context.Context, orders *order.Cancel) (order.CancelAllResponse, error) { +func (c *CustomEx) CancelAllOrders(_ context.Context, _ *order.Cancel) (order.CancelAllResponse, error) { return order.CancelAllResponse{}, nil } // GetOrderInfo is a mock method for CustomEx -func (c *CustomEx) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (c *CustomEx) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { return order.Detail{}, nil } // GetDepositAddress is a mock method for CustomEx -func (c *CustomEx) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, accountID, chain string) (*deposit.Address, error) { +func (c *CustomEx) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error) { return nil, nil } // GetOrderHistory is a mock method for CustomEx -func (c *CustomEx) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) (order.FilteredOrders, error) { +func (c *CustomEx) GetOrderHistory(_ context.Context, _ *order.GetOrdersRequest) (order.FilteredOrders, error) { return nil, nil } // GetWithdrawalsHistory is a mock method for CustomEx -func (c *CustomEx) GetWithdrawalsHistory(ctx context.Context, code currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error) { +func (c *CustomEx) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error) { return []exchange.WithdrawalHistory{}, nil } // GetActiveOrders is a mock method for CustomEx -func (c *CustomEx) GetActiveOrders(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) (order.FilteredOrders, error) { +func (c *CustomEx) GetActiveOrders(_ context.Context, _ *order.GetOrdersRequest) (order.FilteredOrders, error) { return []order.Detail{}, nil } // WithdrawCryptocurrencyFunds is a mock method for CustomEx -func (c *CustomEx) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (c *CustomEx) WithdrawCryptocurrencyFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, nil } // WithdrawFiatFunds is a mock method for CustomEx -func (c *CustomEx) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (c *CustomEx) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, nil } // WithdrawFiatFundsToInternationalBank is a mock method for CustomEx -func (c *CustomEx) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) { +func (c *CustomEx) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error) { return nil, nil } // SetHTTPClientUserAgent is a mock method for CustomEx -func (c *CustomEx) SetHTTPClientUserAgent(ua string) error { +func (c *CustomEx) SetHTTPClientUserAgent(_ string) error { return nil } @@ -249,7 +249,7 @@ func (c *CustomEx) GetHTTPClientUserAgent() (string, error) { } // SetClientProxyAddress is a mock method for CustomEx -func (c *CustomEx) SetClientProxyAddress(addr string) error { +func (c *CustomEx) SetClientProxyAddress(_ string) error { return nil } @@ -264,7 +264,7 @@ func (c *CustomEx) GetSubscriptions() ([]stream.ChannelSubscription, error) { } // GetDefaultConfig is a mock method for CustomEx -func (c *CustomEx) GetDefaultConfig(ctx context.Context) (*config.Exchange, error) { +func (c *CustomEx) GetDefaultConfig(_ context.Context) (*config.Exchange, error) { return nil, nil } @@ -274,17 +274,17 @@ func (c *CustomEx) GetBase() *exchange.Base { } // SupportsAsset is a mock method for CustomEx -func (c *CustomEx) SupportsAsset(assetType asset.Item) bool { +func (c *CustomEx) SupportsAsset(_ asset.Item) bool { return false } // GetHistoricCandles is a mock method for CustomEx -func (c *CustomEx) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, timeEnd time.Time) (*kline.Item, error) { +func (c *CustomEx) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) { return &kline.Item{}, nil } // GetHistoricCandlesExtended is a mock method for CustomEx -func (c *CustomEx) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, interval kline.Interval, timeStart, timeEnd time.Time) (*kline.Item, error) { +func (c *CustomEx) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) { return &kline.Item{}, nil } @@ -314,17 +314,17 @@ func (c *CustomEx) SupportsWebsocket() bool { } // SubscribeToWebsocketChannels is a mock method for CustomEx -func (c *CustomEx) SubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error { +func (c *CustomEx) SubscribeToWebsocketChannels(_ []stream.ChannelSubscription) error { return nil } // UnsubscribeToWebsocketChannels is a mock method for CustomEx -func (c *CustomEx) UnsubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error { +func (c *CustomEx) UnsubscribeToWebsocketChannels(_ []stream.ChannelSubscription) error { return nil } // IsAssetWebsocketSupported is a mock method for CustomEx -func (c *CustomEx) IsAssetWebsocketSupported(aType asset.Item) bool { +func (c *CustomEx) IsAssetWebsocketSupported(_ asset.Item) bool { return false } @@ -334,21 +334,21 @@ func (c *CustomEx) FlushWebsocketChannels() error { } // AuthenticateWebsocket is a mock method for CustomEx -func (c *CustomEx) AuthenticateWebsocket(ctx context.Context) error { +func (c *CustomEx) AuthenticateWebsocket(_ context.Context) error { return nil } // GetOrderExecutionLimits is a mock method for CustomEx -func (c *CustomEx) GetOrderExecutionLimits(a asset.Item, cp currency.Pair) (order.MinMaxLevel, error) { +func (c *CustomEx) GetOrderExecutionLimits(_ asset.Item, _ currency.Pair) (order.MinMaxLevel, error) { return order.MinMaxLevel{}, nil } // CheckOrderExecutionLimits is a mock method for CustomEx -func (c *CustomEx) CheckOrderExecutionLimits(a asset.Item, cp currency.Pair, price, amount float64, orderType order.Type) error { +func (c *CustomEx) CheckOrderExecutionLimits(_ asset.Item, _ currency.Pair, _, _ float64, _ order.Type) error { return nil } // UpdateOrderExecutionLimits is a mock method for CustomEx -func (c *CustomEx) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error { +func (c *CustomEx) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error { return nil } diff --git a/exchanges/stream/buffer/buffer_test.go b/exchanges/stream/buffer/buffer_test.go index 2e85531d..d69422bc 100644 --- a/exchanges/stream/buffer/buffer_test.go +++ b/exchanges/stream/buffer/buffer_test.go @@ -48,6 +48,7 @@ func createSnapshot() (holder *Orderbook, asks, bids orderbook.Items, err error) ch := make(chan interface{}) go func(<-chan interface{}) { // reader for range ch { + continue } }(ch) holder = &Orderbook{ diff --git a/exchanges/yobit/yobit_wrapper.go b/exchanges/yobit/yobit_wrapper.go index 3c6091fc..a0d1f893 100644 --- a/exchanges/yobit/yobit_wrapper.go +++ b/exchanges/yobit/yobit_wrapper.go @@ -158,7 +158,7 @@ func (y *Yobit) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (y *Yobit) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (y *Yobit) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { info, err := y.GetInfo(ctx) if err != nil { return nil, err @@ -355,12 +355,12 @@ func (y *Yobit) FetchAccountInfo(ctx context.Context, assetType asset.Item) (acc // GetFundingHistory returns funding history, deposits and // withdrawals -func (y *Yobit) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (y *Yobit) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (y *Yobit) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (y *Yobit) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -459,7 +459,7 @@ func (y *Yobit) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (y *Yobit) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (y *Yobit) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -507,7 +507,7 @@ func (y *Yobit) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Can } // GetOrderInfo returns order information based on order ID -func (y *Yobit) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (y *Yobit) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } @@ -697,12 +697,12 @@ func (y *Yobit) ValidateCredentials(ctx context.Context, assetType asset.Item) e } // GetHistoricCandles returns candles between a time period for a set time interval -func (y *Yobit) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error) { +func (y *Yobit) GetHistoricCandles(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) { return nil, common.ErrFunctionNotSupported } // GetHistoricCandlesExtended returns candles between a time period for a set time interval -func (y *Yobit) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error) { +func (y *Yobit) GetHistoricCandlesExtended(_ context.Context, _ currency.Pair, _ asset.Item, _ kline.Interval, _, _ time.Time) (*kline.Item, error) { return nil, common.ErrFunctionNotSupported } diff --git a/exchanges/zb/zb_test.go b/exchanges/zb/zb_test.go index ccbe18ae..523eea8f 100644 --- a/exchanges/zb/zb_test.go +++ b/exchanges/zb/zb_test.go @@ -37,6 +37,7 @@ func areTestAPIKeysSet() bool { return z.ValidateAPICredentials(z.GetDefaultCredentials()) == nil } +//nolint:gocritic // Only used as a testing helper function in this package func setupWsAuth(t *testing.T) { t.Helper() if wsSetupRan { diff --git a/exchanges/zb/zb_wrapper.go b/exchanges/zb/zb_wrapper.go index e1fb6740..6b1443c2 100644 --- a/exchanges/zb/zb_wrapper.go +++ b/exchanges/zb/zb_wrapper.go @@ -227,7 +227,7 @@ func (z *ZB) Run(ctx context.Context) { } // FetchTradablePairs returns a list of the exchanges tradable pairs -func (z *ZB) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) { +func (z *ZB) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) { markets, err := z.GetMarkets(ctx) if err != nil { return nil, err @@ -431,12 +431,12 @@ func (z *ZB) FetchAccountInfo(ctx context.Context, assetType asset.Item) (accoun // GetFundingHistory returns funding history, deposits and // withdrawals -func (z *ZB) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) { +func (z *ZB) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error) { return nil, common.ErrFunctionNotSupported } // GetWithdrawalsHistory returns previous withdrawals data -func (z *ZB) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) (resp []exchange.WithdrawalHistory, err error) { +func (z *ZB) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) (resp []exchange.WithdrawalHistory, err error) { return nil, common.ErrNotYetImplemented } @@ -567,7 +567,7 @@ func (z *ZB) CancelOrder(ctx context.Context, o *order.Cancel) error { } // CancelBatchOrders cancels an orders by their corresponding ID numbers -func (z *ZB) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) { +func (z *ZB) CancelBatchOrders(_ context.Context, _ []order.Cancel) (order.CancelBatchResponse, error) { return order.CancelBatchResponse{}, common.ErrNotYetImplemented } @@ -630,7 +630,7 @@ func (z *ZB) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.Cancel } // GetOrderInfo returns order information based on order ID -func (z *ZB) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) { +func (z *ZB) GetOrderInfo(_ context.Context, _ string, _ currency.Pair, _ asset.Item) (order.Detail, error) { var orderDetail order.Detail return orderDetail, common.ErrNotYetImplemented } diff --git a/gctrpc/auth/auth.go b/gctrpc/auth/auth.go index e8076222..cfabaaaa 100644 --- a/gctrpc/auth/auth.go +++ b/gctrpc/auth/auth.go @@ -12,7 +12,7 @@ type BasicAuth struct { } // GetRequestMetadata is a implementation of the GetRequestMetadata function -func (b BasicAuth) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) { +func (b BasicAuth) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error) { auth := b.Username + ":" + b.Password enc := base64.StdEncoding.EncodeToString([]byte(auth)) return map[string]string{ diff --git a/gctscript/wrappers/validator/validator.go b/gctscript/wrappers/validator/validator.go index 5a89edf9..94b58912 100644 --- a/gctscript/wrappers/validator/validator.go +++ b/gctscript/wrappers/validator/validator.go @@ -46,7 +46,7 @@ func (w Wrapper) IsEnabled(exch string) (v bool) { } // Orderbook validator for test execution/scripts -func (w Wrapper) Orderbook(ctx context.Context, exch string, pair currency.Pair, item asset.Item) (*orderbook.Base, error) { +func (w Wrapper) Orderbook(_ context.Context, exch string, pair currency.Pair, item asset.Item) (*orderbook.Base, error) { if exch == exchError.String() { return nil, errTestFailed } @@ -71,7 +71,7 @@ func (w Wrapper) Orderbook(ctx context.Context, exch string, pair currency.Pair, } // Ticker validator for test execution/scripts -func (w Wrapper) Ticker(ctx context.Context, exch string, pair currency.Pair, item asset.Item) (*ticker.Price, error) { +func (w Wrapper) Ticker(_ context.Context, exch string, pair currency.Pair, item asset.Item) (*ticker.Price, error) { if exch == exchError.String() { return nil, errTestFailed } @@ -109,7 +109,7 @@ func (w Wrapper) Pairs(exch string, _ bool, _ asset.Item) (*currency.Pairs, erro } // QueryOrder validator for test execution/scripts -func (w Wrapper) QueryOrder(ctx context.Context, exch, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error) { +func (w Wrapper) QueryOrder(_ context.Context, exch, _ string, _ currency.Pair, _ asset.Item) (*order.Detail, error) { if exch == exchError.String() { return nil, errTestFailed } @@ -149,7 +149,7 @@ func (w Wrapper) QueryOrder(ctx context.Context, exch, _ string, _ currency.Pair } // SubmitOrder validator for test execution/scripts -func (w Wrapper) SubmitOrder(ctx context.Context, o *order.Submit) (*order.SubmitResponse, error) { +func (w Wrapper) SubmitOrder(_ context.Context, o *order.Submit) (*order.SubmitResponse, error) { if o == nil { return nil, errTestFailed } @@ -171,7 +171,7 @@ func (w Wrapper) SubmitOrder(ctx context.Context, o *order.Submit) (*order.Submi } // CancelOrder validator for test execution/scripts -func (w Wrapper) CancelOrder(ctx context.Context, exch, orderid string, cp currency.Pair, a asset.Item) (bool, error) { +func (w Wrapper) CancelOrder(_ context.Context, exch, orderid string, cp currency.Pair, a asset.Item) (bool, error) { if exch == exchError.String() { return false, errTestFailed } @@ -188,7 +188,7 @@ func (w Wrapper) CancelOrder(ctx context.Context, exch, orderid string, cp curre } // AccountInformation validator for test execution/scripts -func (w Wrapper) AccountInformation(ctx context.Context, exch string, assetType asset.Item) (account.Holdings, error) { +func (w Wrapper) AccountInformation(_ context.Context, exch string, assetType asset.Item) (account.Holdings, error) { if exch == exchError.String() { return account.Holdings{}, errTestFailed } @@ -220,7 +220,7 @@ func (w Wrapper) AccountInformation(ctx context.Context, exch string, assetType } // DepositAddress validator for test execution/scripts -func (w Wrapper) DepositAddress(exch, chain string, _ currency.Code) (*deposit.Address, error) { +func (w Wrapper) DepositAddress(exch, _ string, _ currency.Code) (*deposit.Address, error) { if exch == exchError.String() { return nil, errTestFailed } @@ -229,7 +229,7 @@ func (w Wrapper) DepositAddress(exch, chain string, _ currency.Code) (*deposit.A } // WithdrawalCryptoFunds validator for test execution/scripts -func (w Wrapper) WithdrawalCryptoFunds(ctx context.Context, r *withdraw.Request) (out string, err error) { +func (w Wrapper) WithdrawalCryptoFunds(_ context.Context, r *withdraw.Request) (out string, err error) { if r.Exchange == exchError.String() { return r.Exchange, errTestFailed } @@ -238,7 +238,7 @@ func (w Wrapper) WithdrawalCryptoFunds(ctx context.Context, r *withdraw.Request) } // WithdrawalFiatFunds validator for test execution/scripts -func (w Wrapper) WithdrawalFiatFunds(ctx context.Context, _ string, r *withdraw.Request) (out string, err error) { +func (w Wrapper) WithdrawalFiatFunds(_ context.Context, _ string, r *withdraw.Request) (out string, err error) { if r.Exchange == exchError.String() { return r.Exchange, errTestFailed } @@ -247,7 +247,7 @@ func (w Wrapper) WithdrawalFiatFunds(ctx context.Context, _ string, r *withdraw. } // OHLCV returns open high low close volume candles for requested exchange/pair/asset/start & end time -func (w Wrapper) OHLCV(ctx context.Context, exch string, p currency.Pair, a asset.Item, start, end time.Time, i kline.Interval) (*kline.Item, error) { +func (w Wrapper) OHLCV(_ context.Context, exch string, p currency.Pair, a asset.Item, start, _ time.Time, i kline.Interval) (*kline.Item, error) { if exch == exchError.String() { return nil, errTestFailed } diff --git a/log/logger_test.go b/log/logger_test.go index 3a87c750..8d789f4f 100644 --- a/log/logger_test.go +++ b/log/logger_test.go @@ -180,13 +180,13 @@ func TestAddWriter(t *testing.T) { type WriteShorter struct{} -func (w *WriteShorter) Write(p []byte) (int, error) { +func (w *WriteShorter) Write(_ []byte) (int, error) { return 1, nil } type WriteError struct{} -func (w *WriteError) Write(p []byte) (int, error) { +func (w *WriteError) Write(_ []byte) (int, error) { return 0, errWriteError }