diff --git a/config/config_test.go b/config/config_test.go index 701ab10b..f798cf08 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -19,7 +19,7 @@ func TestSupportsPair(t *testing.T) { _, err = cfg.SupportsPair("asdf", pair.NewCurrencyPair("BTC", "USD")) if err == nil { t.Error( - "Test failed. TestSupportsPair. Non-existant exchange returned nil error", + "Test failed. TestSupportsPair. Non-existent exchange returned nil error", ) } @@ -43,7 +43,7 @@ func TestGetAvailablePairs(t *testing.T) { _, err = cfg.GetAvailablePairs("asdf") if err == nil { t.Error( - "Test failed. TestGetAvailablePairs. Non-existant exchange returned nil error", + "Test failed. TestGetAvailablePairs. Non-existent exchange returned nil error", ) } @@ -67,7 +67,7 @@ func TestGetEnabledPairs(t *testing.T) { _, err = cfg.GetEnabledPairs("asdf") if err == nil { t.Error( - "Test failed. TestGetEnabledPairs. Non-existant exchange returned nil error", + "Test failed. TestGetEnabledPairs. Non-existent exchange returned nil error", ) } @@ -166,7 +166,7 @@ func TestGetConfigCurrencyPairFormat(t *testing.T) { _, err = cfg.GetConfigCurrencyPairFormat("asdasdasd") if err == nil { t.Errorf( - "Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error", + "Test failed. TestGetRequestCurrencyPairFormat. Non-existent exchange returned nil error", ) } @@ -190,7 +190,7 @@ func TestGetRequestCurrencyPairFormat(t *testing.T) { _, err = cfg.GetRequestCurrencyPairFormat("asdasdasd") if err == nil { t.Errorf( - "Test failed. TestGetRequestCurrencyPairFormat. Non-existant exchange returned nil error", + "Test failed. TestGetRequestCurrencyPairFormat. Non-existent exchange returned nil error", ) } diff --git a/currency/pair/pair_test.go b/currency/pair/pair_test.go index 158f7497..22cb8ce1 100644 --- a/currency/pair/pair_test.go +++ b/currency/pair/pair_test.go @@ -261,7 +261,7 @@ func TestContains(t *testing.T) { } if Contains(pairs, NewCurrencyPair("ETH", "USD"), false) { - t.Errorf("Test failed. TestContains: Non-existant pair was found") + t.Errorf("Test failed. TestContains: Non-existent pair was found") } } @@ -273,7 +273,7 @@ func TestContainsCurrency(t *testing.T) { } if ContainsCurrency(p, "ETH") { - t.Error("Test failed. TestContainsCurrency: Non-existant currency was found") + t.Error("Test failed. TestContainsCurrency: Non-existent currency was found") } } diff --git a/exchange_test.go b/exchange_test.go index 339d5624..951e6573 100644 --- a/exchange_test.go +++ b/exchange_test.go @@ -47,7 +47,7 @@ func TestCheckExchangeExists(t *testing.T) { } if CheckExchangeExists("Asdsad") { - t.Errorf("Test failed. TestGetExchangeExists: Non-existant exchange found") + t.Errorf("Test failed. TestGetExchangeExists: Non-existent exchange found") } CleanupTest(t) @@ -77,7 +77,7 @@ func TestGetExchangeByName(t *testing.T) { exch = GetExchangeByName("Asdasd") if exch != nil { - t.Errorf("Test failed. TestGetExchangeByName: Non-existant exchange found") + t.Errorf("Test failed. TestGetExchangeByName: Non-existent exchange found") } CleanupTest(t) diff --git a/exchanges/alphapoint/alphapoint.go b/exchanges/alphapoint/alphapoint.go index 327bc2dd..4d46445b 100644 --- a/exchanges/alphapoint/alphapoint.go +++ b/exchanges/alphapoint/alphapoint.go @@ -217,27 +217,27 @@ func (a *Alphapoint) SetUserInfo(firstName, lastName, cell2FACountryCode, cell2F response := UserInfoSet{} var userInfoKVPs = []UserInfoKVP{ - UserInfoKVP{ + { Key: "FirstName", Value: firstName, }, - UserInfoKVP{ + { Key: "LastName", Value: lastName, }, - UserInfoKVP{ + { Key: "Cell2FACountryCode", Value: cell2FACountryCode, }, - UserInfoKVP{ + { Key: "Cell2FAValue", Value: cell2FAValue, }, - UserInfoKVP{ + { Key: "UseAuthy2FA", Value: strconv.FormatBool(useAuthy2FA), }, - UserInfoKVP{ + { Key: "Use2FAForWithdraw", Value: strconv.FormatBool(use2FAForWithdraw), }, diff --git a/exchanges/bitfinex/bitfinex.go b/exchanges/bitfinex/bitfinex.go index 8cbb60ba..da07c2ca 100644 --- a/exchanges/bitfinex/bitfinex.go +++ b/exchanges/bitfinex/bitfinex.go @@ -337,7 +337,7 @@ func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStr return response, common.SendHTTPGetRequest(path, true, b.Verbose, &response) } -// GetTradesV2 uses the V2 API to get historic trades that occured on the +// GetTradesV2 uses the V2 API to get historic trades that occurred on the // exchange // // currencyPair e.g. "tBTCUSD" v2 prefixes currency pairs with t. (?) diff --git a/exchanges/bittrex/bittrex_test.go b/exchanges/bittrex/bittrex_test.go index f16fc2c4..b1a6b1c0 100644 --- a/exchanges/bittrex/bittrex_test.go +++ b/exchanges/bittrex/bittrex_test.go @@ -262,7 +262,7 @@ func TestGetOrderHistory(t *testing.T) { } } -func TestGetWithdrawelHistory(t *testing.T) { +func TestGetwithdrawalHistory(t *testing.T) { t.Parallel() obj := Bittrex{} obj.APIKey = apiKey diff --git a/exchanges/coinut/coinut_types.go b/exchanges/coinut/coinut_types.go index 131eedba..5a0f20c2 100644 --- a/exchanges/coinut/coinut_types.go +++ b/exchanges/coinut/coinut_types.go @@ -102,7 +102,7 @@ type OrderResponse struct { Side string `json:"side"` } -// Commission holds trade commision structure +// Commission holds trade commission structure type Commission struct { Currency string `json:"currency"` Amount float64 `json:"amount,string"` diff --git a/exchanges/exchange_test.go b/exchanges/exchange_test.go index 5524beb1..11b8566a 100644 --- a/exchanges/exchange_test.go +++ b/exchanges/exchange_test.go @@ -498,7 +498,7 @@ func TestSetCurrencies(t *testing.T) { err = UAC.SetCurrencies([]pair.CurrencyPair{newPair}, true) if err == nil { - t.Fatal("Test failed. TestSetCurrencies returned nil error on non-existant exchange") + t.Fatal("Test failed. TestSetCurrencies returned nil error on non-existent exchange") } UAC.Name = "ANX" diff --git a/exchanges/exmo/exmo_types.go b/exchanges/exmo/exmo_types.go index 33c5b044..c478d2ad 100644 --- a/exchanges/exmo/exmo_types.go +++ b/exchanges/exmo/exmo_types.go @@ -44,7 +44,7 @@ type PairSettings struct { MinAmount float64 `json:"min_amount,string"` } -// AuthResponse stores the auth reponse +// AuthResponse stores the auth response type AuthResponse struct { Result bool `json:"bool"` Error string `json:"error"` diff --git a/exchanges/hitbtc/hitbtc.go b/exchanges/hitbtc/hitbtc.go index 716690d8..37768265 100644 --- a/exchanges/hitbtc/hitbtc.go +++ b/exchanges/hitbtc/hitbtc.go @@ -129,7 +129,7 @@ func (p *HitBTC) GetSymbols(symbol string) ([]string, error) { } // GetSymbolsDetailed is the same as above but returns an array of symbols with -// all ther details. +// all their details. func (p *HitBTC) GetSymbolsDetailed() ([]Symbol, error) { resp := []Symbol{} path := fmt.Sprintf("%s/%s", apiURL, apiV2Symbol) diff --git a/exchanges/hitbtc/hitbtc_types.go b/exchanges/hitbtc/hitbtc_types.go index 7a357b05..335a3ffe 100644 --- a/exchanges/hitbtc/hitbtc_types.go +++ b/exchanges/hitbtc/hitbtc_types.go @@ -212,7 +212,7 @@ type MoveOrderResponse struct { Trades map[string][]ResultingTrades `json:"resultingTrades"` } -// Withdraw holds response for a withdrawel process +// Withdraw holds response for a withdrawal process type Withdraw struct { Response string `json:"response"` Error string `json:"error"` diff --git a/exchanges/huobi/huobi_types.go b/exchanges/huobi/huobi_types.go index 858a7c40..515e966a 100644 --- a/exchanges/huobi/huobi_types.go +++ b/exchanges/huobi/huobi_types.go @@ -64,7 +64,7 @@ type Detail struct { Open float64 `json:"open"` Close float64 `json:"close"` High float64 `json:"high"` - Timestamp int64 `json:"id"` + Timestamp int64 `json:"timestamp"` ID int `json:"id"` Count int `json:"count"` Low float64 `json:"low"` diff --git a/exchanges/localbitcoins/localbitcoins.go b/exchanges/localbitcoins/localbitcoins.go index 6484b20d..10669e39 100644 --- a/exchanges/localbitcoins/localbitcoins.go +++ b/exchanges/localbitcoins/localbitcoins.go @@ -175,9 +175,9 @@ func (l *LocalBitcoins) GetAccountInfo(username string, self bool) (AccountInfo, } // Getads returns information of single advertisement based on the ad ID, if -// adID ommited. +// adID omitted. // -// adID - [optional] string if ommited returns all ads +// adID - [optional] string if omitted returns all ads func (l *LocalBitcoins) Getads(adID string) (AdData, error) { type response struct { Data AdData `json:"data"` diff --git a/exchanges/okcoin/okcoin.go b/exchanges/okcoin/okcoin.go index 5e22f5b2..29a5dc8e 100644 --- a/exchanges/okcoin/okcoin.go +++ b/exchanges/okcoin/okcoin.go @@ -882,7 +882,7 @@ func (o *OKCoin) CancelFuturesOrder(orderID int64, symbol, contractType string) } } -// GetFuturesOrderInfo returns information on a specfic futures contract order +// GetFuturesOrderInfo returns information on a specific futures contract order func (o *OKCoin) GetFuturesOrderInfo(orderID, status, currentPage, pageLength int64, symbol, contractType string) { v := url.Values{} v.Set("symbol", symbol) diff --git a/exchanges/orderbook/orderbook_test.go b/exchanges/orderbook/orderbook_test.go index e0ce2f22..f40bc834 100644 --- a/exchanges/orderbook/orderbook_test.go +++ b/exchanges/orderbook/orderbook_test.go @@ -13,7 +13,7 @@ func TestCalculateTotalBids(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Bids: []Item{Item{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 100, Amount: 10}}, LastUpdated: time.Now(), } @@ -29,7 +29,7 @@ func TestCalculateTotaAsks(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, LastUpdated: time.Now(), } @@ -46,13 +46,13 @@ func TestUpdate(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, LastUpdated: timeNow, } - asks := []Item{Item{Price: 200, Amount: 101}} - bids := []Item{Item{Price: 201, Amount: 100}} + asks := []Item{{Price: 200, Amount: 101}} + bids := []Item{{Price: 201, Amount: 100}} time.Sleep(time.Millisecond * 50) base.Update(bids, asks) @@ -76,8 +76,8 @@ func TestGetOrderbook(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } CreateNewOrderbook("Exchange", currency, base, Spot) @@ -115,8 +115,8 @@ func TestGetOrderbookByExchange(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } CreateNewOrderbook("Exchange", currency, base, Spot) @@ -127,9 +127,9 @@ func TestGetOrderbookByExchange(t *testing.T) { err) } - _, err = GetOrderbookByExchange("nonexistant") + _, err = GetOrderbookByExchange("nonexistent") if err == nil { - t.Fatal("Test failed. TestGetOrderbookByExchange retrieved non-existant orderbook") + t.Fatal("Test failed. TestGetOrderbookByExchange retrieved non-existent orderbook") } } @@ -138,8 +138,8 @@ func TestFirstCurrencyExists(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } CreateNewOrderbook("Exchange", currency, base, Spot) @@ -159,8 +159,8 @@ func TestSecondCurrencyExists(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } CreateNewOrderbook("Exchange", currency, base, Spot) @@ -180,8 +180,8 @@ func TestCreateNewOrderbook(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } CreateNewOrderbook("Exchange", currency, base, Spot) @@ -212,8 +212,8 @@ func TestProcessOrderbook(t *testing.T) { base := Base{ Pair: currency, CurrencyPair: currency.Pair().String(), - Asks: []Item{Item{Price: 100, Amount: 10}}, - Bids: []Item{Item{Price: 200, Amount: 10}}, + Asks: []Item{{Price: 100, Amount: 10}}, + Bids: []Item{{Price: 200, Amount: 10}}, } ProcessOrderbook("Exchange", currency, base, Spot) @@ -240,7 +240,7 @@ func TestProcessOrderbook(t *testing.T) { t.Fatal("Test failed. TestProcessOrderbook result pair is incorrect") } - base.Asks = []Item{Item{Price: 200, Amount: 200}} + base.Asks = []Item{{Price: 200, Amount: 200}} ProcessOrderbook("Exchange", currency, base, "monthly") result, err = GetOrderbook("Exchange", currency, "monthly") @@ -253,7 +253,7 @@ func TestProcessOrderbook(t *testing.T) { t.Fatal("Test failed. TestProcessOrderbook CalculateTotalsAsks incorrect values") } - base.Bids = []Item{Item{Price: 420, Amount: 200}} + base.Bids = []Item{{Price: 420, Amount: 200}} ProcessOrderbook("Blah", currency, base, "quarterly") result, err = GetOrderbook("Blah", currency, "quarterly") if err != nil { diff --git a/portfolio/portfolio_test.go b/portfolio/portfolio_test.go index d86eda04..bd03d883 100644 --- a/portfolio/portfolio_test.go +++ b/portfolio/portfolio_test.go @@ -19,7 +19,7 @@ func TestGetEthereumBalance(t *testing.T) { } response, err = GetEthereumBalance(nonsenseAddress) - if response.Error.Message != "" { + if response.Error.Message != "" || err == nil { t.Errorf("Test Failed - Portfolio GetEthereumBalance() Error: %s", response.Error.Message) } diff --git a/tools/documentation/documentation.go b/tools/documentation/documentation.go index b395d1ed..d757ac3c 100644 --- a/tools/documentation/documentation.go +++ b/tools/documentation/documentation.go @@ -103,8 +103,7 @@ func main() { GoCryptoTrader: Exchange documentation tool This will update and regenerate documentation for the different packages - in GoCryptoTrader. -`) + in GoCryptoTrader.`) codebasePaths = make(map[string]string) codebaseTemplatePath = make(map[string]string)