Periodic available pairs update for manual exchanges

This commit is contained in:
Adrian Gallagher
2018-10-11 15:47:12 +11:00
parent 9b85b431ab
commit be561dd077
7 changed files with 68 additions and 52 deletions

View File

@@ -16,6 +16,7 @@ import (
"github.com/thrasher-/gocryptotrader/config"
exchange "github.com/thrasher-/gocryptotrader/exchanges"
"github.com/thrasher-/gocryptotrader/exchanges/request"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
)
const (
@@ -114,6 +115,7 @@ func (o *OKEX) SetDefaults() {
common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
o.APIUrlDefault = apiURL
o.APIUrl = o.APIUrlDefault
o.AssetTypes = []string{ticker.Spot}
}
// Setup method sets current configuration details if enabled

View File

@@ -40,10 +40,6 @@ func (o *OKEX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price
var tickerPrice ticker.Price
if assetType != ticker.Spot {
if p.SecondCurrency.String() == common.StringToLower("USDT") {
p.SecondCurrency = "usd"
currency = exchange.FormatExchangeCurrency(o.Name, p).String()
}
tick, err := o.GetContractPrice(currency, assetType)
if err != nil {
return tickerPrice, err
@@ -58,11 +54,6 @@ func (o *OKEX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price
tickerPrice.High = tick.Ticker.High
ticker.ProcessTicker(o.GetName(), p, tickerPrice, assetType)
} else {
if p.SecondCurrency.String() == common.StringToLower("USD") {
p.SecondCurrency = "usdt"
currency = exchange.FormatExchangeCurrency(o.Name, p).String()
}
tick, err := o.GetSpotTicker(currency)
if err != nil {
return tickerPrice, err
@@ -104,10 +95,6 @@ func (o *OKEX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook
currency := exchange.FormatExchangeCurrency(o.Name, p).String()
if assetType != ticker.Spot {
if p.SecondCurrency.String() == common.StringToLower("USDT") {
p.SecondCurrency = "usd"
currency = exchange.FormatExchangeCurrency(o.Name, p).String()
}
orderbookNew, err := o.GetContractMarketDepth(currency, assetType)
if err != nil {
return orderBook, err
@@ -124,11 +111,6 @@ func (o *OKEX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook
}
} else {
if p.SecondCurrency.String() == common.StringToLower("USD") {
p.SecondCurrency = "usdt"
currency = exchange.FormatExchangeCurrency(o.Name, p).String()
}
orderbookNew, err := o.GetSpotMarketDepth(ActualSpotDepthRequestParams{
Symbol: currency,
Size: 200,