mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
* 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
29 lines
605 B
Go
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
|
|
}
|