mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 23:16:54 +00:00
Feature: Add support to check whether an exchange supports automatic currency pair updates and if they don't, show a warning if the last currency pair update is >= 30 days
Also fix race condition in config get/set functions
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/thrasher-/gocryptotrader/common"
|
"github.com/thrasher-/gocryptotrader/common"
|
||||||
@@ -19,12 +20,13 @@ import (
|
|||||||
|
|
||||||
// Constants declared here are filename strings and test strings
|
// Constants declared here are filename strings and test strings
|
||||||
const (
|
const (
|
||||||
EncryptedConfigFile = "config.dat"
|
EncryptedConfigFile = "config.dat"
|
||||||
ConfigFile = "config.json"
|
ConfigFile = "config.json"
|
||||||
ConfigTestFile = "../testdata/configtest.json"
|
ConfigTestFile = "../testdata/configtest.json"
|
||||||
configFileEncryptionPrompt = 0
|
configFileEncryptionPrompt = 0
|
||||||
configFileEncryptionEnabled = 1
|
configFileEncryptionEnabled = 1
|
||||||
configFileEncryptionDisabled = -1
|
configFileEncryptionDisabled = -1
|
||||||
|
configPairsLastUpdatedWarningThreshold = 30 // 30 days
|
||||||
)
|
)
|
||||||
|
|
||||||
// Variables here are mainly alerts and a configuration object
|
// Variables here are mainly alerts and a configuration object
|
||||||
@@ -47,6 +49,7 @@ var (
|
|||||||
WarningWebserverRootWebFolderNotFound = "WARNING -- Webserver support disabled due to missing web folder."
|
WarningWebserverRootWebFolderNotFound = "WARNING -- Webserver support disabled due to missing web folder."
|
||||||
WarningExchangeAuthAPIDefaultOrEmptyValues = "WARNING -- Exchange %s: Authenticated API support disabled due to default/empty APIKey/Secret/ClientID values."
|
WarningExchangeAuthAPIDefaultOrEmptyValues = "WARNING -- Exchange %s: Authenticated API support disabled due to default/empty APIKey/Secret/ClientID values."
|
||||||
WarningCurrencyExchangeProvider = "WARNING -- Currency exchange provider invalid valid. Reset to Fixer."
|
WarningCurrencyExchangeProvider = "WARNING -- Currency exchange provider invalid valid. Reset to Fixer."
|
||||||
|
WarningPairsLastUpdatedThresholdExceeded = "WARNING -- Exchange %s: Last manual update of available currency pairs has exceeded %d days. Manual update required!"
|
||||||
Cfg Config
|
Cfg Config
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -95,6 +98,7 @@ type Config struct {
|
|||||||
SMS SMSGlobalConfig `json:"SMSGlobal"`
|
SMS SMSGlobalConfig `json:"SMSGlobal"`
|
||||||
Webserver WebserverConfig `json:"Webserver"`
|
Webserver WebserverConfig `json:"Webserver"`
|
||||||
Exchanges []ExchangeConfig `json:"Exchanges"`
|
Exchanges []ExchangeConfig `json:"Exchanges"`
|
||||||
|
m sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExchangeConfig holds all the information needed for each enabled Exchange.
|
// ExchangeConfig holds all the information needed for each enabled Exchange.
|
||||||
@@ -113,6 +117,8 @@ type ExchangeConfig struct {
|
|||||||
EnabledPairs string
|
EnabledPairs string
|
||||||
BaseCurrencies string
|
BaseCurrencies string
|
||||||
AssetTypes string
|
AssetTypes string
|
||||||
|
SupportsAutoPairUpdates bool
|
||||||
|
PairsLastUpdated int64 `json:",omitempty"`
|
||||||
ConfigCurrencyPairFormat *CurrencyPairFormatConfig `json:"ConfigCurrencyPairFormat"`
|
ConfigCurrencyPairFormat *CurrencyPairFormatConfig `json:"ConfigCurrencyPairFormat"`
|
||||||
RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"RequestCurrencyPairFormat"`
|
RequestCurrencyPairFormat *CurrencyPairFormatConfig `json:"RequestCurrencyPairFormat"`
|
||||||
}
|
}
|
||||||
@@ -213,6 +219,8 @@ func (c *Config) GetCurrencyPairDisplayConfig() *CurrencyPairFormatConfig {
|
|||||||
|
|
||||||
// GetExchangeConfig returns your exchange configurations by its indivdual name
|
// GetExchangeConfig returns your exchange configurations by its indivdual name
|
||||||
func (c *Config) GetExchangeConfig(name string) (ExchangeConfig, error) {
|
func (c *Config) GetExchangeConfig(name string) (ExchangeConfig, error) {
|
||||||
|
c.m.Lock()
|
||||||
|
defer c.m.Unlock()
|
||||||
for i := range c.Exchanges {
|
for i := range c.Exchanges {
|
||||||
if c.Exchanges[i].Name == name {
|
if c.Exchanges[i].Name == name {
|
||||||
return c.Exchanges[i], nil
|
return c.Exchanges[i], nil
|
||||||
@@ -223,6 +231,8 @@ func (c *Config) GetExchangeConfig(name string) (ExchangeConfig, error) {
|
|||||||
|
|
||||||
// UpdateExchangeConfig updates exchange configurations
|
// UpdateExchangeConfig updates exchange configurations
|
||||||
func (c *Config) UpdateExchangeConfig(e ExchangeConfig) error {
|
func (c *Config) UpdateExchangeConfig(e ExchangeConfig) error {
|
||||||
|
c.m.Lock()
|
||||||
|
defer c.m.Unlock()
|
||||||
for i := range c.Exchanges {
|
for i := range c.Exchanges {
|
||||||
if c.Exchanges[i].Name == e.Name {
|
if c.Exchanges[i].Name == e.Name {
|
||||||
c.Exchanges[i] = e
|
c.Exchanges[i] = e
|
||||||
@@ -279,15 +289,20 @@ func (c *Config) CheckExchangeConfigValues() error {
|
|||||||
if exch.APIKey == "" || exch.APISecret == "" || exch.APIKey == "Key" || exch.APISecret == "Secret" {
|
if exch.APIKey == "" || exch.APISecret == "" || exch.APIKey == "Key" || exch.APISecret == "Secret" {
|
||||||
c.Exchanges[i].AuthenticatedAPISupport = false
|
c.Exchanges[i].AuthenticatedAPISupport = false
|
||||||
log.Printf(WarningExchangeAuthAPIDefaultOrEmptyValues, exch.Name)
|
log.Printf(WarningExchangeAuthAPIDefaultOrEmptyValues, exch.Name)
|
||||||
continue
|
|
||||||
} else if exch.Name == "ITBIT" || exch.Name == "Bitstamp" || exch.Name == "COINUT" || exch.Name == "GDAX" {
|
} else if exch.Name == "ITBIT" || exch.Name == "Bitstamp" || exch.Name == "COINUT" || exch.Name == "GDAX" {
|
||||||
if exch.ClientID == "" || exch.ClientID == "ClientID" {
|
if exch.ClientID == "" || exch.ClientID == "ClientID" {
|
||||||
c.Exchanges[i].AuthenticatedAPISupport = false
|
c.Exchanges[i].AuthenticatedAPISupport = false
|
||||||
log.Printf(WarningExchangeAuthAPIDefaultOrEmptyValues, exch.Name)
|
log.Printf(WarningExchangeAuthAPIDefaultOrEmptyValues, exch.Name)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !exch.SupportsAutoPairUpdates {
|
||||||
|
lastUpdated := common.UnixTimestampToTime(exch.PairsLastUpdated)
|
||||||
|
lastUpdated.AddDate(0, 0, configPairsLastUpdatedWarningThreshold)
|
||||||
|
if lastUpdated.Unix() >= time.Now().Unix() {
|
||||||
|
log.Printf(WarningPairsLastUpdatedThresholdExceeded, exch.Name, configPairsLastUpdatedWarningThreshold)
|
||||||
|
}
|
||||||
|
}
|
||||||
exchanges++
|
exchanges++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -51,6 +51,7 @@ func (a *Alphapoint) SetDefaults() {
|
|||||||
a.APIUrl = alphapointDefaultAPIURL
|
a.APIUrl = alphapointDefaultAPIURL
|
||||||
a.WebsocketURL = alphapointDefaultWebsocketURL
|
a.WebsocketURL = alphapointDefaultWebsocketURL
|
||||||
a.AssetTypes = []string{ticker.Spot}
|
a.AssetTypes = []string{ticker.Spot}
|
||||||
|
a.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTicker returns current ticker information from Alphapoint for a selected
|
// GetTicker returns current ticker information from Alphapoint for a selected
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func (a *ANX) SetDefaults() {
|
|||||||
a.ConfigCurrencyPairFormat.Uppercase = true
|
a.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
a.ConfigCurrencyPairFormat.Index = "BTC"
|
a.ConfigCurrencyPairFormat.Index = "BTC"
|
||||||
a.AssetTypes = []string{ticker.Spot}
|
a.AssetTypes = []string{ticker.Spot}
|
||||||
|
a.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setup is run on startup to setup exchange with config values
|
//Setup is run on startup to setup exchange with config values
|
||||||
@@ -74,6 +75,10 @@ func (a *ANX) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = a.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ func (b *Binance) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = "-"
|
b.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
b.SetValues()
|
b.SetValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +83,10 @@ func (b *Binance) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ func (b *Bitfinex) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = ""
|
b.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup takes in the supplied exchange configuration details and sets params
|
// Setup takes in the supplied exchange configuration details and sets params
|
||||||
@@ -124,6 +125,10 @@ func (b *Bitfinex) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ func (b *Bitflyer) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = "_"
|
b.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup takes in the supplied exchange configuration details and sets params
|
// Setup takes in the supplied exchange configuration details and sets params
|
||||||
@@ -107,6 +108,10 @@ func (b *Bitflyer) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ func (b *Bithumb) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.ConfigCurrencyPairFormat.Index = "KRW"
|
b.ConfigCurrencyPairFormat.Index = "KRW"
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup takes in the supplied exchange configuration details and sets params
|
// Setup takes in the supplied exchange configuration details and sets params
|
||||||
@@ -88,6 +89,10 @@ func (b *Bithumb) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ func (b *Bitstamp) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = ""
|
b.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets configuration values to bitstamp
|
// Setup sets configuration values to bitstamp
|
||||||
@@ -91,6 +92,10 @@ func (b *Bitstamp) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ func (b *Bittrex) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = "-"
|
b.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup method sets current configuration details if enabled
|
// Setup method sets current configuration details if enabled
|
||||||
@@ -96,6 +97,10 @@ func (b *Bittrex) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ func (b *BTCC) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = ""
|
b.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup is run on startup to setup exchange with config values
|
// Setup is run on startup to setup exchange with config values
|
||||||
@@ -85,6 +86,10 @@ func (b *BTCC) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ func (b *BTCMarkets) SetDefaults() {
|
|||||||
b.ConfigCurrencyPairFormat.Delimiter = ""
|
b.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
b.ConfigCurrencyPairFormat.Uppercase = true
|
b.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
b.AssetTypes = []string{ticker.Spot}
|
b.AssetTypes = []string{ticker.Spot}
|
||||||
|
b.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup takes in an exchange configuration and sets all parameters
|
// Setup takes in an exchange configuration and sets all parameters
|
||||||
@@ -82,6 +83,10 @@ func (b *BTCMarkets) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ func (c *COINUT) SetDefaults() {
|
|||||||
c.ConfigCurrencyPairFormat.Delimiter = ""
|
c.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
c.ConfigCurrencyPairFormat.Uppercase = true
|
c.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
c.AssetTypes = []string{ticker.Spot}
|
c.AssetTypes = []string{ticker.Spot}
|
||||||
|
c.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets the current exchange configuration
|
// Setup sets the current exchange configuration
|
||||||
@@ -80,6 +81,10 @@ func (c *COINUT) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = c.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ type Base struct {
|
|||||||
AvailablePairs []string
|
AvailablePairs []string
|
||||||
EnabledPairs []string
|
EnabledPairs []string
|
||||||
AssetTypes []string
|
AssetTypes []string
|
||||||
|
PairsLastUpdated int64
|
||||||
|
SupportsAutoPairUpdating bool
|
||||||
WebsocketURL string
|
WebsocketURL string
|
||||||
APIUrl string
|
APIUrl string
|
||||||
RequestCurrencyPairFormat config.CurrencyPairFormatConfig
|
RequestCurrencyPairFormat config.CurrencyPairFormatConfig
|
||||||
@@ -85,6 +87,49 @@ type IBotExchange interface {
|
|||||||
GetAuthenticatedAPISupport() bool
|
GetAuthenticatedAPISupport() bool
|
||||||
SetCurrencies(pairs []pair.CurrencyPair, enabledPairs bool) error
|
SetCurrencies(pairs []pair.CurrencyPair, enabledPairs bool) error
|
||||||
GetExchangeHistory(pair.CurrencyPair, string) ([]TradeHistory, error)
|
GetExchangeHistory(pair.CurrencyPair, string) ([]TradeHistory, error)
|
||||||
|
SupportsAutoPairUpdates() bool
|
||||||
|
GetLastPairsUpdateTime() int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAutoPairDefaults sets the default values for whether or not the exchange
|
||||||
|
// supports auto pair updating or not
|
||||||
|
func (e *Base) SetAutoPairDefaults() error {
|
||||||
|
cfg := config.GetConfig()
|
||||||
|
exch, err := cfg.GetExchangeConfig(e.Name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
update := false
|
||||||
|
if e.SupportsAutoPairUpdating {
|
||||||
|
if !exch.SupportsAutoPairUpdates {
|
||||||
|
exch.SupportsAutoPairUpdates = true
|
||||||
|
update = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if exch.PairsLastUpdated == 0 {
|
||||||
|
exch.PairsLastUpdated = time.Now().Unix()
|
||||||
|
e.PairsLastUpdated = exch.PairsLastUpdated
|
||||||
|
update = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if update {
|
||||||
|
return cfg.UpdateExchangeConfig(exch)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SupportsAutoPairUpdates returns whether or not the exchange supports
|
||||||
|
// auto currency pair updating
|
||||||
|
func (e *Base) SupportsAutoPairUpdates() bool {
|
||||||
|
return e.SupportsAutoPairUpdating
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetLastPairsUpdateTime returns the unix timestamp of when the exchanges
|
||||||
|
// currency pairs were last updated
|
||||||
|
func (e *Base) GetLastPairsUpdateTime() int64 {
|
||||||
|
return e.PairsLastUpdated
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetAssetTypes checks the exchange asset types (whether it supports SPOT,
|
// SetAssetTypes checks the exchange asset types (whether it supports SPOT,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package exchange
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/thrasher-/gocryptotrader/common"
|
"github.com/thrasher-/gocryptotrader/common"
|
||||||
"github.com/thrasher-/gocryptotrader/config"
|
"github.com/thrasher-/gocryptotrader/config"
|
||||||
@@ -9,6 +10,105 @@ import (
|
|||||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestSetAutoPairDefaults(t *testing.T) {
|
||||||
|
cfg := config.GetConfig()
|
||||||
|
err := cfg.LoadConfig(config.ConfigTestFile)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults failed to load config file. Error: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
b := Base{
|
||||||
|
Name: "TESTNAME",
|
||||||
|
SupportsAutoPairUpdating: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err == nil {
|
||||||
|
t.Fatal("Test failed. TestSetAutoPairDefaults returned nil error for a non-existent exchange")
|
||||||
|
}
|
||||||
|
|
||||||
|
b.Name = "Bitstamp"
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
exch, err := cfg.GetExchangeConfig(b.Name)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults load config failed. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !exch.SupportsAutoPairUpdates {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults Incorrect value")
|
||||||
|
}
|
||||||
|
|
||||||
|
if exch.PairsLastUpdated != 0 {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults Incorrect value")
|
||||||
|
}
|
||||||
|
|
||||||
|
exch.SupportsAutoPairUpdates = false
|
||||||
|
err = cfg.UpdateExchangeConfig(exch)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults update config failed. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
exch, err = cfg.GetExchangeConfig(b.Name)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults load config failed. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if exch.SupportsAutoPairUpdates != false {
|
||||||
|
t.Fatal("Test failed. TestSetAutoPairDefaults Incorrect value")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
exch, err = cfg.GetExchangeConfig(b.Name)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults load config failed. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if exch.SupportsAutoPairUpdates == false {
|
||||||
|
t.Fatal("Test failed. TestSetAutoPairDefaults Incorrect value")
|
||||||
|
}
|
||||||
|
|
||||||
|
b.SupportsAutoPairUpdating = false
|
||||||
|
err = b.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Test failed. TestSetAutoPairDefaults. Error %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.PairsLastUpdated == 0 {
|
||||||
|
t.Fatal("Test failed. TestSetAutoPairDefaults Incorrect value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSupportsAutoPairUpdates(t *testing.T) {
|
||||||
|
b := Base{
|
||||||
|
Name: "TESTNAME",
|
||||||
|
SupportsAutoPairUpdating: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.SupportsAutoPairUpdates() {
|
||||||
|
t.Fatal("Test failed. TestSupportsAutoPairUpdates Incorrect value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetLastPairsUpdateTime(t *testing.T) {
|
||||||
|
testTime := time.Now().Unix()
|
||||||
|
b := Base{
|
||||||
|
Name: "TESTNAME",
|
||||||
|
PairsLastUpdated: testTime,
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.GetLastPairsUpdateTime() != testTime {
|
||||||
|
t.Fatal("Test failed. TestGetLastPairsUpdateTim Incorrect value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSetAssetTypes(t *testing.T) {
|
func TestSetAssetTypes(t *testing.T) {
|
||||||
cfg := config.GetConfig()
|
cfg := config.GetConfig()
|
||||||
err := cfg.LoadConfig(config.ConfigTestFile)
|
err := cfg.LoadConfig(config.ConfigTestFile)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ func (e *EXMO) SetDefaults() {
|
|||||||
e.ConfigCurrencyPairFormat.Delimiter = "_"
|
e.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
e.ConfigCurrencyPairFormat.Uppercase = true
|
e.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
e.AssetTypes = []string{ticker.Spot}
|
e.AssetTypes = []string{ticker.Spot}
|
||||||
|
e.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup takes in the supplied exchange configuration details and sets params
|
// Setup takes in the supplied exchange configuration details and sets params
|
||||||
@@ -85,6 +86,10 @@ func (e *EXMO) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = e.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ func (g *GDAX) SetDefaults() {
|
|||||||
g.ConfigCurrencyPairFormat.Uppercase = true
|
g.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
g.AssetTypes = []string{ticker.Spot}
|
g.AssetTypes = []string{ticker.Spot}
|
||||||
g.APIUrl = gdaxAPIURL
|
g.APIUrl = gdaxAPIURL
|
||||||
|
g.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup initialises the exchange parameters with the current configuration
|
// Setup initialises the exchange parameters with the current configuration
|
||||||
@@ -97,6 +98,10 @@ func (g *GDAX) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = g.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ func (g *Gemini) SetDefaults() {
|
|||||||
g.ConfigCurrencyPairFormat.Delimiter = ""
|
g.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
g.ConfigCurrencyPairFormat.Uppercase = true
|
g.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
g.AssetTypes = []string{ticker.Spot}
|
g.AssetTypes = []string{ticker.Spot}
|
||||||
|
g.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration parameters
|
// Setup sets exchange configuration parameters
|
||||||
@@ -138,6 +139,10 @@ func (g *Gemini) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = g.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ func (p *HitBTC) SetDefaults() {
|
|||||||
p.ConfigCurrencyPairFormat.Delimiter = "-"
|
p.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||||
p.ConfigCurrencyPairFormat.Uppercase = true
|
p.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
p.AssetTypes = []string{ticker.Spot}
|
p.AssetTypes = []string{ticker.Spot}
|
||||||
|
p.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets user exchange configuration settings
|
// Setup sets user exchange configuration settings
|
||||||
@@ -83,6 +84,10 @@ func (p *HitBTC) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = p.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ func (h *HUOBI) SetDefaults() {
|
|||||||
h.ConfigCurrencyPairFormat.Delimiter = "-"
|
h.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||||
h.ConfigCurrencyPairFormat.Uppercase = true
|
h.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
h.AssetTypes = []string{ticker.Spot}
|
h.AssetTypes = []string{ticker.Spot}
|
||||||
|
h.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets user configuration
|
// Setup sets user configuration
|
||||||
@@ -89,6 +90,10 @@ func (h *HUOBI) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = h.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ func (i *ItBit) SetDefaults() {
|
|||||||
i.ConfigCurrencyPairFormat.Delimiter = ""
|
i.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
i.ConfigCurrencyPairFormat.Uppercase = true
|
i.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
i.AssetTypes = []string{ticker.Spot}
|
i.AssetTypes = []string{ticker.Spot}
|
||||||
|
i.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets the exchange parameters from exchange config
|
// Setup sets the exchange parameters from exchange config
|
||||||
@@ -73,6 +74,10 @@ func (i *ItBit) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = i.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ func (k *Kraken) SetDefaults() {
|
|||||||
k.ConfigCurrencyPairFormat.Delimiter = "-"
|
k.ConfigCurrencyPairFormat.Delimiter = "-"
|
||||||
k.ConfigCurrencyPairFormat.Uppercase = true
|
k.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
k.AssetTypes = []string{ticker.Spot}
|
k.AssetTypes = []string{ticker.Spot}
|
||||||
|
k.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets current exchange configuration
|
// Setup sets current exchange configuration
|
||||||
@@ -87,6 +88,10 @@ func (k *Kraken) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = k.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ func (l *LakeBTC) SetDefaults() {
|
|||||||
l.ConfigCurrencyPairFormat.Delimiter = ""
|
l.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
l.ConfigCurrencyPairFormat.Uppercase = true
|
l.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
l.AssetTypes = []string{ticker.Spot}
|
l.AssetTypes = []string{ticker.Spot}
|
||||||
|
l.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration profile
|
// Setup sets exchange configuration profile
|
||||||
@@ -74,6 +75,10 @@ func (l *LakeBTC) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = l.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ func (l *Liqui) SetDefaults() {
|
|||||||
l.ConfigCurrencyPairFormat.Delimiter = "_"
|
l.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
l.ConfigCurrencyPairFormat.Uppercase = true
|
l.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
l.AssetTypes = []string{ticker.Spot}
|
l.AssetTypes = []string{ticker.Spot}
|
||||||
|
l.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration parameters for liqui
|
// Setup sets exchange configuration parameters for liqui
|
||||||
@@ -79,6 +80,10 @@ func (l *Liqui) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = l.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ func (l *LocalBitcoins) SetDefaults() {
|
|||||||
l.RequestCurrencyPairFormat.Uppercase = true
|
l.RequestCurrencyPairFormat.Uppercase = true
|
||||||
l.ConfigCurrencyPairFormat.Delimiter = ""
|
l.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
l.ConfigCurrencyPairFormat.Uppercase = true
|
l.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
|
l.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration parameters
|
// Setup sets exchange configuration parameters
|
||||||
@@ -138,6 +139,10 @@ func (l *LocalBitcoins) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = l.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ func (o *OKCoin) SetDefaults() {
|
|||||||
o.RESTPollingDelay = 10
|
o.RESTPollingDelay = 10
|
||||||
o.FuturesValues = []string{"this_week", "next_week", "quarter"}
|
o.FuturesValues = []string{"this_week", "next_week", "quarter"}
|
||||||
o.AssetTypes = []string{ticker.Spot}
|
o.AssetTypes = []string{ticker.Spot}
|
||||||
|
o.SupportsAutoPairUpdating = false
|
||||||
|
|
||||||
if okcoinDefaultsSet {
|
if okcoinDefaultsSet {
|
||||||
o.AssetTypes = append(o.AssetTypes, o.FuturesValues...)
|
o.AssetTypes = append(o.AssetTypes, o.FuturesValues...)
|
||||||
@@ -136,6 +137,10 @@ func (o *OKCoin) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = o.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ func (o *OKEX) SetDefaults() {
|
|||||||
o.RequestCurrencyPairFormat.Uppercase = false
|
o.RequestCurrencyPairFormat.Uppercase = false
|
||||||
o.ConfigCurrencyPairFormat.Delimiter = "_"
|
o.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
o.ConfigCurrencyPairFormat.Uppercase = false
|
o.ConfigCurrencyPairFormat.Uppercase = false
|
||||||
|
o.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup method sets current configuration details if enabled
|
// Setup method sets current configuration details if enabled
|
||||||
@@ -121,6 +122,10 @@ func (o *OKEX) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = o.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ func (p *Poloniex) SetDefaults() {
|
|||||||
p.ConfigCurrencyPairFormat.Delimiter = "_"
|
p.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
p.ConfigCurrencyPairFormat.Uppercase = true
|
p.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
p.AssetTypes = []string{ticker.Spot}
|
p.AssetTypes = []string{ticker.Spot}
|
||||||
|
p.SupportsAutoPairUpdating = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets user exchange configuration settings
|
// Setup sets user exchange configuration settings
|
||||||
@@ -90,6 +91,10 @@ func (p *Poloniex) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = p.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ func (w *WEX) SetDefaults() {
|
|||||||
w.ConfigCurrencyPairFormat.Delimiter = ""
|
w.ConfigCurrencyPairFormat.Delimiter = ""
|
||||||
w.ConfigCurrencyPairFormat.Uppercase = true
|
w.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
w.AssetTypes = []string{ticker.Spot}
|
w.AssetTypes = []string{ticker.Spot}
|
||||||
|
w.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration parameters for WEX
|
// Setup sets exchange configuration parameters for WEX
|
||||||
@@ -82,6 +83,10 @@ func (w *WEX) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = w.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ func (y *Yobit) SetDefaults() {
|
|||||||
y.ConfigCurrencyPairFormat.Delimiter = "_"
|
y.ConfigCurrencyPairFormat.Delimiter = "_"
|
||||||
y.ConfigCurrencyPairFormat.Uppercase = true
|
y.ConfigCurrencyPairFormat.Uppercase = true
|
||||||
y.AssetTypes = []string{ticker.Spot}
|
y.AssetTypes = []string{ticker.Spot}
|
||||||
|
y.SupportsAutoPairUpdating = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup sets exchange configuration parameters for Yobit
|
// Setup sets exchange configuration parameters for Yobit
|
||||||
@@ -82,6 +83,10 @@ func (y *Yobit) Setup(exch config.ExchangeConfig) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
err = y.SetAutoPairDefaults()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
59
testdata/configtest.json
vendored
59
testdata/configtest.json
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user