mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
Migrate from gometalinter.v2 to golangci-lint (#249)
* Migrate from gometalinter.v2 to golangci-lint
This commit is contained in:
@@ -939,8 +939,7 @@ func (b *Bitmex) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
var fee float64
|
||||
var err error
|
||||
|
||||
switch feeBuilder.FeeType {
|
||||
case exchange.CryptocurrencyTradeFee:
|
||||
if feeBuilder.FeeType == exchange.CryptocurrencyTradeFee {
|
||||
fee = calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount, feeBuilder.IsMaker)
|
||||
}
|
||||
if fee < 0 {
|
||||
@@ -950,7 +949,7 @@ func (b *Bitmex) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
}
|
||||
|
||||
// calculateTradingFee returns the fee for trading any currency on Bittrex
|
||||
func calculateTradingFee(purchasePrice float64, amount float64, isMaker bool) float64 {
|
||||
func calculateTradingFee(purchasePrice, amount float64, isMaker bool) float64 {
|
||||
var fee = 0.000750
|
||||
|
||||
if isMaker {
|
||||
|
||||
@@ -86,7 +86,7 @@ func StructValsToURLVals(v interface{}) (url.Values, error) {
|
||||
|
||||
// APIKeyParams contains all the parameters to send to the API endpoint
|
||||
type APIKeyParams struct {
|
||||
//API Key ID (public component).
|
||||
// API Key ID (public component).
|
||||
APIKeyID string `json:"apiKeyID,omitempty"`
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ type ChatSendParams struct {
|
||||
// VerifyData verifies outgoing data sets
|
||||
func (p ChatSendParams) VerifyData() error {
|
||||
if p.ChannelID == 0 || p.Message == "" {
|
||||
return errors.New("ChatSendParams error params not correctly set")
|
||||
return errors.New("chatSendParams error params not correctly set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -287,7 +287,7 @@ type OrderNewParams struct {
|
||||
// are specified.
|
||||
OrdType string `json:"ordType,omitempty"`
|
||||
|
||||
//OrderQty Order quantity in units of the instrument (i.e. contracts).
|
||||
// OrderQty Order quantity in units of the instrument (i.e. contracts).
|
||||
OrderQty float64 `json:"orderQty,omitempty"`
|
||||
|
||||
// PegOffsetValue - [Optional] trailing offset from the current price for
|
||||
|
||||
@@ -206,17 +206,18 @@ func (b *Bitmex) wsHandleIncomingData() {
|
||||
if decodedResp.Success {
|
||||
if b.Verbose {
|
||||
if len(quickCapture) == 3 {
|
||||
log.Debugf("Bitmex Websocket: Successfully subscribed to %s",
|
||||
decodedResp.Subscribe)
|
||||
log.Debugf("%s websocket: Successfully subscribed to %s",
|
||||
b.Name, decodedResp.Subscribe)
|
||||
} else {
|
||||
log.Debugf("Bitmex Websocket: Successfully authenticated websocket connection")
|
||||
log.Debugf("%s websocket: Successfully authenticated websocket connection",
|
||||
b.Name)
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
b.Websocket.DataHandler <- fmt.Errorf("Bitmex websocket error: Unable to subscribe %s",
|
||||
decodedResp.Subscribe)
|
||||
b.Websocket.DataHandler <- fmt.Errorf("%s websocket error: Unable to subscribe %s",
|
||||
b.Name, decodedResp.Subscribe)
|
||||
|
||||
} else if _, ok := quickCapture["table"]; ok {
|
||||
var decodedResp WebsocketMainResponse
|
||||
@@ -291,8 +292,8 @@ func (b *Bitmex) wsHandleIncomingData() {
|
||||
b.Websocket.DataHandler <- announcement.Data
|
||||
|
||||
default:
|
||||
b.Websocket.DataHandler <- fmt.Errorf("Bitmex websocket error: Table unknown - %s",
|
||||
decodedResp.Table)
|
||||
b.Websocket.DataHandler <- fmt.Errorf("%s websocket error: Table unknown - %s",
|
||||
b.Name, decodedResp.Table)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,15 +412,11 @@ func (b *Bitmex) websocketSubscribe() error {
|
||||
subscriber.Arguments = append(subscriber.Arguments, bitmexWSAnnouncement)
|
||||
|
||||
for _, contract := range contracts {
|
||||
// Orderbook subscribe
|
||||
subscriber.Arguments = append(subscriber.Arguments,
|
||||
bitmexWSOrderbookL2+":"+contract.Pair().String())
|
||||
|
||||
// Trade subscribe
|
||||
subscriber.Arguments = append(subscriber.Arguments,
|
||||
bitmexWSTrade+":"+contract.Pair().String())
|
||||
|
||||
// Orderbook and Trade subscribe
|
||||
// NOTE more added here in future
|
||||
subscriber.Arguments = append(subscriber.Arguments,
|
||||
bitmexWSOrderbookL2+":"+contract.Pair().String(),
|
||||
bitmexWSTrade+":"+contract.Pair().String())
|
||||
}
|
||||
|
||||
return b.WebsocketConn.WriteJSON(subscriber)
|
||||
@@ -432,14 +429,11 @@ func (b *Bitmex) websocketSendAuth() error {
|
||||
hmac := common.GetHMAC(common.HashSHA256,
|
||||
[]byte("GET/realtime"+newTimestamp),
|
||||
[]byte(b.APISecret))
|
||||
|
||||
signature := common.HexEncodeToString(hmac)
|
||||
|
||||
var sendAuth WebsocketRequest
|
||||
sendAuth.Command = "authKeyExpires"
|
||||
sendAuth.Arguments = append(sendAuth.Arguments, b.APIKey)
|
||||
sendAuth.Arguments = append(sendAuth.Arguments, timestamp)
|
||||
sendAuth.Arguments = append(sendAuth.Arguments, signature)
|
||||
|
||||
sendAuth.Arguments = append(sendAuth.Arguments, b.APIKey, timestamp,
|
||||
signature)
|
||||
return b.WebsocketConn.WriteJSON(sendAuth)
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package bitmex
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -63,7 +64,7 @@ func (b *Bitmex) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Pri
|
||||
}
|
||||
|
||||
if len(tick) == 0 {
|
||||
return tickerPrice, errors.New("Bitmex REST error: no ticker return")
|
||||
return tickerPrice, fmt.Errorf("%s REST error: no ticker return", b.Name)
|
||||
}
|
||||
|
||||
tickerPrice.Pair = p
|
||||
@@ -153,9 +154,7 @@ func (b *Bitmex) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
// GetFundingHistory returns funding history, deposits and
|
||||
// withdrawals
|
||||
func (b *Bitmex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
var fundHistory []exchange.FundHistory
|
||||
// b.GetFullFundingHistory()
|
||||
return fundHistory, common.ErrNotYetImplemented
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
|
||||
Reference in New Issue
Block a user