exchanges: Change wrapper function FetchTradablePairs to return currency.Pairs (#1093)

* exchanges: FetchTradablePairs currency pair slice return (1)

* exchanges: finish conversion

* thrasher: nits + linter

* exchanges: shift var dec into for loop

* exchanges: Apply changes thanks @thrasher-

* Update exchanges/alphapoint/alphapoint_wrapper.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* thrasher: nitters

* Update exchanges/bitflyer/bitflyer_wrapper.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* thrasher: fix more nitters

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
Ryan O'Hara-Reid
2022-12-09 15:40:34 +11:00
committed by GitHub
parent 2ac165a477
commit e4d487e586
43 changed files with 488 additions and 579 deletions

View File

@@ -230,17 +230,22 @@ func (b *Bithumb) Run() {
}
// FetchTradablePairs returns a list of the exchanges tradable pairs
func (b *Bithumb) FetchTradablePairs(ctx context.Context, asset asset.Item) ([]string, error) {
func (b *Bithumb) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error) {
currencies, err := b.GetTradablePairs(ctx)
if err != nil {
return nil, err
}
pairs := make([]currency.Pair, len(currencies))
for x := range currencies {
currencies[x] += currency.DashDelimiter + "KRW"
var pair currency.Pair
pair, err = currency.NewPairFromStrings(currencies[x], "KRW")
if err != nil {
return nil, err
}
pairs[x] = pair
}
return currencies, nil
return pairs, nil
}
// UpdateTradablePairs updates the exchanges available pairs and stores
@@ -250,13 +255,7 @@ func (b *Bithumb) UpdateTradablePairs(ctx context.Context, forceUpdate bool) err
if err != nil {
return err
}
p, err := currency.NewPairsFromStrings(pairs)
if err != nil {
return err
}
return b.UpdatePairs(p, asset.Spot, false, forceUpdate)
return b.UpdatePairs(pairs, asset.Spot, false, forceUpdate)
}
// UpdateTickers updates the ticker for all currency pairs of a given asset type