Files
gocryptotrader/cmd/gctcli/validation.go
Ryan O'Hara-Reid 4ccb495baf Asset package update (#581)
* Rewrite new function and deploy where we can minimise the chance of setting an asset type that is different to supported list - sets validation to exact supported list

* change wording
2020-10-19 13:59:50 +11:00

29 lines
605 B
Go

package main
import (
"errors"
"strings"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
)
var (
errInvalidPair = errors.New("invalid currency pair supplied")
errInvalidExchange = errors.New("invalid exchange supplied")
errInvalidAsset = errors.New("invalid asset supplied")
)
func validPair(pair string) bool {
return strings.Contains(pair, pairDelimiter)
}
func validExchange(exch string) bool {
return exchange.IsSupported(exch)
}
func validAsset(i string) bool {
_, err := asset.New(i)
return err == nil
}