mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 23:16:51 +00:00
Add generalised functions for handling exchange enabled and available currencies
This commit is contained in:
@@ -31,6 +31,10 @@ func (i *ItBit) SetDefaults() {
|
||||
i.Verbose = false
|
||||
i.Websocket = false
|
||||
i.RESTPollingDelay = 10
|
||||
i.RequestCurrencyPairFormat.Delimiter = ""
|
||||
i.RequestCurrencyPairFormat.Uppercase = true
|
||||
i.ConfigCurrencyPairFormat.Delimiter = ""
|
||||
i.ConfigCurrencyPairFormat.Uppercase = true
|
||||
}
|
||||
|
||||
func (i *ItBit) Setup(exch config.ExchangeConfig) {
|
||||
@@ -46,6 +50,10 @@ func (i *ItBit) Setup(exch config.ExchangeConfig) {
|
||||
i.BaseCurrencies = common.SplitStrings(exch.BaseCurrencies, ",")
|
||||
i.AvailablePairs = common.SplitStrings(exch.AvailablePairs, ",")
|
||||
i.EnabledPairs = common.SplitStrings(exch.EnabledPairs, ",")
|
||||
err := i.SetCurrencyPairFormat()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ func (i *ItBit) Run() {
|
||||
}
|
||||
|
||||
for i.Enabled {
|
||||
for _, x := range i.EnabledPairs {
|
||||
currency := pair.NewCurrencyPair(x[0:3], x[3:])
|
||||
pairs := i.GetEnabledCurrencies()
|
||||
for x := range pairs {
|
||||
currency := pairs[x]
|
||||
go func() {
|
||||
ticker, err := i.GetTickerPrice(currency)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user