GCTCLI: Destination var/arg check usage fixes (#421)

* GCTCLI param and linter fixes

* Linter fixes

* Add more basic validation and address codelingo nits

* Add arg number support to cancelOrder and more validity checks
This commit is contained in:
Adrian Gallagher
2020-01-29 16:27:06 +11:00
committed by GitHub
parent 5ac5ec8fc1
commit 01e2ab1499
28 changed files with 182 additions and 95 deletions

View File

@@ -72,7 +72,7 @@ type Binance struct {
validIntervals []TimeInterval
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Binance) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -91,7 +91,7 @@ type Bitfinex struct {
WebsocketSubdChannels map[int]WebsocketChanInfo
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bitfinex) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -71,7 +71,7 @@ type Bitflyer struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bitflyer) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -56,7 +56,7 @@ type Bithumb struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bithumb) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -910,7 +910,7 @@ func calculateTradingFee(purchasePrice, amount float64, isMaker bool) float64 {
return fee * purchasePrice * amount
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bitmex) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -64,7 +64,7 @@ type Bitstamp struct {
WebsocketConn *wshandler.WebsocketConnection
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bitstamp) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -63,7 +63,7 @@ type Bittrex struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *Bittrex) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -82,7 +82,7 @@ type BTCMarkets struct {
WebsocketConn *wshandler.WebsocketConnection
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *BTCMarkets) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -326,7 +326,7 @@ func parseOrderTime(timeStr string) (time.Time, error) {
return time.Parse(btseTimeLayout, timeStr)
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (b *BTSE) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -1074,7 +1074,7 @@ func (c *Coinbene) SendAuthHTTPRequest(method, path, epPath string, isSwap bool,
return json.Unmarshal(resp, result)
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (c *Coinbene) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -56,7 +56,7 @@ type COINUT struct {
instrumentMap instrumentMap
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (c *COINUT) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -49,7 +49,7 @@ type EXMO struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (e *EXMO) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -48,8 +48,7 @@ type Gateio struct {
exchange.Base
}
// GetHistoriCandles
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (g *Gateio) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -446,7 +446,7 @@ func calculateTradingFee(notionVolume *NotionalVolume, purchasePrice, amount flo
return volumeFee * amount * purchasePrice
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (g *Gemini) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -51,7 +51,7 @@ type HitBTC struct {
WebsocketConn *wshandler.WebsocketConnection
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (h *HitBTC) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -70,7 +70,7 @@ type HUOBI struct {
AuthenticatedWebsocketConn *wshandler.WebsocketConnection
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (h *HUOBI) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -40,7 +40,7 @@ type ItBit struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (i *ItBit) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -64,7 +64,7 @@ type Kraken struct {
wsRequestMtx sync.Mutex
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (k *Kraken) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -41,7 +41,7 @@ type LakeBTC struct {
WebsocketConn
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (l *LakeBTC) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -581,7 +581,7 @@ func (l *Lbank) SendAuthHTTPRequest(method, endpoint string, vals url.Values, re
l.HTTPRecording)
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (l *Lbank) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -113,7 +113,7 @@ type LocalBitcoins struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (l *LocalBitcoins) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -22,7 +22,7 @@ type OKCoin struct {
okgroup.OKGroup
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (o *OKCoin) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -47,7 +47,7 @@ type OKEX struct {
okgroup.OKGroup
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (o *OKEX) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrFunctionNotSupported
}

View File

@@ -60,7 +60,7 @@ type Poloniex struct {
WebsocketConn *wshandler.WebsocketConnection
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (p *Poloniex) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -11,15 +11,17 @@ const (
ErrStrAmountMustBeGreaterThanZero = "amount must be greater than 0"
// ErrStrAddressisInvalid message to return when address is invalid for crypto request
ErrStrAddressisInvalid = "address is not valid"
// ErrStrAddressNotSet message to returh when address is empty
// ErrStrAddressNotSet message to return when address is empty
ErrStrAddressNotSet = "address cannot be empty"
// ErrStrNoCurrencySet message to return when no currency is set
ErrStrNoCurrencySet = "currency not set"
)
var (
// ErrRequestCannotBeNil message to return when a request is nil
ErrRequestCannotBeNil = errors.New("request cannot be nil")
ErrInvalidRequest = errors.New("invalid request type")
// ErrInvalidRequest message to return when a request is invalid
ErrInvalidRequest = errors.New("invalid request type")
)
// GenericInfo stores genric withdraw request info

View File

@@ -43,7 +43,7 @@ type Yobit struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (y *Yobit) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}

View File

@@ -48,7 +48,7 @@ type ZB struct {
exchange.Base
}
// GetHistoriCandles returns _rangesize_ number of candles for the given _granularity_ and _pair_ starting from the latest available
// GetHistoricCandles returns rangesize number of candles for the given granularity and pair starting from the latest available
func (z *ZB) GetHistoricCandles(pair currency.Pair, rangesize, granularity int64) ([]exchange.Candle, error) {
return nil, common.ErrNotYetImplemented
}