mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 15:10:59 +00:00
Add generalised functions for handling exchange enabled and available currencies
This commit is contained in:
@@ -45,6 +45,10 @@ func (g *Gemini) SetDefaults() {
|
||||
g.Verbose = false
|
||||
g.Websocket = false
|
||||
g.RESTPollingDelay = 10
|
||||
g.RequestCurrencyPairFormat.Delimiter = ""
|
||||
g.RequestCurrencyPairFormat.Uppercase = true
|
||||
g.ConfigCurrencyPairFormat.Delimiter = ""
|
||||
g.ConfigCurrencyPairFormat.Uppercase = true
|
||||
}
|
||||
|
||||
func (g *Gemini) Setup(exch config.ExchangeConfig) {
|
||||
@@ -60,6 +64,10 @@ func (g *Gemini) Setup(exch config.ExchangeConfig) {
|
||||
g.BaseCurrencies = common.SplitStrings(exch.BaseCurrencies, ",")
|
||||
g.AvailablePairs = common.SplitStrings(exch.AvailablePairs, ",")
|
||||
g.EnabledPairs = common.SplitStrings(exch.EnabledPairs, ",")
|
||||
err := g.SetCurrencyPairFormat()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,15 +26,16 @@ func (g *Gemini) Run() {
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to get available symbols.\n", g.GetName())
|
||||
} else {
|
||||
err = g.UpdateAvailableCurrencies(exchangeProducts)
|
||||
err = g.UpdateAvailableCurrencies(exchangeProducts, false)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to get config.\n", g.GetName())
|
||||
}
|
||||
}
|
||||
|
||||
for g.Enabled {
|
||||
for _, x := range g.EnabledPairs {
|
||||
currency := pair.NewCurrencyPair(x[0:3], x[3:])
|
||||
pairs := g.GetEnabledCurrencies()
|
||||
for x := range pairs {
|
||||
currency := pairs[x]
|
||||
go func() {
|
||||
ticker, err := g.GetTickerPrice(currency)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user