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

@@ -894,15 +894,18 @@ func addPortfolioAddress(c *cli.Context) error {
}
if c.IsSet("description") {
description = c.String("asset")
description = c.String("description")
} else {
description = c.Args().Get(2)
}
if c.IsSet("balance") {
balance = c.Float64("balance")
} else {
balance, _ = strconv.ParseFloat(c.Args().Get(3), 64)
} else if c.Args().Get(3) != "" {
balance, err = strconv.ParseFloat(c.Args().Get(3), 64)
if err != nil {
return err
}
}
client := gctrpc.NewGoCryptoTraderClient(conn)
@@ -973,7 +976,7 @@ func removePortfolioAddress(c *cli.Context) error {
}
if c.IsSet("description") {
description = c.String("asset")
description = c.String("description")
} else {
description = c.Args().Get(2)
}
@@ -1044,7 +1047,7 @@ func getForexRates(_ *cli.Context) error {
var getOrdersCommand = cli.Command{
Name: "getorders",
Usage: "gets the open orders",
ArgsUsage: "<exchange> <asset_type> <pair>",
ArgsUsage: "<exchange> <asset> <pair>",
Action: getOrders,
Flags: []cli.Flag{
cli.StringFlag{
@@ -1052,7 +1055,7 @@ var getOrdersCommand = cli.Command{
Usage: "the exchange to get orders for",
},
cli.StringFlag{
Name: "asset_type",
Name: "asset",
Usage: "the asset type to get orders for",
},
cli.StringFlag{
@@ -1077,8 +1080,8 @@ func getOrders(c *cli.Context) error {
return errInvalidExchange
}
if c.IsSet("asset_type") {
assetType = c.String("asset_type")
if c.IsSet("asset") {
assetType = c.String("asset")
} else {
assetType = c.Args().Get(1)
}
@@ -1187,7 +1190,7 @@ func getOrder(c *cli.Context) error {
var submitOrderCommand = cli.Command{
Name: "submitorder",
Usage: "submit order submits an exchange order",
ArgsUsage: "<exchange> <pair> <side> <order_type> <amount> <price> <client_id>",
ArgsUsage: "<exchange> <pair> <side> <type> <amount> <price> <client_id>",
Action: submitOrder,
Flags: []cli.Flag{
cli.StringFlag{
@@ -1203,7 +1206,7 @@ var submitOrderCommand = cli.Command{
Usage: "the order side to use (BUY OR SELL)",
},
cli.StringFlag{
Name: "order_type",
Name: "type",
Usage: "the order type (MARKET OR LIMIT)",
},
cli.Float64Flag{
@@ -1261,22 +1264,43 @@ func submitOrder(c *cli.Context) error {
orderSide = c.Args().Get(2)
}
if c.IsSet("order_type") {
orderType = c.String("order_type")
if orderSide == "" {
return errors.New("order side must be set")
}
if c.IsSet("type") {
orderType = c.String("type")
} else {
orderType = c.Args().Get(3)
}
if c.IsSet("amount") {
amount = c.Float64("amount")
} else {
amount, _ = strconv.ParseFloat(c.Args().Get(4), 64)
if orderType == "" {
return errors.New("order type must be set")
}
if c.IsSet("amount") {
amount = c.Float64("amount")
} else if c.Args().Get(4) != "" {
var err error
amount, err = strconv.ParseFloat(c.Args().Get(4), 64)
if err != nil {
return err
}
}
if amount == 0 {
return errors.New("amount must be set")
}
// price is optional for market orders
if c.IsSet("price") {
price = c.Float64("price")
} else {
price, _ = strconv.ParseFloat(c.Args().Get(5), 64)
} else if c.Args().Get(5) != "" {
var err error
price, err = strconv.ParseFloat(c.Args().Get(5), 64)
if err != nil {
return err
}
}
if c.IsSet("client_id") {
@@ -1376,10 +1400,22 @@ func simulateOrder(c *cli.Context) error {
orderSide = c.Args().Get(2)
}
if orderSide == "" {
return errors.New("side must be set")
}
if c.IsSet("amount") {
amount = c.Float64("amount")
} else {
amount, _ = strconv.ParseFloat(c.Args().Get(3), 64)
} else if c.Args().Get(3) != "" {
var err error
amount, err = strconv.ParseFloat(c.Args().Get(3), 64)
if err != nil {
return err
}
}
if amount == 0 {
return errors.New("amount must be set")
}
conn, err := setupClient()
@@ -1470,10 +1506,18 @@ func whaleBomb(c *cli.Context) error {
orderSide = c.Args().Get(2)
}
if orderSide == "" {
return errors.New("order side must be set")
}
if c.IsSet("price") {
price = c.Float64("price")
} else {
price, _ = strconv.ParseFloat(c.Args().Get(3), 64)
} else if c.Args().Get(3) != "" {
var err error
price, err = strconv.ParseFloat(c.Args().Get(3), 64)
if err != nil {
return err
}
}
conn, err := setupClient()
@@ -1505,7 +1549,7 @@ func whaleBomb(c *cli.Context) error {
var cancelOrderCommand = cli.Command{
Name: "cancelorder",
Usage: "cancel order cancels an exchange order",
ArgsUsage: "<exchange> <account_id> <order_id> <pair> <asset_type> <wallet_address> <side>",
ArgsUsage: "<exchange> <account_id> <order_id> <pair> <asset> <wallet_address> <side>",
Action: cancelOrder,
Flags: []cli.Flag{
cli.StringFlag{
@@ -1525,7 +1569,7 @@ var cancelOrderCommand = cli.Command{
Usage: "the currency pair to cancel the order for",
},
cli.StringFlag{
Name: "asset_type",
Name: "asset",
Usage: "the asset type",
},
cli.Float64Flag{
@@ -1563,22 +1607,32 @@ func cancelOrder(c *cli.Context) error {
return errInvalidExchange
}
if c.IsSet("account_id") {
accountID = c.String("account_id")
} else {
accountID = c.Args().Get(1)
}
if c.IsSet("order_id") {
orderID = c.String("order_id")
} else {
orderID = c.Args().Get(2)
}
if c.IsSet("account_id") {
accountID = c.String("account_id")
if orderID == "" {
return errors.New("an order ID must be set")
}
if c.IsSet("pair") {
currencyPair = c.String("pair")
} else {
currencyPair = c.Args().Get(3)
}
if c.IsSet("asset_type") {
assetType = c.String("asset_type")
if c.IsSet("asset") {
assetType = c.String("asset")
} else {
assetType = c.Args().Get(4)
}
assetType = strings.ToLower(assetType)
@@ -1588,12 +1642,17 @@ func cancelOrder(c *cli.Context) error {
if c.IsSet("wallet_address") {
walletAddress = c.String("wallet_address")
} else {
walletAddress = c.Args().Get(5)
}
if c.IsSet("order_side") {
orderSide = c.String("order_side")
if c.IsSet("side") {
orderSide = c.String("side")
} else {
orderSide = c.Args().Get(6)
}
// pair is optional, but if it's set, do a validity check
var p currency.Pair
if len(currencyPair) > 0 {
if !validPair(currencyPair) {
@@ -1702,7 +1761,7 @@ func getEvents(_ *cli.Context) error {
var addEventCommand = cli.Command{
Name: "addevent",
Usage: "adds an event",
ArgsUsage: "<exchange> <item> <condition> <price> <check_bids> <check_bids_and_asks> <orderbook_amount> <pair> <asset_type> <action>",
ArgsUsage: "<exchange> <item> <condition> <price> <check_bids> <check_bids_and_asks> <orderbook_amount> <pair> <asset> <action>",
Action: addEvent,
Flags: []cli.Flag{
cli.StringFlag{
@@ -1738,7 +1797,7 @@ var addEventCommand = cli.Command{
Usage: "the currency pair",
},
cli.StringFlag{
Name: "asset_type",
Name: "asset",
Usage: "the asset type",
},
cli.StringFlag{
@@ -1771,6 +1830,10 @@ func addEvent(c *cli.Context) error {
return fmt.Errorf("exchange name is required")
}
if !validExchange(exchangeName) {
return errInvalidExchange
}
if c.IsSet("item") {
item = c.String("item")
} else {
@@ -1805,8 +1868,12 @@ func addEvent(c *cli.Context) error {
return fmt.Errorf("currency pair is required")
}
if c.IsSet("asset_type") {
assetType = c.String("asset_type")
if !validPair(currencyPair) {
return errInvalidPair
}
if c.IsSet("asset") {
assetType = c.String("asset")
}
assetType = strings.ToLower(assetType)
@@ -1820,10 +1887,6 @@ func addEvent(c *cli.Context) error {
return fmt.Errorf("action is required")
}
if !validPair(currencyPair) {
return errInvalidPair
}
conn, err := setupClient()
if err != nil {
return err
@@ -1880,12 +1943,16 @@ func removeEvent(c *cli.Context) error {
var eventID int64
if c.IsSet("event_id") {
eventID = c.Int64("event_id")
} else {
evtID, err := strconv.Atoi(c.Args().Get(0))
} else if c.Args().Get(0) != "" {
var err error
eventID, err = strconv.ParseInt(c.Args().Get(0), 10, 64)
if err != nil {
return fmt.Errorf("unable to strconv input to int. Err: %s", err)
return err
}
eventID = int64(evtID)
}
if eventID == 0 {
return errors.New("event id must be specified")
}
conn, err := setupClient()
@@ -1990,10 +2057,14 @@ func getCryptocurrencyDepositAddress(c *cli.Context) error {
if c.IsSet("cryptocurrency") {
cryptocurrency = c.String("cryptocurrency")
} else {
} else if c.Args().Get(1) != "" {
cryptocurrency = c.Args().Get(1)
}
if cryptocurrency == "" {
return errors.New("cryptocurrency must be set")
}
conn, err := setupClient()
if err != nil {
return err
@@ -2083,6 +2154,10 @@ func getLoggerDetails(c *cli.Context) error {
logger = c.Args().First()
}
if logger == "" {
return errors.New("a logger must be specified")
}
conn, err := setupClient()
if err != nil {
return err
@@ -2135,12 +2210,20 @@ func setLoggerDetails(c *cli.Context) error {
logger = c.Args().First()
}
if logger == "" {
return errors.New("a logger must be specified")
}
if c.IsSet("level") {
level = c.String("level")
} else {
level = c.Args().Get(1)
}
if level == "" {
return errors.New("level must be specified")
}
conn, err := setupClient()
if err != nil {
return err
@@ -2408,7 +2491,7 @@ func disableExchangePair(c *cli.Context) error {
var getOrderbookStreamCommand = cli.Command{
Name: "getorderbookstream",
Usage: "gets the orderbook stream for a specific currency pair and exchange",
ArgsUsage: "<exchange> <currencyPair> <asset>",
ArgsUsage: "<exchange> <pair> <asset>",
Action: getOrderbookStream,
Flags: []cli.Flag{
cli.StringFlag{
@@ -2616,7 +2699,7 @@ func getExchangeOrderbookStream(c *cli.Context) error {
var getTickerStreamCommand = cli.Command{
Name: "gettickerstream",
Usage: "gets the ticker stream for a specific currency pair and exchange",
ArgsUsage: "<exchange> <currencyPair> <asset>",
ArgsUsage: "<exchange> <pair> <asset>",
Action: getTickerStream,
Flags: []cli.Flag{
cli.StringFlag{
@@ -2868,7 +2951,7 @@ func getAuditEvent(c *cli.Context) error {
if !c.IsSet("limit") {
if c.Args().Get(3) != "" {
limitStr, err := strconv.ParseInt(c.Args().Get(3), 10, 32)
limitStr, err := strconv.ParseInt(c.Args().Get(3), 10, 64)
if err == nil {
limit = int(limitStr)
}
@@ -3351,6 +3434,7 @@ func gctScriptUpload(c *cli.Context) error {
return nil
}
var candleRangeSize, candleGranularity int64
var getHistoricCandlesCommand = cli.Command{
Name: "gethistoriccandles",
Usage: "gets historical candles for the specified granularity up to range size time from now.",
@@ -3365,13 +3449,17 @@ var getHistoricCandlesCommand = cli.Command{
Name: "pair",
Usage: "the currency pair to get the candles for",
},
cli.IntFlag{
Name: "rangesize, r",
Usage: "the amount of time to go back from now to fetch candles in the given granularity",
cli.Int64Flag{
Name: "rangesize, r",
Usage: "the amount of time to go back from now to fetch candles in the given granularity",
Value: 10,
Destination: &candleRangeSize,
},
cli.IntFlag{
Name: "granularity, g",
Usage: "value is in seconds and can be one of the following {60, 300, 900, 3600, 21600, 86400}",
cli.Int64Flag{
Name: "granularity, g",
Usage: "value is in seconds and can be one of the following {60, 300, 900, 3600, 21600, 86400}",
Value: 86400,
Destination: &candleGranularity,
},
},
}
@@ -3403,26 +3491,24 @@ func getHistoricCandles(c *cli.Context) error {
}
p := currency.NewPairDelimiter(currencyPair, pairDelimiter)
var rangesize int64
if c.IsSet("rangesize") {
rangesize = c.Int64("rangesize")
} else {
rs, err := strconv.Atoi(c.Args().Get(2))
candleRangeSize = c.Int64("rangesize")
} else if c.Args().Get(2) != "" {
var err error
candleRangeSize, err = strconv.ParseInt(c.Args().Get(2), 10, 64)
if err != nil {
return fmt.Errorf("unable to strconv input to int. Err: %s", err)
return err
}
rangesize = int64(rs)
}
var granularity int64
if c.IsSet("granularity") {
granularity = c.Int64("granularity")
} else {
gr, err := strconv.Atoi(c.Args().Get(3))
candleGranularity = c.Int64("granularity")
} else if c.Args().Get(3) != "" {
var err error
candleGranularity, err = strconv.ParseInt(c.Args().Get(3), 10, 64)
if err != nil {
return fmt.Errorf("unable to strconv input to int. Err: %s", err)
return err
}
granularity = int64(gr)
}
conn, err := setupClient()
@@ -3440,8 +3526,8 @@ func getHistoricCandles(c *cli.Context) error {
Base: p.Base.String(),
Quote: p.Quote.String(),
},
Rangesize: rangesize,
Granularity: granularity,
Rangesize: candleRangeSize,
Granularity: candleGranularity,
})
if err != nil {

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
}