mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 15:10:15 +00:00
Subscriptions: Add List.Public, List.Enabled and List.Private (#1629)
This commit is contained in:
@@ -113,3 +113,36 @@ func (l List) assetPairs(e iExchange) (assetPairs, error) {
|
||||
}
|
||||
return ap, nil
|
||||
}
|
||||
|
||||
// Enabled returns a new list of only enabled subscriptions
|
||||
func (l List) Enabled() List {
|
||||
n := make(List, 0, len(l))
|
||||
for _, s := range l {
|
||||
if s.Enabled {
|
||||
n = append(n, s)
|
||||
}
|
||||
}
|
||||
return slices.Clip(n)
|
||||
}
|
||||
|
||||
// Private returns only subscriptions which require authentication
|
||||
func (l List) Private() List {
|
||||
n := List{}
|
||||
for _, s := range l {
|
||||
if s.Authenticated {
|
||||
n = append(n, s)
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// Public returns only subscriptions which do not require authentication
|
||||
func (l List) Public() List {
|
||||
n := List{}
|
||||
for _, s := range l {
|
||||
if !s.Authenticated {
|
||||
n = append(n, s)
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user