mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 23:16:52 +00:00
Add Bitstamp dynamic currency updater
This commit is contained in:
@@ -3,6 +3,7 @@ package bitstamp
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
@@ -27,6 +28,24 @@ func (b *Bitstamp) Run() {
|
||||
if b.Websocket {
|
||||
go b.PusherClient()
|
||||
}
|
||||
|
||||
pairs, err := b.GetTradingPairs()
|
||||
if err != nil {
|
||||
log.Printf("%s failed to get trading pairs. Err: %s", b.Name, err)
|
||||
} else {
|
||||
var currencies []string
|
||||
for x := range pairs {
|
||||
if pairs[x].Trading != "Enabled" {
|
||||
continue
|
||||
}
|
||||
pair := strings.Split(pairs[x].Name, "/")
|
||||
currencies = append(currencies, pair[0]+pair[1])
|
||||
}
|
||||
err = b.UpdateAvailableCurrencies(currencies, false)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to update available currencies.\n", b.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
|
||||
Reference in New Issue
Block a user