mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 07:26:48 +00:00
Add method to fetch available currencies from Poloniex, fix available currency bug in poloniex and update config_example.json
This commit is contained in:
@@ -221,6 +221,22 @@ func (p *Poloniex) GetCurrencies() (map[string]PoloniexCurrencies, error) {
|
||||
return resp.Data, common.SendHTTPGetRequest(path, true, p.Verbose, &resp.Data)
|
||||
}
|
||||
|
||||
// GetExchangeCurrencies returns a list of currencies using the GetTicker API
|
||||
// as the GetExchangeCurrencies information doesn't return currency pair information
|
||||
func (p *Poloniex) GetExchangeCurrencies() ([]string, error) {
|
||||
response, err := p.GetTicker()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var currencies []string
|
||||
for x := range response {
|
||||
currencies = append(currencies, x)
|
||||
}
|
||||
|
||||
return currencies, nil
|
||||
}
|
||||
|
||||
// GetLoanOrders returns the list of loan offers and demands for a given
|
||||
// currency, specified by the "currency" GET parameter.
|
||||
func (p *Poloniex) GetLoanOrders(currency string) (PoloniexLoanOrders, error) {
|
||||
|
||||
@@ -26,6 +26,22 @@ func (p *Poloniex) Run() {
|
||||
if p.Websocket {
|
||||
go p.WebsocketClient()
|
||||
}
|
||||
|
||||
exchangeCurrencies, err := p.GetExchangeCurrencies()
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to get available symbols.\n", p.GetName())
|
||||
} else {
|
||||
forceUpdate := false
|
||||
if common.DataContains(p.AvailablePairs, "BTC_USDT") {
|
||||
log.Printf("%s contains invalid pair, forcing upgrade of available currencies.\n",
|
||||
p.GetName())
|
||||
forceUpdate = true
|
||||
}
|
||||
err = p.UpdateAvailableCurrencies(exchangeCurrencies, forceUpdate)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to update available currencies %s.\n", p.GetName(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
|
||||
Reference in New Issue
Block a user