From 0a8d8454b50a2f1bcf0a57dbb2d02161b9a58d26 Mon Sep 17 00:00:00 2001 From: Ryan O'Hara-Reid Date: Wed, 27 Jun 2018 14:30:22 +1000 Subject: [PATCH] Fixed issues with liqui GetTicker function. Added tests. Increased Unauth request limit. (#144) --- exchanges/liqui/liqui.go | 2 +- exchanges/liqui/liqui_test.go | 17 +++++++++++++++++ exchanges/liqui/liqui_wrapper.go | 3 ++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/exchanges/liqui/liqui.go b/exchanges/liqui/liqui.go index eab0d3f1..b1e9be83 100644 --- a/exchanges/liqui/liqui.go +++ b/exchanges/liqui/liqui.go @@ -34,7 +34,7 @@ const ( liquiWithdrawCoin = "WithdrawCoin" liquiAuthRate = 0 - liquiUnauthRate = 0 + liquiUnauthRate = 1 ) // Liqui is the overarching type across the liqui package diff --git a/exchanges/liqui/liqui_test.go b/exchanges/liqui/liqui_test.go index f88b7383..e18d272e 100644 --- a/exchanges/liqui/liqui_test.go +++ b/exchanges/liqui/liqui_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/thrasher-/gocryptotrader/config" + "github.com/thrasher-/gocryptotrader/currency/pair" ) var l Liqui @@ -119,3 +120,19 @@ func TestAuthRequests(t *testing.T) { } } } + +func TestUpdateTicker(t *testing.T) { + p := pair.NewCurrencyPairDelimiter("ETH_BTC", "_") + _, err := l.UpdateTicker(p, "SPOT") + if err != nil { + t.Error("Test Failed - liqui UpdateTicker() error", err) + } +} + +func TestUpdateOrderbook(t *testing.T) { + p := pair.NewCurrencyPairDelimiter("ETH_BTC", "_") + _, err := l.UpdateOrderbook(p, "SPOT") + if err != nil { + t.Error("Test Failed - liqui UpdateOrderbook() error", err) + } +} diff --git a/exchanges/liqui/liqui_wrapper.go b/exchanges/liqui/liqui_wrapper.go index 93e7b3eb..188ad419 100644 --- a/exchanges/liqui/liqui_wrapper.go +++ b/exchanges/liqui/liqui_wrapper.go @@ -59,12 +59,13 @@ func (l *Liqui) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Pric currency := exchange.FormatExchangeCurrency(l.Name, x).String() var tp ticker.Price tp.Pair = x + tp.High = result[currency].High tp.Last = result[currency].Last tp.Ask = result[currency].Sell tp.Bid = result[currency].Buy tp.Last = result[currency].Last tp.Low = result[currency].Low - tp.Volume = result[currency].VolumeCurrency + tp.Volume = result[currency].Vol ticker.ProcessTicker(l.Name, x, tp, assetType) }