mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Improvements in config, currency, exchange, pair and helper code
This commit is contained in:
166
config/config.go
166
config/config.go
@@ -8,11 +8,11 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/portfolio"
|
||||
"github.com/thrasher-/gocryptotrader/smsglobal"
|
||||
)
|
||||
@@ -117,8 +117,66 @@ type ExchangeConfig struct {
|
||||
RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"RequestCurrencyPairFormat"`
|
||||
}
|
||||
|
||||
// GetConfigEnabledExchanges returns the number of exchanges that are enabled.
|
||||
func (c *Config) GetConfigEnabledExchanges() int {
|
||||
// SupportsPair returns true or not whether the exchange supports the supplied
|
||||
// pair
|
||||
func (c *Config) SupportsPair(exchName string, p pair.CurrencyPair) (bool, error) {
|
||||
pairs, err := c.GetAvailablePairs(exchName)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return pair.Contains(pairs, p), nil
|
||||
}
|
||||
|
||||
// GetAvailablePairs returns a list of currency pairs for a specifc exchange
|
||||
func (c *Config) GetAvailablePairs(exchName string) ([]pair.CurrencyPair, error) {
|
||||
exchCfg, err := c.GetExchangeConfig(exchName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pairs := pair.FormatPairs(common.SplitStrings(exchCfg.AvailablePairs, ","),
|
||||
exchCfg.ConfigCurrencyPairFormat.Delimiter,
|
||||
exchCfg.ConfigCurrencyPairFormat.Index)
|
||||
return pairs, nil
|
||||
}
|
||||
|
||||
// GetEnabledPairs returns a list of currency pairs for a specifc exchange
|
||||
func (c *Config) GetEnabledPairs(exchName string) ([]pair.CurrencyPair, error) {
|
||||
exchCfg, err := c.GetExchangeConfig(exchName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pairs := pair.FormatPairs(common.SplitStrings(exchCfg.EnabledPairs, ","),
|
||||
exchCfg.ConfigCurrencyPairFormat.Delimiter,
|
||||
exchCfg.ConfigCurrencyPairFormat.Index)
|
||||
return pairs, nil
|
||||
}
|
||||
|
||||
// GetEnabledExchanges returns a list of enabled exchanges
|
||||
func (c *Config) GetEnabledExchanges() []string {
|
||||
var enabledExchs []string
|
||||
for i := range c.Exchanges {
|
||||
if c.Exchanges[i].Enabled {
|
||||
enabledExchs = append(enabledExchs, c.Exchanges[i].Name)
|
||||
}
|
||||
}
|
||||
return enabledExchs
|
||||
}
|
||||
|
||||
// GetDisabledExchanges returns a list of disabled exchanges
|
||||
func (c *Config) GetDisabledExchanges() []string {
|
||||
var disabledExchs []string
|
||||
for i := range c.Exchanges {
|
||||
if !c.Exchanges[i].Enabled {
|
||||
disabledExchs = append(disabledExchs, c.Exchanges[i].Name)
|
||||
}
|
||||
}
|
||||
return disabledExchs
|
||||
}
|
||||
|
||||
// CountEnabledExchanges returns the number of exchanges that are enabled.
|
||||
func (c *Config) CountEnabledExchanges() int {
|
||||
counter := 0
|
||||
for i := range c.Exchanges {
|
||||
if c.Exchanges[i].Enabled {
|
||||
@@ -128,6 +186,26 @@ func (c *Config) GetConfigEnabledExchanges() int {
|
||||
return counter
|
||||
}
|
||||
|
||||
// GetConfigCurrencyPairFormat returns the config currency pair format
|
||||
// for a specific exchange
|
||||
func (c *Config) GetConfigCurrencyPairFormat(exchName string) (*CurrencyPairFormatConfig, error) {
|
||||
exchCfg, err := c.GetExchangeConfig(exchName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return exchCfg.ConfigCurrencyPairFormat, nil
|
||||
}
|
||||
|
||||
// GetRequestCurrencyPairFormat returns the request currency pair format
|
||||
// for a specific exchange
|
||||
func (c *Config) GetRequestCurrencyPairFormat(exchName string) (*CurrencyPairFormatConfig, error) {
|
||||
exchCfg, err := c.GetExchangeConfig(exchName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return exchCfg.RequestCurrencyPairFormat, nil
|
||||
}
|
||||
|
||||
// GetCurrencyPairDisplayConfig retrieves the currency pair display preference
|
||||
func (c *Config) GetCurrencyPairDisplayConfig() *CurrencyPairFormatConfig {
|
||||
return c.CurrencyPairFormat
|
||||
@@ -253,59 +331,49 @@ func (c *Config) RetrieveConfigCurrencyPairs() error {
|
||||
cryptoCurrencies := common.SplitStrings(c.Cryptocurrencies, ",")
|
||||
fiatCurrencies := common.SplitStrings(currency.DefaultCurrencies, ",")
|
||||
|
||||
for _, s := range cryptoCurrencies {
|
||||
_, err := strconv.Atoi(s)
|
||||
if err != nil && common.StringContains(c.Cryptocurrencies, s) {
|
||||
for x := range c.Exchanges {
|
||||
if !c.Exchanges[x].Enabled {
|
||||
continue
|
||||
} else {
|
||||
return errors.New("RetrieveConfigCurrencyPairs: Incorrect Crypto-Currency")
|
||||
}
|
||||
}
|
||||
|
||||
for _, exchange := range c.Exchanges {
|
||||
if exchange.Enabled {
|
||||
baseCurrencies := common.SplitStrings(exchange.BaseCurrencies, ",")
|
||||
enabledCurrencies := common.SplitStrings(exchange.EnabledPairs, ",")
|
||||
|
||||
for _, currencyPair := range enabledCurrencies {
|
||||
ok, separator := currency.ContainsSeparator(currencyPair)
|
||||
if ok {
|
||||
pair := common.SplitStrings(currencyPair, separator)
|
||||
for _, x := range pair {
|
||||
ok, _ = currency.ContainsBaseCurrencyIndex(baseCurrencies, x)
|
||||
if !ok {
|
||||
cryptoCurrencies = currency.CheckAndAddCurrency(cryptoCurrencies, x)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ok, idx := currency.ContainsBaseCurrencyIndex(baseCurrencies, currencyPair)
|
||||
if ok {
|
||||
curr := strings.Replace(currencyPair, idx, "", -1)
|
||||
|
||||
if currency.ContainsBaseCurrency(baseCurrencies, curr) {
|
||||
fiatCurrencies = currency.CheckAndAddCurrency(fiatCurrencies, curr)
|
||||
} else {
|
||||
cryptoCurrencies = currency.CheckAndAddCurrency(cryptoCurrencies, curr)
|
||||
}
|
||||
|
||||
if currency.ContainsBaseCurrency(baseCurrencies, idx) {
|
||||
fiatCurrencies = currency.CheckAndAddCurrency(fiatCurrencies, idx)
|
||||
} else {
|
||||
cryptoCurrencies = currency.CheckAndAddCurrency(cryptoCurrencies, idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
baseCurrencies := common.SplitStrings(c.Exchanges[x].BaseCurrencies, ",")
|
||||
for y := range baseCurrencies {
|
||||
if !common.DataContains(fiatCurrencies, baseCurrencies[y]) {
|
||||
fiatCurrencies = append(fiatCurrencies, baseCurrencies[y])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currency.BaseCurrencies = common.JoinStrings(fiatCurrencies, ",")
|
||||
if common.StringContains(currency.BaseCurrencies, "RUR") {
|
||||
currency.BaseCurrencies = strings.Replace(currency.BaseCurrencies, "RUR", "RUB", -1)
|
||||
}
|
||||
c.Cryptocurrencies = common.JoinStrings(cryptoCurrencies, ",")
|
||||
currency.CryptoCurrencies = c.Cryptocurrencies
|
||||
for x := range c.Exchanges {
|
||||
if !c.Exchanges[x].Enabled {
|
||||
continue
|
||||
}
|
||||
|
||||
pairs, err := c.GetEnabledPairs(c.Exchanges[x].Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for y := range pairs {
|
||||
if !common.DataContains(fiatCurrencies, pairs[y].FirstCurrency.String()) &&
|
||||
!common.DataContains(cryptoCurrencies, pairs[y].FirstCurrency.String()) {
|
||||
cryptoCurrencies = append(cryptoCurrencies, pairs[y].FirstCurrency.String())
|
||||
}
|
||||
|
||||
if !common.DataContains(fiatCurrencies, pairs[y].SecondCurrency.String()) &&
|
||||
!common.DataContains(cryptoCurrencies, pairs[y].SecondCurrency.String()) {
|
||||
cryptoCurrencies = append(cryptoCurrencies, pairs[y].SecondCurrency.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currency.Update(fiatCurrencies, false)
|
||||
currency.Update(cryptoCurrencies, true)
|
||||
|
||||
for x := range currency.BaseCurrencies {
|
||||
if currency.BaseCurrencies[x] == "RUR" {
|
||||
currency.BaseCurrencies[x] = "RUB"
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,146 @@ package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
)
|
||||
|
||||
func TestGetConfigEnabledExchanges(t *testing.T) {
|
||||
defaultEnabledExchanges := 18
|
||||
func TestSupportsPair(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestSupportsPair. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.SupportsPair("asdf", pair.NewCurrencyPair("BTC", "USD"))
|
||||
if err == nil {
|
||||
t.Error(
|
||||
"Test failed. TestSupportsPair. Non-existant exchange returned nil error",
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.SupportsPair("Bitfinex", pair.NewCurrencyPair("BTC", "USD"))
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestSupportsPair. Incorrect values. Err: %s", err,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAvailablePairs(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetAvailablePairs. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.GetAvailablePairs("asdf")
|
||||
if err == nil {
|
||||
t.Error(
|
||||
"Test failed. TestGetAvailablePairs. Non-existant exchange returned nil error",
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.GetAvailablePairs("Bitfinex")
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetAvailablePairs. Incorrect values. Err: %s", err,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEnabledPairs(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetEnabledPairs. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.GetEnabledPairs("asdf")
|
||||
if err == nil {
|
||||
t.Error(
|
||||
"Test failed. TestGetEnabledPairs. Non-existant exchange returned nil error",
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.GetEnabledPairs("Bitfinex")
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetEnabledPairs. Incorrect values. Err: %s", err,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEnabledExchanges(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetEnabledExchanges. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
exchanges := cfg.GetEnabledExchanges()
|
||||
if len(exchanges) != 19 {
|
||||
t.Error(
|
||||
"Test failed. TestGetEnabledExchanges. Enabled exchanges value mismatch",
|
||||
)
|
||||
}
|
||||
|
||||
if !common.DataContains(exchanges, "Bitfinex") {
|
||||
t.Error(
|
||||
"Test failed. TestGetEnabledExchanges. Expected exchange Bitfinex not found",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetDisabledExchanges(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetDisabledExchanges. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
exchanges := cfg.GetDisabledExchanges()
|
||||
if len(exchanges) != 0 {
|
||||
t.Error(
|
||||
"Test failed. TestGetDisabledExchanges. Enabled exchanges value mismatch",
|
||||
)
|
||||
}
|
||||
|
||||
exchCfg, err := cfg.GetExchangeConfig("Bitfinex")
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetDisabledExchanges. GetExchangeConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
exchCfg.Enabled = false
|
||||
err = cfg.UpdateExchangeConfig(exchCfg)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetDisabledExchanges. UpdateExchangeConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
if len(cfg.GetDisabledExchanges()) != 1 {
|
||||
t.Error(
|
||||
"Test failed. TestGetDisabledExchanges. Enabled exchanges value mismatch",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCountEnabledExchanges(t *testing.T) {
|
||||
defaultEnabledExchanges := 19
|
||||
GetConfigEnabledExchanges := GetConfig()
|
||||
err := GetConfigEnabledExchanges.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
@@ -13,12 +149,59 @@ func TestGetConfigEnabledExchanges(t *testing.T) {
|
||||
"Test failed. GetConfigEnabledExchanges load config error: " + err.Error(),
|
||||
)
|
||||
}
|
||||
enabledExch := GetConfigEnabledExchanges.GetConfigEnabledExchanges()
|
||||
enabledExch := GetConfigEnabledExchanges.CountEnabledExchanges()
|
||||
if enabledExch != defaultEnabledExchanges {
|
||||
t.Error("Test failed. GetConfigEnabledExchanges is wrong")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetConfigCurrencyPairFormat(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetConfigCurrencyPairFormat. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
_, err = cfg.GetConfigCurrencyPairFormat("asdasdasd")
|
||||
if err == nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error",
|
||||
)
|
||||
}
|
||||
|
||||
exchFmt, err := cfg.GetConfigCurrencyPairFormat("Liqui")
|
||||
if !exchFmt.Uppercase || exchFmt.Delimiter != "_" {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetConfigCurrencyPairFormat. Invalid values",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetRequestCurrencyPairFormat(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetRequestCurrencyPairFormat. LoadConfig Error: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
_, err = cfg.GetRequestCurrencyPairFormat("asdasdasd")
|
||||
if err == nil {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error",
|
||||
)
|
||||
}
|
||||
|
||||
exchFmt, err := cfg.GetRequestCurrencyPairFormat("Liqui")
|
||||
if exchFmt.Uppercase || exchFmt.Delimiter != "_" || exchFmt.Separator != "-" {
|
||||
t.Errorf(
|
||||
"Test failed. TestGetRequestCurrencyPairFormat. Invalid values",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCurrencyPairDisplayConfig(t *testing.T) {
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
@@ -221,6 +404,7 @@ func TestCheckWebserverConfigValues(t *testing.T) {
|
||||
"Test failed. checkWebserverConfigValues.LoadConfig: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
err = checkWebserverConfigValues.CheckWebserverConfigValues()
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
@@ -229,6 +413,21 @@ func TestCheckWebserverConfigValues(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
checkWebserverConfigValues.Webserver.WebsocketConnectionLimit = -1
|
||||
err = checkWebserverConfigValues.CheckWebserverConfigValues()
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. checkWebserverConfigValues.CheckWebserverConfigValues: %s",
|
||||
err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
if checkWebserverConfigValues.Webserver.WebsocketConnectionLimit != 1 {
|
||||
t.Error(
|
||||
"Test failed. checkWebserverConfigValues.CheckWebserverConfigValues error",
|
||||
)
|
||||
}
|
||||
|
||||
checkWebserverConfigValues.Webserver.ListenAddress = ":0"
|
||||
err = checkWebserverConfigValues.CheckWebserverConfigValues()
|
||||
if err == nil {
|
||||
@@ -263,17 +462,17 @@ func TestCheckWebserverConfigValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetrieveConfigCurrencyPairs(t *testing.T) {
|
||||
retrieveConfigCurrencyPairs := GetConfig()
|
||||
err := retrieveConfigCurrencyPairs.LoadConfig(ConfigTestFile)
|
||||
cfg := GetConfig()
|
||||
err := cfg.LoadConfig(ConfigTestFile)
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. checkWebserverConfigValues.LoadConfig: %s", err.Error(),
|
||||
"Test failed. TestRetrieveConfigCurrencyPairs.LoadConfig: %s", err.Error(),
|
||||
)
|
||||
}
|
||||
err = retrieveConfigCurrencyPairs.RetrieveConfigCurrencyPairs()
|
||||
err = cfg.RetrieveConfigCurrencyPairs()
|
||||
if err != nil {
|
||||
t.Errorf(
|
||||
"Test failed. checkWebserverConfigValues.RetrieveConfigCurrencyPairs: %s",
|
||||
"Test failed. TestRetrieveConfigCurrencyPairs.RetrieveConfigCurrencyPairs: %s",
|
||||
err.Error(),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ const (
|
||||
var (
|
||||
CurrencyStore map[string]Rate
|
||||
CurrencyStoreFixer map[string]float64
|
||||
BaseCurrencies string
|
||||
CryptoCurrencies string
|
||||
BaseCurrencies []string
|
||||
CryptoCurrencies []string
|
||||
ErrCurrencyDataNotFetched = errors.New("yahoo currency data has not been fetched yet")
|
||||
ErrCurrencyNotFound = errors.New("unable to find specified currency")
|
||||
ErrQueryingYahoo = errors.New("unable to query Yahoo currency values")
|
||||
@@ -103,104 +103,50 @@ func GetProvider() string {
|
||||
// IsDefaultCurrency checks if the currency passed in matches the default
|
||||
// FIAT currency
|
||||
func IsDefaultCurrency(currency string) bool {
|
||||
return common.StringContains(
|
||||
DefaultCurrencies, common.StringToUpper(currency),
|
||||
)
|
||||
defaultCurrencies := common.SplitStrings(DefaultCurrencies, ",")
|
||||
return common.DataContains(defaultCurrencies, common.StringToUpper(currency))
|
||||
}
|
||||
|
||||
// IsDefaultCryptocurrency checks if the currency passed in matches the default
|
||||
// CRYPTO currency
|
||||
func IsDefaultCryptocurrency(currency string) bool {
|
||||
return common.StringContains(
|
||||
DefaultCryptoCurrencies, common.StringToUpper(currency),
|
||||
)
|
||||
cryptoCurrencies := common.SplitStrings(DefaultCryptoCurrencies, ",")
|
||||
return common.DataContains(cryptoCurrencies, common.StringToUpper(currency))
|
||||
}
|
||||
|
||||
// IsFiatCurrency checks if the currency passed is an enabled FIAT currency
|
||||
func IsFiatCurrency(currency string) bool {
|
||||
if BaseCurrencies == "" {
|
||||
if len(BaseCurrencies) == 0 {
|
||||
log.Println("IsFiatCurrency: BaseCurrencies string variable not populated")
|
||||
return false
|
||||
}
|
||||
return common.StringContains(BaseCurrencies, common.StringToUpper(currency))
|
||||
return common.DataContains(BaseCurrencies, common.StringToUpper(currency))
|
||||
}
|
||||
|
||||
// IsCryptocurrency checks if the currency passed is an enabled CRYPTO currency.
|
||||
func IsCryptocurrency(currency string) bool {
|
||||
if CryptoCurrencies == "" {
|
||||
if len(CryptoCurrencies) == 0 {
|
||||
log.Println(
|
||||
"IsCryptocurrency: CryptoCurrencies string variable not populated",
|
||||
)
|
||||
return false
|
||||
}
|
||||
return common.StringContains(CryptoCurrencies, common.StringToUpper(currency))
|
||||
return common.DataContains(CryptoCurrencies, common.StringToUpper(currency))
|
||||
}
|
||||
|
||||
// ContainsSeparator checks to see if the string passed contains "-" or "_"
|
||||
// separated strings and returns what the separators were.
|
||||
func ContainsSeparator(input string) (bool, string) {
|
||||
separators := []string{"-", "_"}
|
||||
var separatorsContainer []string
|
||||
|
||||
for _, x := range separators {
|
||||
if common.StringContains(input, x) {
|
||||
separatorsContainer = append(separatorsContainer, x)
|
||||
}
|
||||
}
|
||||
if len(separatorsContainer) == 0 {
|
||||
return false, ""
|
||||
}
|
||||
return true, strings.Join(separatorsContainer, ",")
|
||||
}
|
||||
|
||||
// ContainsBaseCurrencyIndex checks the currency against the baseCurrencies and
|
||||
// returns a bool and its corresponding basecurrency.
|
||||
func ContainsBaseCurrencyIndex(baseCurrencies []string, currency string) (bool, string) {
|
||||
for _, x := range baseCurrencies {
|
||||
if common.StringContains(currency, x) {
|
||||
return true, x
|
||||
}
|
||||
}
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// ContainsBaseCurrency checks the currency against the baseCurrencies and
|
||||
// returns a bool
|
||||
func ContainsBaseCurrency(baseCurrencies []string, currency string) bool {
|
||||
for _, x := range baseCurrencies {
|
||||
if common.StringContains(currency, x) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// CheckAndAddCurrency checks the string you passed with the input string array,
|
||||
// if not already added, checks to see if it is part of the default currency
|
||||
// list and returns the appended string.
|
||||
func CheckAndAddCurrency(input []string, check string) []string {
|
||||
for _, x := range input {
|
||||
if IsDefaultCurrency(x) {
|
||||
if IsDefaultCurrency(check) {
|
||||
if check == x {
|
||||
return input
|
||||
}
|
||||
continue
|
||||
// Update updates the local crypto currency or base currency store
|
||||
func Update(input []string, cryptos bool) {
|
||||
for x := range input {
|
||||
if cryptos {
|
||||
if !common.DataContains(CryptoCurrencies, input[x]) {
|
||||
CryptoCurrencies = append(CryptoCurrencies, input[x])
|
||||
}
|
||||
return input
|
||||
} else if IsDefaultCryptocurrency(x) {
|
||||
if IsDefaultCryptocurrency(check) {
|
||||
if check == x {
|
||||
return input
|
||||
}
|
||||
continue
|
||||
} else {
|
||||
if !common.DataContains(BaseCurrencies, input[x]) {
|
||||
BaseCurrencies = append(BaseCurrencies, input[x])
|
||||
}
|
||||
return input
|
||||
}
|
||||
return input
|
||||
}
|
||||
input = append(input, check)
|
||||
return input
|
||||
}
|
||||
|
||||
// SeedCurrencyData takes the desired FIAT currency string, if not defined the
|
||||
@@ -221,7 +167,7 @@ func SeedCurrencyData(fiatCurrencies string) error {
|
||||
// MakecurrencyPairs takes all supported currency and turns them into pairs.
|
||||
func MakecurrencyPairs(supportedCurrencies string) string {
|
||||
currencies := common.SplitStrings(supportedCurrencies, ",")
|
||||
pairs := []string{}
|
||||
var pairs []string
|
||||
count := len(currencies)
|
||||
for i := 0; i < count; i++ {
|
||||
currency := currencies[i]
|
||||
|
||||
@@ -115,13 +115,11 @@ func TestIsDefaultCryptocurrency(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsFiatCurrency(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if IsFiatCurrency("") {
|
||||
t.Error("Test failed. TestIsFiatCurrency returned true on an empty string")
|
||||
}
|
||||
|
||||
BaseCurrencies = "USD,AUD"
|
||||
BaseCurrencies = []string{"USD", "AUD"}
|
||||
var str1, str2, str3 string = "BTC", "USD", "birds123"
|
||||
|
||||
if IsFiatCurrency(str1) {
|
||||
@@ -142,13 +140,11 @@ func TestIsFiatCurrency(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsCryptocurrency(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if IsCryptocurrency("") {
|
||||
t.Error("Test failed. TestIsCryptocurrency returned true on an empty string")
|
||||
}
|
||||
|
||||
CryptoCurrencies = "BTC,LTC,DASH"
|
||||
CryptoCurrencies = []string{"BTC", "LTC", "DASH"}
|
||||
var str1, str2, str3 string = "USD", "BTC", "pterodactyl123"
|
||||
|
||||
if IsCryptocurrency(str1) {
|
||||
@@ -168,156 +164,22 @@ func TestIsCryptocurrency(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainsSeparator(t *testing.T) {
|
||||
t.Parallel()
|
||||
func TestUpdate(t *testing.T) {
|
||||
CryptoCurrencies = []string{"BTC", "LTC", "DASH"}
|
||||
BaseCurrencies = []string{"USD", "AUD"}
|
||||
|
||||
var str1, str2, str3, str4 string = "ding-dong", "ding_dong", "dong_ding-dang", "ding"
|
||||
Update([]string{"ETH"}, true)
|
||||
Update([]string{"JPY"}, false)
|
||||
|
||||
doesIt, whatIsIt := ContainsSeparator(str1)
|
||||
if doesIt != true || whatIsIt != "-" {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsSeparator: \nCannot find separator, %s.", str1,
|
||||
)
|
||||
}
|
||||
doesIt2, whatIsIt2 := ContainsSeparator(str2)
|
||||
if doesIt2 != true || whatIsIt2 != "_" {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsSeparator: \nCannot find separator, %s.", str2,
|
||||
)
|
||||
}
|
||||
doesIt3, whatIsIt3 := ContainsSeparator(str3)
|
||||
if doesIt3 != true || len(whatIsIt3) != 3 {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsSeparator: \nCannot find or incorrect separator, %s.",
|
||||
str3,
|
||||
)
|
||||
}
|
||||
doesIt4, whatIsIt4 := ContainsSeparator(str4)
|
||||
if doesIt4 != false || whatIsIt4 != "" {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsSeparator: \nReturn Issues with string, %s.", str3,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainsBaseCurrencyIndex(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
baseCurrencies := []string{"USD", "AUD", "EUR", "CNY"}
|
||||
currency1, currency2 := "USD", "DINGDONG"
|
||||
|
||||
isIt, whatIsIt := ContainsBaseCurrencyIndex(baseCurrencies, currency1)
|
||||
if !isIt && whatIsIt != "USD" {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsBaseCurrencyIndex: \nReturned: %t & %s, with Currency as %s.",
|
||||
isIt, whatIsIt, currency1,
|
||||
)
|
||||
}
|
||||
isIt2, whatIsIt2 := ContainsBaseCurrencyIndex(baseCurrencies, currency2)
|
||||
if isIt2 && whatIsIt2 != "DINGDONG" {
|
||||
t.Errorf(
|
||||
"Test Failed. ContainsBaseCurrencyIndex: \nReturned: %t & %s, with Currency as %s.",
|
||||
isIt2, whatIsIt2, currency2,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainsBaseCurrency(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
baseCurrencies := []string{"USD", "AUD", "EUR", "CNY"}
|
||||
currency1, currency2 := "USD", "DINGDONG"
|
||||
|
||||
isIt := ContainsBaseCurrency(baseCurrencies, currency1)
|
||||
if !isIt {
|
||||
t.Errorf("Test Failed. ContainsBaseCurrency: \nReturned: %t, with Currency as %s.",
|
||||
isIt, currency1,
|
||||
)
|
||||
}
|
||||
isIt2 := ContainsBaseCurrency(baseCurrencies, currency2)
|
||||
if isIt2 {
|
||||
t.Errorf("Test Failed. ContainsBaseCurrency: \nReturned: %t, with Currency as %s.",
|
||||
isIt2, currency2,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCheckAndAddCurrency(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
inputFiat := []string{"USD", "AUD", "EUR"}
|
||||
inputCrypto := []string{"BTC", "LTC", "ETH", "DOGE", "DASH", "XRP"}
|
||||
testError := []string{"Testy"}
|
||||
fiat := "USD"
|
||||
fiatIncrease := "CNY"
|
||||
crypto := "LTC"
|
||||
cryptoIncrease := "XMR"
|
||||
obtuse := "CATSANDDOGS"
|
||||
|
||||
appendedString := CheckAndAddCurrency(inputFiat, fiat)
|
||||
if len(appendedString) > len(inputFiat) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputFiat, currency as %s.",
|
||||
fiat,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputFiat, fiatIncrease)
|
||||
if len(appendedString) <= len(inputFiat) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputFiat, currency as %s.",
|
||||
fiatIncrease,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputFiat, crypto)
|
||||
if len(appendedString) > len(inputFiat) {
|
||||
t.Log(appendedString)
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputFiat, currency as %s.",
|
||||
crypto,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputFiat, obtuse)
|
||||
if len(appendedString) > len(inputFiat) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputFiat, currency as %s.",
|
||||
obtuse,
|
||||
if !IsCryptocurrency("ETH") {
|
||||
t.Error(
|
||||
"Test Failed. TestUpdate: \nCannot match currency: ETH",
|
||||
)
|
||||
}
|
||||
|
||||
appendedString = CheckAndAddCurrency(inputCrypto, crypto)
|
||||
if len(appendedString) > len(inputCrypto) {
|
||||
if !IsFiatCurrency("JPY") {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputCrytpo, currency as %s.",
|
||||
crypto,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputCrypto, cryptoIncrease)
|
||||
if len(appendedString) <= len(inputCrypto) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputCrytpo, currency as %s.",
|
||||
cryptoIncrease,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputCrypto, fiat)
|
||||
if len(appendedString) > len(inputCrypto) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputCrytpo, currency as %s.",
|
||||
fiat,
|
||||
)
|
||||
}
|
||||
appendedString = CheckAndAddCurrency(inputCrypto, obtuse)
|
||||
if len(appendedString) > len(inputCrypto) {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputCrytpo, currency as %s.",
|
||||
obtuse,
|
||||
)
|
||||
}
|
||||
|
||||
appendedString = CheckAndAddCurrency(testError, "USD")
|
||||
if appendedString[0] != testError[0] {
|
||||
t.Errorf(
|
||||
"Test Failed. CheckAndAddCurrency: Error with inputCrytpo, basecurrency as %s.",
|
||||
testError,
|
||||
"Test Failed. TestUpdate: \nCannot match currency: JPY",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,3 +126,23 @@ func Contains(pairs []CurrencyPair, p CurrencyPair) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// FormatPairs formats a string array to a list of currency pairs with the
|
||||
// supplied currency pair format
|
||||
func FormatPairs(pairs []string, delimiter, index string) []CurrencyPair {
|
||||
var result []CurrencyPair
|
||||
for x := range pairs {
|
||||
var p CurrencyPair
|
||||
if delimiter != "" {
|
||||
p = NewCurrencyPairDelimiter(pairs[x], delimiter)
|
||||
} else {
|
||||
if index != "" {
|
||||
p = NewCurrencyPairFromIndex(pairs[x], index)
|
||||
} else {
|
||||
p = NewCurrencyPair(pairs[x][0:3], pairs[x][3:])
|
||||
}
|
||||
}
|
||||
result = append(result, p)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -251,3 +251,17 @@ func TestContains(t *testing.T) {
|
||||
t.Errorf("Test failed. TestContains: Non-existant pair was found")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormatPairs(t *testing.T) {
|
||||
if FormatPairs([]string{"BTC-USD"}, "-", "")[0].Pair().String() != "BTC-USD" {
|
||||
t.Error("Test failed. TestFormatPairs: Expected pair was not found")
|
||||
}
|
||||
|
||||
if FormatPairs([]string{"BTCUSD"}, "", "BTC")[0].Pair().String() != "BTCUSD" {
|
||||
t.Error("Test failed. TestFormatPairs: Expected pair was not found")
|
||||
}
|
||||
|
||||
if FormatPairs([]string{"ETHUSD"}, "", "")[0].Pair().String() != "ETHUSD" {
|
||||
t.Error("Test failed. TestFormatPairs: Expected pair was not found")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ func LoadExchange(name string) error {
|
||||
|
||||
exchCfg.Enabled = true
|
||||
exch.Setup(exchCfg)
|
||||
exch.Start()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -189,89 +189,26 @@ func (e *Base) GetName() string {
|
||||
// GetEnabledCurrencies is a method that returns the enabled currency pairs of
|
||||
// the exchange base
|
||||
func (e *Base) GetEnabledCurrencies() []pair.CurrencyPair {
|
||||
var pairs []pair.CurrencyPair
|
||||
for x := range e.EnabledPairs {
|
||||
var currencyPair pair.CurrencyPair
|
||||
if e.RequestCurrencyPairFormat.Delimiter != "" {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter != "" {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter == e.RequestCurrencyPairFormat.Delimiter {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.EnabledPairs[x],
|
||||
e.RequestCurrencyPairFormat.Delimiter)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.EnabledPairs[x],
|
||||
e.ConfigCurrencyPairFormat.Delimiter)
|
||||
currencyPair.Delimiter = "-"
|
||||
}
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Index != "" {
|
||||
currencyPair = pair.NewCurrencyPairFromIndex(e.EnabledPairs[x],
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPair(e.EnabledPairs[x][0:3],
|
||||
e.EnabledPairs[x][3:])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter != "" {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.EnabledPairs[x],
|
||||
e.ConfigCurrencyPairFormat.Delimiter)
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Index != "" {
|
||||
currencyPair = pair.NewCurrencyPairFromIndex(e.EnabledPairs[x],
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPair(e.EnabledPairs[x][0:3],
|
||||
e.EnabledPairs[x][3:])
|
||||
}
|
||||
}
|
||||
}
|
||||
pairs = append(pairs, currencyPair)
|
||||
}
|
||||
return pairs
|
||||
return pair.FormatPairs(e.EnabledPairs,
|
||||
e.ConfigCurrencyPairFormat.Delimiter,
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
}
|
||||
|
||||
// GetAvailableCurrencies is a method that returns the available currency pairs
|
||||
// of the exchange base
|
||||
func (e *Base) GetAvailableCurrencies() []pair.CurrencyPair {
|
||||
var pairs []pair.CurrencyPair
|
||||
for x := range e.AvailablePairs {
|
||||
var currencyPair pair.CurrencyPair
|
||||
if e.RequestCurrencyPairFormat.Delimiter != "" {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter != "" {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter == e.RequestCurrencyPairFormat.Delimiter {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.AvailablePairs[x],
|
||||
e.RequestCurrencyPairFormat.Delimiter)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.AvailablePairs[x],
|
||||
e.ConfigCurrencyPairFormat.Delimiter)
|
||||
currencyPair.Delimiter = "-"
|
||||
}
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Index != "" {
|
||||
currencyPair = pair.NewCurrencyPairFromIndex(e.AvailablePairs[x],
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPair(e.AvailablePairs[x][0:3],
|
||||
e.AvailablePairs[x][3:])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Delimiter != "" {
|
||||
currencyPair = pair.NewCurrencyPairDelimiter(e.AvailablePairs[x],
|
||||
e.ConfigCurrencyPairFormat.Delimiter)
|
||||
} else {
|
||||
if e.ConfigCurrencyPairFormat.Index != "" {
|
||||
currencyPair = pair.NewCurrencyPairFromIndex(e.AvailablePairs[x],
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
} else {
|
||||
currencyPair = pair.NewCurrencyPair(e.AvailablePairs[x][0:3],
|
||||
e.AvailablePairs[x][3:])
|
||||
}
|
||||
}
|
||||
}
|
||||
pairs = append(pairs, currencyPair)
|
||||
return pair.FormatPairs(e.AvailablePairs,
|
||||
e.ConfigCurrencyPairFormat.Delimiter,
|
||||
e.ConfigCurrencyPairFormat.Index)
|
||||
}
|
||||
|
||||
// SupportsCurrency returns true or not whether a currency pair exists in the
|
||||
// exchange available currencies or not
|
||||
func (e *Base) SupportsCurrency(p pair.CurrencyPair, enabledPairs bool) bool {
|
||||
if enabledPairs {
|
||||
return pair.Contains(e.GetEnabledCurrencies(), p)
|
||||
}
|
||||
return pairs
|
||||
return pair.Contains(e.GetAvailableCurrencies(), p)
|
||||
}
|
||||
|
||||
// GetExchangeFormatCurrencySeperator returns whether or not a specific
|
||||
|
||||
@@ -320,6 +320,34 @@ func TestGetAvailableCurrencies(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSupportsCurrency(t *testing.T) {
|
||||
b := Base{
|
||||
Name: "TESTNAME",
|
||||
}
|
||||
|
||||
b.AvailablePairs = []string{"BTC-USD", "ETH-USD"}
|
||||
b.EnabledPairs = []string{"BTC-USD"}
|
||||
|
||||
format := config.CurrencyPairFormatConfig{
|
||||
Delimiter: "-",
|
||||
Index: "",
|
||||
}
|
||||
|
||||
b.RequestCurrencyPairFormat = format
|
||||
b.ConfigCurrencyPairFormat = format
|
||||
|
||||
if !b.SupportsCurrency(pair.NewCurrencyPair("BTC", "USD"), true) {
|
||||
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
|
||||
}
|
||||
|
||||
if !b.SupportsCurrency(pair.NewCurrencyPair("ETH", "USD"), false) {
|
||||
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
|
||||
}
|
||||
|
||||
if b.SupportsCurrency(pair.NewCurrencyPair("ASD", "ASDF"), true) {
|
||||
t.Error("Test Failed - Exchange SupportsCurrency() incorrect value")
|
||||
}
|
||||
}
|
||||
func TestGetExchangeFormatCurrencySeperator(t *testing.T) {
|
||||
cfg := config.GetConfig()
|
||||
err := cfg.LoadConfig(config.ConfigTestFile)
|
||||
|
||||
29
helpers.go
29
helpers.go
@@ -12,10 +12,37 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
)
|
||||
|
||||
// GetExchangeNamesByCurrency returns a list of exchanges supporting
|
||||
// a currency pair based on whether the exchange is enabled or not
|
||||
func GetExchangeNamesByCurrency(p pair.CurrencyPair, enabled bool) []string {
|
||||
var exchanges []string
|
||||
for x := range bot.config.Exchanges {
|
||||
if enabled != bot.config.Exchanges[x].Enabled {
|
||||
continue
|
||||
}
|
||||
|
||||
exchName := bot.config.Exchanges[x].Name
|
||||
success, err := bot.config.SupportsPair(exchName, p)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if success {
|
||||
exchanges = append(exchanges, exchName)
|
||||
}
|
||||
}
|
||||
return exchanges
|
||||
}
|
||||
|
||||
// GetRelatableCurrencies returns a list of currency pairs if it can find
|
||||
// any relatable currencies (e.g BTCUSD -> BTC USDT -> XBT USD)
|
||||
func GetRelatableCurrencies(p pair.CurrencyPair) []pair.CurrencyPair {
|
||||
// incOrig includes the supplied pair if desired
|
||||
func GetRelatableCurrencies(p pair.CurrencyPair, incOrig bool) []pair.CurrencyPair {
|
||||
var pairs []pair.CurrencyPair
|
||||
if incOrig {
|
||||
pairs = append(pairs, p)
|
||||
}
|
||||
|
||||
first, err := translation.GetTranslation(p.FirstCurrency)
|
||||
if err == nil {
|
||||
pairs = append(pairs, pair.NewCurrencyPair(first.String(),
|
||||
|
||||
14
main.go
14
main.go
@@ -10,6 +10,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
@@ -71,34 +72,34 @@ func main() {
|
||||
|
||||
log.Printf(
|
||||
"Available Exchanges: %d. Enabled Exchanges: %d.\n",
|
||||
len(bot.config.Exchanges), bot.config.GetConfigEnabledExchanges(),
|
||||
len(bot.config.Exchanges), bot.config.CountEnabledExchanges(),
|
||||
)
|
||||
|
||||
SetupExchanges()
|
||||
if len(bot.exchanges) == 0 {
|
||||
log.Fatalf("No exchanges were able to be loaded. Exiting")
|
||||
}
|
||||
// TODO: Fix hack, allow 2 seconds to update exchange settings
|
||||
time.Sleep(time.Second * 2)
|
||||
|
||||
if bot.config.CurrencyExchangeProvider == "yahoo" {
|
||||
currency.SetProvider(true)
|
||||
} else {
|
||||
currency.SetProvider(false)
|
||||
}
|
||||
|
||||
log.Printf("Using %s as currency exchange provider.", bot.config.CurrencyExchangeProvider)
|
||||
log.Printf("Currency exchange provider: %s.", bot.config.CurrencyExchangeProvider)
|
||||
|
||||
bot.config.RetrieveConfigCurrencyPairs()
|
||||
err = currency.SeedCurrencyData(currency.BaseCurrencies)
|
||||
err = currency.SeedCurrencyData(common.JoinStrings(currency.BaseCurrencies, ","))
|
||||
if err != nil {
|
||||
currency.SwapProvider()
|
||||
log.Printf("'%s' currency exchange provider failed, swapping to %s and testing..",
|
||||
bot.config.CurrencyExchangeProvider, currency.GetProvider())
|
||||
err = currency.SeedCurrencyData(currency.BaseCurrencies)
|
||||
err = currency.SeedCurrencyData(common.JoinStrings(currency.BaseCurrencies, ","))
|
||||
if err != nil {
|
||||
log.Fatalf("Fatal error retrieving config currencies. Error: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("Successfully retrieved config currencies.")
|
||||
|
||||
bot.portfolio = &portfolio.Portfolio
|
||||
@@ -108,7 +109,6 @@ func main() {
|
||||
|
||||
log.Println("Starting websocket handler")
|
||||
go WebsocketHandler()
|
||||
|
||||
go TickerUpdaterRoutine()
|
||||
go OrderbookUpdaterRoutine()
|
||||
|
||||
|
||||
14
testdata/configtest.json
vendored
14
testdata/configtest.json
vendored
@@ -90,7 +90,7 @@
|
||||
"AuthenticatedAPISupport": false,
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"AvailablePairs": "BTCUSD,LTCUSD,LTCBTC,ETHUSD,ETHBTC,ETCBTC,ETCUSD,RRTUSD,RRTBTC,ZECUSD,ZECBTC,XMRUSD,XMRBTC,DSHUSD,DSHBTC,BCCBTC,BCUBTC,BCCUSD,BCUUSD,XRPUSD,XRPBTC,IOTUSD,IOTBTC,IOTETH,EOSUSD,EOSBTC,EOSETH,SANUSD,SANBTC,SANETH,OMGUSD,OMGBTC,OMGETH,BCHUSD,BCHBTC,BCHETH",
|
||||
"AvailablePairs": "BTCUSD,LTCUSD,LTCBTC,ETHUSD,ETHBTC,ETCBTC,ETCUSD,RRTUSD,RRTBTC,ZECUSD,ZECBTC,XMRUSD,XMRBTC,DSHUSD,DSHBTC,BTCEUR,XRPUSD,XRPBTC,IOTUSD,IOTBTC,IOTETH,EOSUSD,EOSBTC,EOSETH,SANUSD,SANBTC,SANETH,OMGUSD,OMGBTC,OMGETH,BCHUSD,BCHBTC,BCHETH,NEOUSD,NEOBTC,NEOETH,ETPUSD,ETPBTC,ETPETH,QTMUSD,QTMBTC,QTMETH,AVTUSD,AVTBTC,AVTETH,EDOUSD,EDOBTC,EDOETH,BTGUSD,BTGBTC,DATUSD,DATBTC,DATETH,QSHUSD,QSHBTC,QSHETH,YYWUSD,YYWBTC,YYWETH,GNTUSD,GNTBTC,GNTETH,SNTUSD,SNTBTC,SNTETH,IOTEUR,BATUSD,BATBTC,BATETH,MNAUSD,MNABTC,MNAETH,FUNUSD,FUNBTC,FUNETH,ZRXUSD,ZRXBTC,ZRXETH,TNBUSD,TNBBTC,TNBETH,SPKUSD,SPKBTC,SPKETH",
|
||||
"EnabledPairs": "BTCUSD,LTCUSD,LTCBTC,ETHUSD,ETHBTC",
|
||||
"BaseCurrencies": "USD",
|
||||
"AssetTypes": "SPOT",
|
||||
@@ -133,7 +133,7 @@
|
||||
"AuthenticatedAPISupport": false,
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"AvailablePairs": "BTC-LTC,BTC-DOGE,BTC-VTC,BTC-PPC,BTC-FTC,BTC-RDD,BTC-NXT,BTC-DASH,BTC-POT,BTC-BLK,BTC-EMC2,BTC-XMY,BTC-AUR,BTC-EFL,BTC-GLD,BTC-SLR,BTC-PTC,BTC-GRS,BTC-NLG,BTC-RBY,BTC-XWC,BTC-MONA,BTC-THC,BTC-ENRG,BTC-ERC,BTC-VRC,BTC-CURE,BTC-XBB,BTC-XMR,BTC-CLOAK,BTC-START,BTC-KORE,BTC-XDN,BTC-TRUST,BTC-NAV,BTC-XST,BTC-BTCD,BTC-VIA,BTC-UNO,BTC-PINK,BTC-IOC,BTC-CANN,BTC-SYS,BTC-NEOS,BTC-DGB,BTC-BURST,BTC-EXCL,BTC-SWIFT,BTC-DOPE,BTC-BLOCK,BTC-ABY,BTC-BYC,BTC-XMG,BTC-BLITZ,BTC-BAY,BTC-BTS,BTC-FAIR,BTC-SPR,BTC-VTR,BTC-XRP,BTC-GAME,BTC-COVAL,BTC-NXS,BTC-XCP,BTC-BITB,BTC-GEO,BTC-FLDC,BTC-GRC,BTC-FLO,BTC-NBT,BTC-MUE,BTC-XEM,BTC-CLAM,BTC-DMD,BTC-GAM,BTC-SPHR,BTC-OK,BTC-SNRG,BTC-PKB,BTC-CPC,BTC-AEON,BTC-ETH,BTC-GCR,BTC-TX,BTC-BCY,BTC-EXP,BTC-INFX,BTC-OMNI,BTC-AMP,BTC-AGRS,BTC-XLM,BTC-BTA,USDT-BTC,BTC-CLUB,BTC-VOX,BTC-EMC,BTC-FCT,BTC-MAID,BTC-EGC,BTC-SLS,BTC-RADS,BTC-DCR,BTC-S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OMG,ETH-OMG,BTC-CVC,ETH-CVC,BTC-PART,BTC-QTUM,ETH-QTUM,ETH-XMR,ETH-XEM,ETH-XLM,ETH-NEO,USDT-XMR,USDT-DASH,ETH-BCC,USDT-BCC,BTC-BCC,BTC-DNT,ETH-DNT,USDT-NEO,ETH-WAVES,ETH-STRAT,ETH-DGB,ETH-FCT,USDT-OMG,BTC-ADA,BTC-MANA,ETH-MANA,BTC-SALT,ETH-SALT,BTC-TIX,ETH-TIX,BTC-RCN,ETH-RCN,BTC-VIB,ETH-VIB,BTC-MER,BTC-POWR,ETH-POWR,BTC-BTG,ETH-BTG,USDT-BTG,ETH-ADA,BTC-ENG,ETH-ENG,USDT-ADA,USDT-XVG,USDT-NXT,BTC-UKG,ETH-UKG",
|
||||
"EnabledPairs": "USDT-BTC",
|
||||
"BaseCurrencies": "USD",
|
||||
"AssetTypes": "SPOT",
|
||||
@@ -244,7 +244,7 @@
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"ClientID": "ClientID",
|
||||
"AvailablePairs": "LTCEUR,LTCBTC,BTCGBP,BTCEUR,ETHEUR,ETHBTC,LTCUSD,BTCUSD,ETHUSD",
|
||||
"AvailablePairs": "BCHUSD,BTCEUR,BTCGBP,BTCUSD,ETHBTC,ETHEUR,ETHUSD,LTCBTC,LTCEUR,LTCUSD",
|
||||
"EnabledPairs": "BTCUSD,BTCGBP,BTCEUR",
|
||||
"BaseCurrencies": "USD,GBP,EUR",
|
||||
"AssetTypes": "SPOT",
|
||||
@@ -330,8 +330,8 @@
|
||||
"AuthenticatedAPISupport": false,
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"AvailablePairs": "ETHEUR,XRPXBT,BCHXBT,DASHUSD,EOSETH,REPXBT,XBTUSD.D,XLMXBT,ETHGBP.D,XMRXBT,GNOXBT,ETHUSD,ETCXBT,ETHEUR.D,ICNXBT,XBTJPY.D,XRPUSD,BCHEUR,DASHXBT,ETHCAD,ZECUSD,ICNETH,MLNETH,XDGXBT,GNOETH,LTCUSD,XBTCAD,XBTEUR,ZECXBT,BCHUSD,DASHEUR,EOSXBT,USDTUSD,ETCUSD,ETHXBT,ETHXBT.D,XBTJPY,XBTCAD.D,XRPEUR,LTCXBT,REPETH,XBTGBP.D,REPEUR,XMRUSD,ETHCAD.D,ETHJPY,ETHJPY.D,ETCETH,XBTEUR.D,XBTGBP,LTCEUR,MLNXBT,XBTUSD,XMREUR,ZECEUR,ETCEUR,ETHGBP,ETHUSD.D",
|
||||
"EnabledPairs": "ETCUSD,XBTUSD,ETHUSD",
|
||||
"AvailablePairs": "ETC-ETH,MLN-XBT,XBT-CAD,XBT-JPY,XDG-XBT,BCH-EUR,DASH-EUR,ETC-XBT,ETH-GBP,ICN-XBT,ETH-CAD,ETC-USD,EOS-ETH,ZEC-USD,ETC-EUR,LTC-USD,MLN-ETH,REP-XBT,XLM-XBT,XMR-XBT,XMR-USD,GNO-ETH,USDT-USD,LTC-EUR,REP-ETH,ETH-EUR,XRP-XBT,ZEC-XBT,BCH-USD,BCH-XBT,ETH-USD,LTC-XBT,XRP-EUR,XRP-USD,XBT-EUR,ETH-XBT,ICN-ETH,XMR-EUR,DASH-USD,EOS-XBT,REP-EUR,XBT-GBP,XBT-USD,ZEC-EUR,DASH-XBT,GNO-XBT,ETH-JPY",
|
||||
"EnabledPairs": "XBT-USD",
|
||||
"BaseCurrencies": "EUR,USD,CAD,GBP,JPY",
|
||||
"AssetTypes": "SPOT",
|
||||
"ConfigCurrencyPairFormat": {
|
||||
@@ -374,7 +374,7 @@
|
||||
"AuthenticatedAPISupport": false,
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"AvailablePairs": "HMQ_ETH,PTOY_ETH,SNT_BTC,TRST_ETH,RLC_BTC,TRST_BTC,LUN_ETH,XID_USDT,DASH_BTC,ICN_USDT,BNT_ETH,TIME_ETH,VSL_BTC,PLU_ETH,1ST_USDT,RLC_ETH,GNO_ETH,TKN_BTC,BCC_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_USDT,WAVES_BTC,DASH_USDT,REP_BTC,NEU_BTC,STORJ_USDT,STX_USDT,VEN_BTC,MLN_USDT,KNC_BTC,REQ_ETH,SAN_USDT,BCC_USDT,TNT_ETH,EOS_USDT,XID_ETH,DGD_BTC,ZRX_BTC,TRST_USDT,REP_USDT,PAY_ETH,TIME_ETH,BNT_USDT,NET_BTC,DASH_ETH,ICN_ETH,TRST_BTC,BCC_ETH,STX_ETH,RLC_ETH,SRN_BTC,NET_ETH,MANA_ETH,RLC_USDT,CFI_BTC,TRX_USDT,AST_BTC,AST_USDT,RLC_BTC,DNT_BTC,VEN_USDT,BMC_BTC,EDG_BTC,OAX_BTC,IND_USDT,EDG_ETH,NEU_ETH,BMC_USDT,GNT_BTC,PTOY_ETH,SNT_USDT,ZRX_USDT,MLN_ETH,MGO_USDT,CFI_ETH,GUP_BTC,ZRX_ETH,MYST_ETH,ENG_BTC,DASH_BTC,EOS_BTC,CVC_ETH,AST_ETH,LTC_BTC,GNO_USDT,TAAS_ETH,XID_BTC,TRST_ETH,TAAS_USDT,SNM_BTC,ADX_USDT",
|
||||
"EnabledPairs": "ETH_BTC,LTC_BTC,DASH_BTC",
|
||||
"BaseCurrencies": "USD",
|
||||
"AssetTypes": "SPOT",
|
||||
@@ -463,7 +463,7 @@
|
||||
"AuthenticatedAPISupport": false,
|
||||
"APIKey": "Key",
|
||||
"APISecret": "Secret",
|
||||
"AvailablePairs": "BTC_XUSD,BTC_FCT,BTC_MMNXT,BTC_NMC,BTC_BITUSD,BTC_RDD,BTC_XMR,BTC_XST,BTC_DSH,BTC_MAID,BTC_DGB,BTC_NEOS,BTC_BLK,BTC_NAUT,BTC_NBT,BTC_XCP,BTC_STR,BTC_BTCD,BTC_GRC,BTC_HUC,BTC_BBR,BTC_XDN,BTC_INDEX,BTC_IOC,BTC_SWARM,BTC_EMC2,BTC_MCN,BTC_NOXT,BTC_MINT,BTC_PTS,BTC_SC,BTC_GEO,BTC_XRP,BTC_FLO,BTC_BITS,BT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REP,BTC_BTCD,BTC_NXT,USDT_STR,BTC_STEEM,XMR_ZEC,BTC_BCH,BTC_BLK,BTC_RIC,XMR_BCN,XMR_NXT,BTC_ETH,BTC_DCR,USDT_REP,BTC_STRAT,BTC_NXC,BTC_PASC,BTC_GNT,BTC_BCN,BTC_SYS,BTC_XMR,USDT_DASH,ETH_ZRX,BTC_GAS,ETH_GAS,BTC_LTC,BTC_POT,USDT_NXT,BTC_SC,BTC_BTS,BTC_MAID,BTC_OMNI,BTC_NMC,BTC_XEM,BTC_XPM,BTC_LSK,ETH_GNO,ETH_BCH,USDT_XRP,XMR_DASH,USDT_ETH,BTC_FCT,BTC_OMG,BTC_CLAM,BTC_PINK,BTC_VRC,USDT_BTC,BTC_SBD,BTC_BTM,BTC_PPC,BTC_XRP,XMR_BLK,BTC_LBC,ETH_ETC,ETH_REP,BTC_BELA,BTC_NAV,BTC_STR,XMR_LTC,BTC_BCY,BTC_STORJ,BTC_DGB,BTC_NEOS,BTC_VIA,BTC_EXP,BTC_CVC,BTC_FLO,BTC_HUC,BTC_XCP,XMR_MAID,BTC_ARDR,ETH_ZEC,BTC_BURST,BTC_DOGE,BTC_GAME,BTC_GRC,USDT_XMR,BTC_RADS,BTC_AMP,ETH_LSK",
|
||||
"EnabledPairs": "BTC_LTC,BTC_ETH,BTC_DOGE,BTC_DASH,BTC_XRP",
|
||||
"BaseCurrencies": "USD",
|
||||
"AssetTypes": "SPOT",
|
||||
|
||||
Reference in New Issue
Block a user