mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-29 15:10:37 +00:00
kraken: when fetching tradable pairs filter by status (#1183)
* kraken: when fetching tradable pairs filter by status * linter/nits: fixed --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -90,7 +90,7 @@ func (k *Kraken) GetAssets(ctx context.Context) (map[string]*Asset, error) {
|
||||
|
||||
// GetAssetPairs returns a full asset pair list
|
||||
// Parameter 'info' only supports 4 strings: "fees", "leverage", "margin", "info" <- (default)
|
||||
func (k *Kraken) GetAssetPairs(ctx context.Context, assetPairs []string, info string) (map[string]AssetPairs, error) {
|
||||
func (k *Kraken) GetAssetPairs(ctx context.Context, assetPairs []string, info string) (map[string]*AssetPairs, error) {
|
||||
path := fmt.Sprintf("/%s/public/%s", krakenAPIVersion, krakenAssetPairs)
|
||||
params := url.Values{}
|
||||
var assets string
|
||||
@@ -99,8 +99,8 @@ func (k *Kraken) GetAssetPairs(ctx context.Context, assetPairs []string, info st
|
||||
params.Set("pair", assets)
|
||||
}
|
||||
var response struct {
|
||||
Error []string `json:"error"`
|
||||
Result map[string]AssetPairs `json:"result"`
|
||||
Error []string `json:"error"`
|
||||
Result map[string]*AssetPairs `json:"result"`
|
||||
}
|
||||
if info != "" {
|
||||
if info != "margin" && info != "leverage" && info != "fees" && info != "info" {
|
||||
|
||||
@@ -121,6 +121,7 @@ type AssetPairs struct {
|
||||
MarginCall int `json:"margin_call"`
|
||||
MarginStop int `json:"margin_stop"`
|
||||
Ordermin string `json:"ordermin"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// Ticker is a standard ticker type
|
||||
|
||||
@@ -357,24 +357,24 @@ func (k *Kraken) FetchTradablePairs(ctx context.Context, a asset.Item) (currency
|
||||
}
|
||||
|
||||
pairs = make([]currency.Pair, 0, len(symbols))
|
||||
for i := range symbols {
|
||||
if strings.Contains(symbols[i].Altname, ".d") {
|
||||
for _, info := range symbols {
|
||||
if info.Status != "online" {
|
||||
continue
|
||||
}
|
||||
base := assetTranslator.LookupAltname(symbols[i].Base)
|
||||
base := assetTranslator.LookupAltname(info.Base)
|
||||
if base == "" {
|
||||
log.Warnf(log.ExchangeSys,
|
||||
"%s unable to lookup altname for base currency %s",
|
||||
k.Name,
|
||||
symbols[i].Base)
|
||||
info.Base)
|
||||
continue
|
||||
}
|
||||
quote := assetTranslator.LookupAltname(symbols[i].Quote)
|
||||
quote := assetTranslator.LookupAltname(info.Quote)
|
||||
if quote == "" {
|
||||
log.Warnf(log.ExchangeSys,
|
||||
"%s unable to lookup altname for quote currency %s",
|
||||
k.Name,
|
||||
symbols[i].Quote)
|
||||
info.Quote)
|
||||
continue
|
||||
}
|
||||
pair, err = currency.NewPairFromStrings(base, quote)
|
||||
|
||||
Reference in New Issue
Block a user