mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
poloniex: filter non-liquid and unused assets (#1185)
* poloniex: filter non-liquid and unused assets * glorious: nits --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -99,7 +99,6 @@ func (l *Lbank) SetDefaults() {
|
||||
kline.IntervalCapacity{Interval: kline.ThirtyMin},
|
||||
kline.IntervalCapacity{Interval: kline.OneHour},
|
||||
kline.IntervalCapacity{Interval: kline.FourHour},
|
||||
|
||||
// NOTE: The supported time intervals below are returned
|
||||
// offset to the Asia/HongKong time zone. This may lead to
|
||||
// issues with candle quality and conversion as the
|
||||
|
||||
@@ -1061,3 +1061,11 @@ func TestGetAvailableTransferChains(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFetchTradablePairs(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := p.FetchTradablePairs(context.Background(), asset.Spot)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,21 +265,25 @@ func (p *Poloniex) Run(ctx context.Context) {
|
||||
|
||||
// FetchTradablePairs returns a list of the exchanges tradable pairs
|
||||
func (p *Poloniex) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error) {
|
||||
// TODO: Upgrade to new API version for fetching operational pairs.
|
||||
resp, err := p.GetTicker(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pairs := make([]currency.Pair, len(resp))
|
||||
var target int
|
||||
for key := range resp {
|
||||
pairs := make([]currency.Pair, 0, len(resp))
|
||||
for key, info := range resp {
|
||||
// Poloniex returns 0 for highest bid and lowest ask if support has been
|
||||
// dropped from the front end. We don't want to add these pairs.
|
||||
if info.HighestBid == 0 || info.LowestAsk == 0 {
|
||||
continue
|
||||
}
|
||||
var pair currency.Pair
|
||||
pair, err = currency.NewPairFromString(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pairs[target] = pair
|
||||
target++
|
||||
pairs = append(pairs, pair)
|
||||
}
|
||||
return pairs, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user