Asset update to fix minor stutter (#316)

This commit is contained in:
Ryan O'Hara-Reid
2019-06-17 09:02:07 +10:00
committed by Adrian Gallagher
parent b901c4b670
commit 20c24601fb
87 changed files with 976 additions and 966 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/thrasher-/gocryptotrader/communications/base"
"github.com/thrasher-/gocryptotrader/config"
"github.com/thrasher-/gocryptotrader/currency"
"github.com/thrasher-/gocryptotrader/exchanges/assets"
"github.com/thrasher-/gocryptotrader/exchanges/asset"
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
log "github.com/thrasher-/gocryptotrader/logger"
@@ -61,7 +61,7 @@ type Event struct {
Item string
Condition EventConditionParams
Pair currency.Pair
Asset assets.AssetType
Asset asset.Item
Action string
Executed bool
}
@@ -72,7 +72,7 @@ var Events []*Event
// Add adds an event to the Events chain and returns an index/eventID
// and an error
func Add(exchange, item string, condition EventConditionParams, currencyPair currency.Pair, asset assets.AssetType, action string) (int64, error) {
func Add(exchange, item string, condition EventConditionParams, currencyPair currency.Pair, asset asset.Item, action string) (int64, error) {
err := IsValidEvent(exchange, item, condition, action)
if err != nil {
return 0, err

View File

@@ -4,7 +4,7 @@ import (
"testing"
"github.com/thrasher-/gocryptotrader/currency"
"github.com/thrasher-/gocryptotrader/exchanges/assets"
"github.com/thrasher-/gocryptotrader/exchanges/asset"
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
)
@@ -22,7 +22,7 @@ func addValidEvent() (int64, error) {
ItemPrice,
EventConditionParams{Condition: ConditionGreaterThan, Price: 1},
currency.NewPair(currency.BTC, currency.USD),
assets.AssetTypeSpot,
asset.Spot,
"SMS,test")
}
@@ -124,7 +124,7 @@ func TestString(t *testing.T) {
Price: 1,
},
Pair: currency.NewPair(currency.BTC, currency.USD),
Asset: assets.AssetTypeSpot,
Asset: asset.Spot,
Action: "SMS,ALL",
}
@@ -142,7 +142,7 @@ func TestProcessTicker(t *testing.T) {
e := Event{
Exchange: testExchange,
Pair: currency.NewPair(currency.BTC, currency.USD),
Asset: assets.AssetTypeSpot,
Asset: asset.Spot,
Condition: EventConditionParams{
Condition: ConditionGreaterThan,
Price: 1,
@@ -214,7 +214,7 @@ func TestProcessOrderbook(t *testing.T) {
e := Event{
Exchange: testExchange,
Pair: currency.NewPair(currency.BTC, currency.USD),
Asset: assets.AssetTypeSpot,
Asset: asset.Spot,
Condition: EventConditionParams{
Condition: ConditionGreaterThan,
CheckBidsAndAsks: true,

View File

@@ -20,7 +20,7 @@ import (
"github.com/thrasher-/gocryptotrader/common"
"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/stats"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
@@ -179,7 +179,7 @@ func GetAvailableExchanges() []string {
// GetAllAvailablePairs returns a list of all available pairs on either enabled
// or disabled exchanges
func GetAllAvailablePairs(enabledExchangesOnly bool, assetType assets.AssetType) currency.Pairs {
func GetAllAvailablePairs(enabledExchangesOnly bool, assetType asset.Item) currency.Pairs {
var pairList currency.Pairs
for x := range Bot.Config.Exchanges {
if enabledExchangesOnly && !Bot.Config.Exchanges[x].Enabled {
@@ -204,7 +204,7 @@ func GetAllAvailablePairs(enabledExchangesOnly bool, assetType assets.AssetType)
// GetSpecificAvailablePairs returns a list of supported pairs based on specific
// parameters
func GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, assetType assets.AssetType) currency.Pairs {
func GetSpecificAvailablePairs(enabledExchangesOnly, fiatPairs, includeUSDT, cryptoPairs bool, assetType asset.Item) currency.Pairs {
var pairList currency.Pairs
supportedPairs := GetAllAvailablePairs(enabledExchangesOnly, assetType)
@@ -251,7 +251,7 @@ func IsRelatablePairs(p1, p2 currency.Pair, includeUSDT bool) bool {
// MapCurrenciesByExchange returns a list of currency pairs mapped to an
// exchange
func MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetType assets.AssetType) map[string]currency.Pairs {
func MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetType asset.Item) map[string]currency.Pairs {
currencyExchange := make(map[string]currency.Pairs)
for x := range p {
for y := range Bot.Config.Exchanges {
@@ -283,7 +283,7 @@ func MapCurrenciesByExchange(p currency.Pairs, enabledExchangesOnly bool, assetT
// GetExchangeNamesByCurrency returns a list of exchanges supporting
// a currency pair based on whether the exchange is enabled or not
func GetExchangeNamesByCurrency(p currency.Pair, enabled bool, assetType assets.AssetType) []string {
func GetExchangeNamesByCurrency(p currency.Pair, enabled bool, assetType asset.Item) []string {
var exchanges []string
for x := range Bot.Config.Exchanges {
if enabled != Bot.Config.Exchanges[x].Enabled {
@@ -400,7 +400,7 @@ func GetRelatableCurrencies(p currency.Pair, incOrig, incUSDT bool) currency.Pai
// GetSpecificOrderbook returns a specific orderbook given the currency,
// exchangeName and assetType
func GetSpecificOrderbook(p currency.Pair, exchangeName string, assetType assets.AssetType) (orderbook.Base, error) {
func GetSpecificOrderbook(p currency.Pair, exchangeName string, assetType asset.Item) (orderbook.Base, error) {
var specificOrderbook orderbook.Base
var err error
for x := range Bot.Exchanges {
@@ -419,7 +419,7 @@ func GetSpecificOrderbook(p currency.Pair, exchangeName string, assetType assets
// GetSpecificTicker returns a specific ticker given the currency,
// exchangeName and assetType
func GetSpecificTicker(p currency.Pair, exchangeName string, assetType assets.AssetType) (ticker.Price, error) {
func GetSpecificTicker(p currency.Pair, exchangeName string, assetType asset.Item) (ticker.Price, error) {
var specificTicker ticker.Price
var err error
for x := range Bot.Exchanges {
@@ -475,7 +475,7 @@ func GetAccountCurrencyInfoByExchangeName(accounts []exchange.AccountInfo, excha
// GetExchangeHighestPriceByCurrencyPair returns the exchange with the highest
// price for a given currency pair and asset type
func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, assetType assets.AssetType) (string, error) {
func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error) {
result := stats.SortExchangesByPrice(p, assetType, true)
if len(result) == 0 {
return "", fmt.Errorf("no stats for supplied currency pair and asset type")
@@ -486,7 +486,7 @@ func GetExchangeHighestPriceByCurrencyPair(p currency.Pair, assetType assets.Ass
// GetExchangeLowestPriceByCurrencyPair returns the exchange with the lowest
// price for a given currency pair and asset type
func GetExchangeLowestPriceByCurrencyPair(p currency.Pair, assetType assets.AssetType) (string, error) {
func GetExchangeLowestPriceByCurrencyPair(p currency.Pair, assetType asset.Item) (string, error) {
result := stats.SortExchangesByPrice(p, assetType, false)
if len(result) == 0 {
return "", fmt.Errorf("no stats for supplied currency pair and asset type")
@@ -586,7 +586,7 @@ func SeedExchangeAccountInfo(data []exchange.AccountInfo) {
}
// GetCryptocurrenciesByExchange returns a list of cryptocurrencies the exchange supports
func GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, assetType assets.AssetType) ([]string, error) {
func GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, enabledPairs bool, assetType asset.Item) ([]string, error) {
var cryptocurrencies []string
for x := range Bot.Config.Exchanges {
if Bot.Config.Exchanges[x].Name != exchangeName {
@@ -656,7 +656,7 @@ func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string {
continue
}
cryptoCurrencies, err := GetCryptocurrenciesByExchange(exchName, true, true, assets.AssetTypeSpot)
cryptoCurrencies, err := GetCryptocurrenciesByExchange(exchName, true, true, asset.Spot)
if err != nil {
log.Debugf("%s failed to get cryptocurrency deposit addresses. Err: %s", exchName, err)
continue

View File

@@ -8,7 +8,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/stats"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
@@ -151,7 +151,7 @@ func TestGetAvailableExchanges(t *testing.T) {
func TestGetSpecificAvailablePairs(t *testing.T) {
SetupTestHelpers(t)
assetType := assets.AssetTypeSpot
assetType := asset.Spot
result := GetSpecificAvailablePairs(true, true, true, false, assetType)
if !result.Contains(currency.NewPairFromStrings("BTC", "USD"), true) {
@@ -341,7 +341,7 @@ func TestMapCurrenciesByExchange(t *testing.T) {
currency.NewPair(currency.BTC, currency.EUR),
}
result := MapCurrenciesByExchange(pairs, true, assets.AssetTypeSpot)
result := MapCurrenciesByExchange(pairs, true, asset.Spot)
pairs, ok := result["Bitstamp"]
if !ok {
t.Fatal("Unexpected result")
@@ -354,19 +354,25 @@ func TestMapCurrenciesByExchange(t *testing.T) {
func TestGetExchangeNamesByCurrency(t *testing.T) {
SetupTestHelpers(t)
assetType := assets.AssetTypeSpot
assetType := asset.Spot
result := GetExchangeNamesByCurrency(currency.NewPairFromStrings("BTC", "USD"), true, assetType)
result := GetExchangeNamesByCurrency(currency.NewPairFromStrings("BTC", "USD"),
true,
assetType)
if !common.StringDataCompare(result, "Bitstamp") {
t.Fatal("Unexpected result")
}
result = GetExchangeNamesByCurrency(currency.NewPairFromStrings("BTC", "JPY"), true, assetType)
result = GetExchangeNamesByCurrency(currency.NewPairFromStrings("BTC", "JPY"),
true,
assetType)
if !common.StringDataCompare(result, "Bitflyer") {
t.Fatal("Unexpected result")
}
result = GetExchangeNamesByCurrency(currency.NewPairFromStrings("blah", "JPY"), true, assetType)
result = GetExchangeNamesByCurrency(currency.NewPairFromStrings("blah", "JPY"),
true,
assetType)
if len(result) > 0 {
t.Fatal("Unexpected result")
}
@@ -379,13 +385,12 @@ func TestGetSpecificOrderbook(t *testing.T) {
var bids []orderbook.Item
bids = append(bids, orderbook.Item{Price: 1000, Amount: 1})
asset := assets.AssetTypeSpot
base := orderbook.Base{
Pair: currency.NewPair(currency.BTC, currency.USD),
Bids: bids,
ExchangeName: "Bitstamp",
AssetType: asset,
AssetType: asset.Spot,
}
err := base.Process()
@@ -393,7 +398,9 @@ func TestGetSpecificOrderbook(t *testing.T) {
t.Fatal("Unexpected result", err)
}
ob, err := GetSpecificOrderbook(currency.NewPairFromString("BTCUSD"), "Bitstamp", assets.AssetTypeSpot)
ob, err := GetSpecificOrderbook(currency.NewPairFromString("BTCUSD"),
"Bitstamp",
asset.Spot)
if err != nil {
t.Fatal(err)
}
@@ -402,7 +409,9 @@ func TestGetSpecificOrderbook(t *testing.T) {
t.Fatal("Unexpected result")
}
ob, err = GetSpecificOrderbook(currency.NewPairFromStrings("ETH", "LTC"), "Bitstamp", asset)
ob, err = GetSpecificOrderbook(currency.NewPairFromStrings("ETH", "LTC"),
"Bitstamp",
asset.Spot)
if err == nil {
t.Fatal("Unexpected result")
}
@@ -415,15 +424,15 @@ func TestGetSpecificTicker(t *testing.T) {
LoadExchange("Bitstamp", false, nil)
p := currency.NewPairFromStrings("BTC", "USD")
asset := assets.AssetTypeSpot
err := ticker.ProcessTicker("Bitstamp",
&ticker.Price{Pair: p, Last: 1000},
assets.AssetTypeSpot)
asset.Spot)
if err != nil {
t.Fatal("Test failed. ProcessTicker error", err)
}
tick, err := GetSpecificTicker(currency.NewPairFromStrings("BTC", "USD"), "Bitstamp", asset)
tick, err := GetSpecificTicker(currency.NewPairFromStrings("BTC", "USD"), "Bitstamp",
asset.Spot)
if err != nil {
t.Fatal(err)
}
@@ -432,7 +441,8 @@ func TestGetSpecificTicker(t *testing.T) {
t.Fatal("Unexpected result")
}
tick, err = GetSpecificTicker(currency.NewPairFromStrings("ETH", "LTC"), "Bitstamp", asset)
tick, err = GetSpecificTicker(currency.NewPairFromStrings("ETH", "LTC"), "Bitstamp",
asset.Spot)
if err == nil {
t.Fatal("Unexpected result")
}
@@ -532,10 +542,9 @@ func TestGetExchangeHighestPriceByCurrencyPair(t *testing.T) {
SetupTestHelpers(t)
p := currency.NewPairFromStrings("BTC", "USD")
asset := assets.AssetTypeSpot
stats.Add("Bitfinex", p, assets.AssetTypeSpot, 1000, 10000)
stats.Add("Bitstamp", p, assets.AssetTypeSpot, 1337, 10000)
exchangeName, err := GetExchangeHighestPriceByCurrencyPair(p, asset)
stats.Add("Bitfinex", p, asset.Spot, 1000, 10000)
stats.Add("Bitstamp", p, asset.Spot, 1337, 10000)
exchangeName, err := GetExchangeHighestPriceByCurrencyPair(p, asset.Spot)
if err != nil {
t.Error(err)
}
@@ -544,7 +553,8 @@ func TestGetExchangeHighestPriceByCurrencyPair(t *testing.T) {
t.Error("Unexpected result")
}
_, err = GetExchangeHighestPriceByCurrencyPair(currency.NewPairFromStrings("BTC", "AUD"), asset)
_, err = GetExchangeHighestPriceByCurrencyPair(currency.NewPairFromStrings("BTC", "AUD"),
asset.Spot)
if err == nil {
t.Error("Unexpected result")
}
@@ -554,10 +564,9 @@ func TestGetExchangeLowestPriceByCurrencyPair(t *testing.T) {
SetupTestHelpers(t)
p := currency.NewPairFromStrings("BTC", "USD")
asset := assets.AssetTypeSpot
stats.Add("Bitfinex", p, assets.AssetTypeSpot, 1000, 10000)
stats.Add("Bitstamp", p, assets.AssetTypeSpot, 1337, 10000)
exchangeName, err := GetExchangeLowestPriceByCurrencyPair(p, asset)
stats.Add("Bitfinex", p, asset.Spot, 1000, 10000)
stats.Add("Bitstamp", p, asset.Spot, 1337, 10000)
exchangeName, err := GetExchangeLowestPriceByCurrencyPair(p, asset.Spot)
if err != nil {
t.Error(err)
}
@@ -566,7 +575,8 @@ func TestGetExchangeLowestPriceByCurrencyPair(t *testing.T) {
t.Error("Unexpected result")
}
_, err = GetExchangeLowestPriceByCurrencyPair(currency.NewPairFromStrings("BTC", "AUD"), asset)
_, err = GetExchangeLowestPriceByCurrencyPair(currency.NewPairFromStrings("BTC", "AUD"),
asset.Spot)
if err == nil {
t.Error("Unexpected reuslt")
}
@@ -575,7 +585,7 @@ func TestGetExchangeLowestPriceByCurrencyPair(t *testing.T) {
func TestGetCryptocurrenciesByExchange(t *testing.T) {
SetupTestHelpers(t)
_, err := GetCryptocurrenciesByExchange("Bitfinex", false, false, assets.AssetTypeSpot)
_, err := GetCryptocurrenciesByExchange("Bitfinex", false, false, asset.Spot)
if err != nil {
t.Fatalf("Test failed. Err %s", err)
}

View File

@@ -10,7 +10,7 @@ import (
"github.com/thrasher-/gocryptotrader/common"
"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/stats"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
@@ -57,7 +57,7 @@ func printConvertCurrencyFormat(origCurrency currency.Code, origPrice float64) s
)
}
func printTickerSummary(result *ticker.Price, p currency.Pair, assetType assets.AssetType, exchangeName string, err error) {
func printTickerSummary(result *ticker.Price, p currency.Pair, assetType asset.Item, exchangeName string, err error) {
if err != nil {
log.Errorf("Failed to get %s %s ticker. Error: %s",
p.String(),
@@ -108,7 +108,7 @@ func printTickerSummary(result *ticker.Price, p currency.Pair, assetType assets.
}
}
func printOrderbookSummary(result *orderbook.Base, p currency.Pair, assetType assets.AssetType, exchangeName string, err error) {
func printOrderbookSummary(result *orderbook.Base, p currency.Pair, assetType asset.Item, exchangeName string, err error) {
if err != nil {
log.Errorf("Failed to get %s %s orderbook of type %s. Error: %s",
p,
@@ -204,7 +204,7 @@ func TickerUpdaterRoutine() {
supportsBatching := Bot.Exchanges[x].SupportsRESTTickerBatchUpdates()
assetTypes := Bot.Exchanges[x].GetAssetTypes()
processTicker := func(exch exchange.IBotExchange, update bool, c currency.Pair, assetType assets.AssetType) {
processTicker := func(exch exchange.IBotExchange, update bool, c currency.Pair, assetType asset.Item) {
var result ticker.Price
var err error
if update {
@@ -256,7 +256,7 @@ func OrderbookUpdaterRoutine() {
exchangeName := Bot.Exchanges[x].GetName()
assetTypes := Bot.Exchanges[x].GetAssetTypes()
processOrderbook := func(exch exchange.IBotExchange, c currency.Pair, assetType assets.AssetType) {
processOrderbook := func(exch exchange.IBotExchange, c currency.Pair, assetType asset.Item) {
result, err := exch.UpdateOrderbook(c, assetType)
printOrderbookSummary(&result, c, assetType, exchangeName, err)
if err == nil {

View File

@@ -16,7 +16,7 @@ import (
"github.com/thrasher-/gocryptotrader/common/crypto"
"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/gctrpc"
"github.com/thrasher-/gocryptotrader/gctrpc/auth"
log "github.com/thrasher-/gocryptotrader/logger"
@@ -281,7 +281,7 @@ func (s *RPCServer) GetTicker(ctx context.Context, r *gctrpc.GetTickerRequest) (
Quote: currency.NewCode(r.Pair.Quote),
},
r.Exchange,
assets.AssetType(r.AssetType),
asset.Item(r.AssetType),
)
if err != nil {
return nil, err
@@ -345,7 +345,7 @@ func (s *RPCServer) GetOrderbook(ctx context.Context, r *gctrpc.GetOrderbookRequ
Quote: currency.NewCode(r.Pair.Quote),
},
r.Exchange,
assets.AssetType(r.AssetType),
asset.Item(r.AssetType),
)
if err != nil {
return nil, err
@@ -622,7 +622,7 @@ func (s *RPCServer) GetOrders(ctx context.Context, r *gctrpc.GetOrdersRequest) (
Id: resp[x].ID,
BaseCurrency: resp[x].CurrencyPair.Base.String(),
QuoteCurrency: resp[x].CurrencyPair.Quote.String(),
AssetType: assets.AssetTypeSpot.String(),
AssetType: asset.Spot.String(),
OrderType: resp[x].OrderType.ToString(),
OrderSide: resp[x].OrderSide.ToString(),
CreationTime: resp[x].OrderDate.Unix(),
@@ -705,7 +705,7 @@ func (s *RPCServer) AddEvent(ctx context.Context, r *gctrpc.AddEventRequest) (*g
p := currency.NewPairWithDelimiter(r.Pair.Base,
r.Pair.Quote, r.Pair.Delimiter)
id, err := Add(r.Exchange, r.Item, evtCondition, p, assets.AssetType(r.AssetType), r.Action)
id, err := Add(r.Exchange, r.Item, evtCondition, p, asset.Item(r.AssetType), r.Action)
if err != nil {
return nil, err
}

View File

@@ -6,7 +6,7 @@ import (
"time"
"github.com/thrasher-/gocryptotrader/currency"
"github.com/thrasher-/gocryptotrader/exchanges/assets"
"github.com/thrasher-/gocryptotrader/exchanges/asset"
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
log "github.com/thrasher-/gocryptotrader/logger"
)
@@ -58,7 +58,7 @@ func NewCurrencyPairSyncer(c CurrencyPairSyncerConfig) (*ExchangeCurrencyPairSyn
return &s, nil
}
func (e *ExchangeCurrencyPairSyncer) get(exchangeName string, p currency.Pair, a assets.AssetType) (*CurrencyPairSyncAgent, error) {
func (e *ExchangeCurrencyPairSyncer) get(exchangeName string, p currency.Pair, a asset.Item) (*CurrencyPairSyncAgent, error) {
e.mux.Lock()
defer e.mux.Unlock()
@@ -73,7 +73,7 @@ func (e *ExchangeCurrencyPairSyncer) get(exchangeName string, p currency.Pair, a
return nil, errors.New("exchange currency pair syncer not found")
}
func (e *ExchangeCurrencyPairSyncer) exists(exchangeName string, p currency.Pair, a assets.AssetType) bool {
func (e *ExchangeCurrencyPairSyncer) exists(exchangeName string, p currency.Pair, a asset.Item) bool {
e.mux.Lock()
defer e.mux.Unlock()
@@ -136,7 +136,7 @@ func (e *ExchangeCurrencyPairSyncer) remove(c *CurrencyPairSyncAgent) {
}
}
func (e *ExchangeCurrencyPairSyncer) isProcessing(exchangeName string, p currency.Pair, a assets.AssetType, syncType int) bool {
func (e *ExchangeCurrencyPairSyncer) isProcessing(exchangeName string, p currency.Pair, a asset.Item, syncType int) bool {
e.mux.Lock()
defer e.mux.Unlock()
@@ -158,7 +158,7 @@ func (e *ExchangeCurrencyPairSyncer) isProcessing(exchangeName string, p currenc
return false
}
func (e *ExchangeCurrencyPairSyncer) setProcessing(exchangeName string, p currency.Pair, a assets.AssetType, syncType int, processing bool) {
func (e *ExchangeCurrencyPairSyncer) setProcessing(exchangeName string, p currency.Pair, a asset.Item, syncType int, processing bool) {
e.mux.Lock()
defer e.mux.Unlock()
@@ -178,7 +178,7 @@ func (e *ExchangeCurrencyPairSyncer) setProcessing(exchangeName string, p curren
}
}
func (e *ExchangeCurrencyPairSyncer) update(exchangeName string, p currency.Pair, a assets.AssetType, syncType int, err error) {
func (e *ExchangeCurrencyPairSyncer) update(exchangeName string, p currency.Pair, a asset.Item, syncType int, err error) {
if atomic.LoadInt32(&e.initSyncStarted) != 1 {
return
}

View File

@@ -5,7 +5,7 @@ import (
"time"
"github.com/thrasher-/gocryptotrader/currency"
"github.com/thrasher-/gocryptotrader/exchanges/assets"
"github.com/thrasher-/gocryptotrader/exchanges/asset"
)
// CurrencyPairSyncerConfig stores the currency pair config
@@ -53,7 +53,7 @@ type SyncBase struct {
type CurrencyPairSyncAgent struct {
Created time.Time
Exchange string
AssetType assets.AssetType
AssetType asset.Item
Pair currency.Pair
Ticker SyncBase
Orderbook SyncBase

View File

@@ -10,7 +10,7 @@ import (
"github.com/thrasher-/gocryptotrader/common/crypto"
"github.com/thrasher-/gocryptotrader/config"
"github.com/thrasher-/gocryptotrader/currency"
"github.com/thrasher-/gocryptotrader/exchanges/assets"
"github.com/thrasher-/gocryptotrader/exchanges/asset"
log "github.com/thrasher-/gocryptotrader/logger"
)
@@ -347,7 +347,7 @@ func wsGetTicker(client *WebsocketClient, data interface{}) error {
}
result, err := GetSpecificTicker(currency.NewPairFromString(tickerReq.Currency),
tickerReq.Exchange, assets.AssetType(tickerReq.AssetType))
tickerReq.Exchange, asset.Item(tickerReq.AssetType))
if err != nil {
wsResp.Error = err.Error()
@@ -379,7 +379,7 @@ func wsGetOrderbook(client *WebsocketClient, data interface{}) error {
}
result, err := GetSpecificOrderbook(currency.NewPairFromString(orderbookReq.Currency),
orderbookReq.Exchange, assets.AssetType(orderbookReq.AssetType))
orderbookReq.Exchange, asset.Item(orderbookReq.AssetType))
if err != nil {
wsResp.Error = err.Error()