mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 15:10:54 +00:00
Asset update to fix minor stutter (#316)
This commit is contained in:
committed by
Adrian Gallagher
parent
b901c4b670
commit
20c24601fb
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/assets"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/asset"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/request"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
@@ -50,8 +50,8 @@ func (b *Bittrex) SetDefaults() {
|
||||
b.API.CredentialsValidator.RequiresSecret = true
|
||||
|
||||
b.CurrencyPairs = currency.PairsManager{
|
||||
AssetTypes: assets.AssetTypes{
|
||||
assets.AssetTypeSpot,
|
||||
AssetTypes: asset.Items{
|
||||
asset.Spot,
|
||||
},
|
||||
UseGlobalFormat: true,
|
||||
RequestFormat: ¤cy.PairFormat{
|
||||
@@ -115,13 +115,13 @@ func (b *Bittrex) Run() {
|
||||
}
|
||||
|
||||
forceUpdate := false
|
||||
if !common.StringDataContains(b.GetEnabledPairs(assets.AssetTypeSpot).Strings(), "-") ||
|
||||
!common.StringDataContains(b.GetAvailablePairs(assets.AssetTypeSpot).Strings(), "-") {
|
||||
if !common.StringDataContains(b.GetEnabledPairs(asset.Spot).Strings(), "-") ||
|
||||
!common.StringDataContains(b.GetAvailablePairs(asset.Spot).Strings(), "-") {
|
||||
forceUpdate = true
|
||||
enabledPairs := []string{"USDT-BTC"}
|
||||
log.Warn("WARNING: Available pairs for Bittrex reset due to config upgrade, please enable the ones you would like again")
|
||||
|
||||
err := b.UpdatePairs(currency.NewPairsFromStrings(enabledPairs), assets.AssetTypeSpot, true, true)
|
||||
err := b.UpdatePairs(currency.NewPairsFromStrings(enabledPairs), asset.Spot, true, true)
|
||||
if err != nil {
|
||||
log.Errorf("%s failed to update currencies. Err: %s\n", b.Name, err)
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func (b *Bittrex) Run() {
|
||||
}
|
||||
|
||||
// FetchTradablePairs returns a list of the exchanges tradable pairs
|
||||
func (b *Bittrex) FetchTradablePairs(asset assets.AssetType) ([]string, error) {
|
||||
func (b *Bittrex) FetchTradablePairs(asset asset.Item) ([]string, error) {
|
||||
markets, err := b.GetMarkets()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -158,12 +158,12 @@ func (b *Bittrex) FetchTradablePairs(asset assets.AssetType) ([]string, error) {
|
||||
// UpdateTradablePairs updates the exchanges available pairs and stores
|
||||
// them in the exchanges config
|
||||
func (b *Bittrex) UpdateTradablePairs(forceUpdate bool) error {
|
||||
pairs, err := b.FetchTradablePairs(assets.AssetTypeSpot)
|
||||
pairs, err := b.FetchTradablePairs(asset.Spot)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return b.UpdatePairs(currency.NewPairsFromStrings(pairs), assets.AssetTypeSpot, false, forceUpdate)
|
||||
return b.UpdatePairs(currency.NewPairsFromStrings(pairs), asset.Spot, false, forceUpdate)
|
||||
}
|
||||
|
||||
// GetAccountInfo Retrieves balances for all enabled currencies for the
|
||||
@@ -193,7 +193,7 @@ func (b *Bittrex) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func (b *Bittrex) UpdateTicker(p currency.Pair, assetType assets.AssetType) (ticker.Price, error) {
|
||||
func (b *Bittrex) UpdateTicker(p currency.Pair, assetType asset.Item) (ticker.Price, error) {
|
||||
var tickerPrice ticker.Price
|
||||
tick, err := b.GetMarketSummaries()
|
||||
if err != nil {
|
||||
@@ -220,7 +220,7 @@ func (b *Bittrex) UpdateTicker(p currency.Pair, assetType assets.AssetType) (tic
|
||||
}
|
||||
|
||||
// FetchTicker returns the ticker for a currency pair
|
||||
func (b *Bittrex) FetchTicker(p currency.Pair, assetType assets.AssetType) (ticker.Price, error) {
|
||||
func (b *Bittrex) FetchTicker(p currency.Pair, assetType asset.Item) (ticker.Price, error) {
|
||||
tick, err := ticker.GetTicker(b.GetName(), p, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateTicker(p, assetType)
|
||||
@@ -229,7 +229,7 @@ func (b *Bittrex) FetchTicker(p currency.Pair, assetType assets.AssetType) (tick
|
||||
}
|
||||
|
||||
// FetchOrderbook returns the orderbook for a currency pair
|
||||
func (b *Bittrex) FetchOrderbook(p currency.Pair, assetType assets.AssetType) (orderbook.Base, error) {
|
||||
func (b *Bittrex) FetchOrderbook(p currency.Pair, assetType asset.Item) (orderbook.Base, error) {
|
||||
ob, err := orderbook.Get(b.GetName(), p, assetType)
|
||||
if err != nil {
|
||||
return b.UpdateOrderbook(p, assetType)
|
||||
@@ -238,7 +238,7 @@ func (b *Bittrex) FetchOrderbook(p currency.Pair, assetType assets.AssetType) (o
|
||||
}
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func (b *Bittrex) UpdateOrderbook(p currency.Pair, assetType assets.AssetType) (orderbook.Base, error) {
|
||||
func (b *Bittrex) UpdateOrderbook(p currency.Pair, assetType asset.Item) (orderbook.Base, error) {
|
||||
var orderBook orderbook.Base
|
||||
orderbookNew, err := b.GetOrderbook(b.FormatExchangeCurrency(p, assetType).String())
|
||||
if err != nil {
|
||||
@@ -283,7 +283,7 @@ func (b *Bittrex) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
func (b *Bittrex) GetExchangeHistory(p currency.Pair, assetType assets.AssetType) ([]exchange.TradeHistory, error) {
|
||||
func (b *Bittrex) GetExchangeHistory(p currency.Pair, assetType asset.Item) ([]exchange.TradeHistory, error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ func (b *Bittrex) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) (
|
||||
}
|
||||
|
||||
pair := currency.NewPairDelimiter(resp.Result[i].Exchange,
|
||||
b.CurrencyPairs.Get(assets.AssetTypeSpot).ConfigFormat.Delimiter)
|
||||
b.CurrencyPairs.Get(asset.Spot).ConfigFormat.Delimiter)
|
||||
orderType := exchange.OrderType(strings.ToUpper(resp.Result[i].Type))
|
||||
|
||||
orders = append(orders, exchange.OrderDetail{
|
||||
@@ -473,7 +473,7 @@ func (b *Bittrex) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) (
|
||||
}
|
||||
|
||||
pair := currency.NewPairDelimiter(resp.Result[i].Exchange,
|
||||
b.CurrencyPairs.Get(assets.AssetTypeSpot).ConfigFormat.Delimiter)
|
||||
b.CurrencyPairs.Get(asset.Spot).ConfigFormat.Delimiter)
|
||||
orderType := exchange.OrderType(strings.ToUpper(resp.Result[i].Type))
|
||||
|
||||
orders = append(orders, exchange.OrderDetail{
|
||||
|
||||
Reference in New Issue
Block a user