mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 15:11:07 +00:00
Expand RetrieveConfigCurrencyPairs to support different asset types
This commit is contained in:
@@ -1214,7 +1214,7 @@ func (c *Config) CheckCurrencyConfigValues() error {
|
||||
|
||||
// RetrieveConfigCurrencyPairs splits, assigns and verifies enabled currency
|
||||
// pairs either cryptoCurrencies or fiatCurrencies
|
||||
func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool) error {
|
||||
func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool, assetType asset.Item) error {
|
||||
cryptoCurrencies := c.Currency.Cryptocurrencies
|
||||
fiatCurrencies := currency.GetFiatCurrencies()
|
||||
|
||||
@@ -1223,6 +1223,11 @@ func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool) error {
|
||||
continue
|
||||
}
|
||||
|
||||
supports, _ := c.SupportsExchangeAssetType(c.Exchanges[x].Name, assetType)
|
||||
if !supports {
|
||||
continue
|
||||
}
|
||||
|
||||
baseCurrencies := c.Exchanges[x].BaseCurrencies
|
||||
for y := range baseCurrencies {
|
||||
if !fiatCurrencies.Contains(baseCurrencies[y]) {
|
||||
@@ -1232,12 +1237,17 @@ func (c *Config) RetrieveConfigCurrencyPairs(enabledOnly bool) error {
|
||||
}
|
||||
|
||||
for x := range c.Exchanges {
|
||||
supports, _ := c.SupportsExchangeAssetType(c.Exchanges[x].Name, assetType)
|
||||
if !supports {
|
||||
continue
|
||||
}
|
||||
|
||||
var pairs []currency.Pair
|
||||
var err error
|
||||
if !c.Exchanges[x].Enabled && enabledOnly {
|
||||
pairs, err = c.GetEnabledPairs(c.Exchanges[x].Name, asset.Spot)
|
||||
pairs, err = c.GetEnabledPairs(c.Exchanges[x].Name, assetType)
|
||||
} else {
|
||||
pairs, err = c.GetAvailablePairs(c.Exchanges[x].Name, asset.Spot)
|
||||
pairs, err = c.GetAvailablePairs(c.Exchanges[x].Name, assetType)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user