diff --git a/common/common.go b/common/common.go index 05cef37f..2921454f 100644 --- a/common/common.go +++ b/common/common.go @@ -87,7 +87,7 @@ func GetHMAC(hashType int, input, key []byte) []byte { return hmac.Sum(nil) } -// HexEncodeToString takes in a hexidecimal byte array and returns a string +// HexEncodeToString takes in a hexadecimal byte array and returns a string func HexEncodeToString(input []byte) string { return hex.EncodeToString(input) } @@ -200,7 +200,7 @@ func IsEnabled(isEnabled bool) string { } // IsValidCryptoAddress validates your cryptocurrency address string using the -// regexp package // Validation issues occuring because "3" is contained in +// regexp package // Validation issues occurring because "3" is contained in // litecoin and Bitcoin addresses - non-fatal func IsValidCryptoAddress(address, crypto string) (bool, error) { switch StringToLower(crypto) { @@ -228,7 +228,7 @@ func CalculateAmountWithFee(amount, fee float64) float64 { return amount + CalculateFee(amount, fee) } -// CalculateFee retuns a simple fee on amount +// CalculateFee returns a simple fee on amount func CalculateFee(amount, fee float64) float64 { return amount * (fee / 100) } @@ -356,7 +356,7 @@ func ExtractPort(host string) int { return port } -// OutputCSV dumps data into a file as comma-seperated values +// OutputCSV dumps data into a file as comma-separated values func OutputCSV(path string, data [][]string) error { _, err := ReadFile(path) if err != nil { diff --git a/exchanges/alphapoint/alphapoint.go b/exchanges/alphapoint/alphapoint.go index 6aea4d3a..b434e2ff 100644 --- a/exchanges/alphapoint/alphapoint.go +++ b/exchanges/alphapoint/alphapoint.go @@ -389,12 +389,12 @@ func (a *Alphapoint) SendRequest(method, path string, data map[string]interface{ headers := make(map[string]string) headers["Content-Type"] = "application/json" path = fmt.Sprintf("%s/ajax/v%s/%s", a.APIUrl, ALPHAPOINT_API_VERSION, path) - PayloadJson, err := common.JSONEncode(data) + PayloadJSON, err := common.JSONEncode(data) if err != nil { return errors.New("SendAuthenticatedHTTPRequest: Unable to JSON request") } - resp, err := common.SendHTTPRequest(method, path, headers, bytes.NewBuffer(PayloadJson)) + resp, err := common.SendHTTPRequest(method, path, headers, bytes.NewBuffer(PayloadJSON)) if err != nil { return err @@ -418,13 +418,13 @@ func (a *Alphapoint) SendAuthenticatedHTTPRequest(method, path string, data map[ hmac := common.GetHMAC(common.HashSHA256, []byte(nonceStr+a.ClientID+a.APIKey), []byte(a.APISecret)) data["apiSig"] = common.StringToUpper(common.HexEncodeToString(hmac)) path = fmt.Sprintf("%s/ajax/v%s/%s", a.APIUrl, ALPHAPOINT_API_VERSION, path) - PayloadJson, err := common.JSONEncode(data) + PayloadJSON, err := common.JSONEncode(data) if err != nil { return errors.New("SendAuthenticatedHTTPRequest: Unable to JSON request") } - resp, err := common.SendHTTPRequest(method, path, headers, bytes.NewBuffer(PayloadJson)) + resp, err := common.SendHTTPRequest(method, path, headers, bytes.NewBuffer(PayloadJSON)) if err != nil { return err diff --git a/exchanges/anx/anx.go b/exchanges/anx/anx.go index 7be5faa0..d7135b98 100644 --- a/exchanges/anx/anx.go +++ b/exchanges/anx/anx.go @@ -315,13 +315,13 @@ func (a *ANX) SendAuthenticatedHTTPRequest(path string, params map[string]interf resp, err := common.SendHTTPRequest("POST", ANX_API_URL+path, headers, bytes.NewBuffer(PayloadJson)) if a.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/bitfinex/bitfinex.go b/exchanges/bitfinex/bitfinex.go index 6a272d42..f897fa3f 100644 --- a/exchanges/bitfinex/bitfinex.go +++ b/exchanges/bitfinex/bitfinex.go @@ -629,7 +629,7 @@ func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[ } if b.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) diff --git a/exchanges/bitfinex/bitfinex_websocket.go b/exchanges/bitfinex/bitfinex_websocket.go index 9d1673e2..c7a7c064 100644 --- a/exchanges/bitfinex/bitfinex_websocket.go +++ b/exchanges/bitfinex/bitfinex_websocket.go @@ -214,6 +214,7 @@ func (b *Bitfinex) WebsocketClient() { case 4: orderbook = append(orderbook, BitfinexWebsocketBook{Price: chanData[1].(float64), Count: int(chanData[2].(float64)), Amount: chanData[3].(float64)}) } + log.Println(orderbook) case "ticker": ticker := BitfinexWebsocketTicker{Bid: chanData[1].(float64), BidSize: chanData[2].(float64), Ask: chanData[3].(float64), AskSize: chanData[4].(float64), DailyChange: chanData[5].(float64), DialyChangePerc: chanData[6].(float64), LastPrice: chanData[7].(float64), Volume: chanData[8].(float64)} @@ -284,6 +285,7 @@ func (b *Bitfinex) WebsocketClient() { log.Printf("Bitfinex %s Websocket Trade ID %d Timestamp %d Price %f Amount %f\n", chanInfo.Pair, trade.ID, trade.Timestamp, trade.Price, trade.Amount) } } + log.Println(trades) } } } diff --git a/exchanges/bitstamp/bitstamp.go b/exchanges/bitstamp/bitstamp.go index 577e387d..ac44f745 100644 --- a/exchanges/bitstamp/bitstamp.go +++ b/exchanges/bitstamp/bitstamp.go @@ -498,13 +498,13 @@ func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, v2 bool, values url } if b.Verbose { - log.Printf("Recieved raw: %s\n", resp) + log.Printf("Received raw: %s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/bittrex/bittrex.go b/exchanges/bittrex/bittrex.go index 0cabdb17..011fa499 100644 --- a/exchanges/bittrex/bittrex.go +++ b/exchanges/bittrex/bittrex.go @@ -147,7 +147,7 @@ func (b *Bittrex) GetOrderbook(currencyPair string) (OrderBooks, error) { return orderbooks, b.HTTPRequest(path, false, url.Values{}, &orderbooks) } -// GetMarketHistory retrieves the latest trades that have occured for a specific +// GetMarketHistory retrieves the latest trades that have occurred for a specific // market func (b *Bittrex) GetMarketHistory(currencyPair string) ([]MarketHistory, error) { var marketHistoriae []MarketHistory @@ -162,7 +162,7 @@ func (b *Bittrex) GetMarketHistory(currencyPair string) ([]MarketHistory, error) // to place limit orders. Make sure you have the proper permissions set on your // API keys for this call to work. // "Currency" ie "btc-ltc" -// "Quantity" is the ammount to purchase +// "Quantity" is the amount to purchase // "Rate" is the rate at which to purchase func (b *Bittrex) PlaceBuyLimit(currencyPair string, quantity, rate float64) ([]UUID, error) { var id []UUID @@ -179,7 +179,7 @@ func (b *Bittrex) PlaceBuyLimit(currencyPair string, quantity, rate float64) ([] // selllimit to place limit orders. Make sure you have the proper permissions // set on your API keys for this call to work. // "Currency" ie "btc-ltc" -// "Quantity" is the ammount to purchase +// "Quantity" is the amount to purchase // "Rate" is the rate at which to purchase func (b *Bittrex) PlaceSellLimit(currencyPair string, quantity, rate float64) ([]UUID, error) { var id []UUID @@ -270,7 +270,7 @@ func (b *Bittrex) GetOrder(uuid string) (Order, error) { } // GetOrderHistory is used to retrieve your order history. If currencyPair -// ommited it will return the entire order History. +// omitted it will return the entire order History. func (b *Bittrex) GetOrderHistory(currencyPair string) ([]Order, error) { var orders []Order values := url.Values{} @@ -284,7 +284,7 @@ func (b *Bittrex) GetOrderHistory(currencyPair string) ([]Order, error) { } // GetWithdrawelHistory is used to retrieve your withdrawal history. If currency -// ommited it will return the entire history +// omitted it will return the entire history func (b *Bittrex) GetWithdrawelHistory(currency string) ([]WithdrawalHistory, error) { var history []WithdrawalHistory values := url.Values{} @@ -298,7 +298,7 @@ func (b *Bittrex) GetWithdrawelHistory(currency string) ([]WithdrawalHistory, er } // GetDepositHistory is used to retrieve your deposit history. If currency is -// is ommitted it will return the entire deposit history +// is omitted it will return the entire deposit history func (b *Bittrex) GetDepositHistory(currency string) ([]WithdrawalHistory, error) { var history []WithdrawalHistory values := url.Values{} @@ -333,7 +333,7 @@ func (b *Bittrex) SendAuthenticatedHTTPRequest(path string, values url.Values, r } if b.Verbose { - log.Printf("Recieved raw: %s\n", resp) + log.Printf("Received raw: %s\n", resp) } err = common.JSONDecode([]byte(resp), &result) diff --git a/exchanges/btcc/btcc_wrapper.go b/exchanges/btcc/btcc_wrapper.go index 0ed067a1..c7c868ca 100644 --- a/exchanges/btcc/btcc_wrapper.go +++ b/exchanges/btcc/btcc_wrapper.go @@ -52,6 +52,10 @@ func (b *BTCC) GetTickerPrice(p pair.CurrencyPair) (ticker.TickerPrice, error) { var tickerPrice ticker.TickerPrice tick, err := b.GetTicker(p.Pair().Lower().String()) + if err != nil { + return tickerPrice, err + } + tickerPrice.Pair = p tickerPrice.Ask = tick.Sell tickerPrice.Bid = tick.Buy @@ -75,12 +79,12 @@ func (b *BTCC) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, err return orderBook, err } - for x, _ := range orderbookNew.Bids { + for x := range orderbookNew.Bids { data := orderbookNew.Bids[x] orderBook.Bids = append(ob.Bids, orderbook.OrderbookItem{Price: data[0], Amount: data[1]}) } - for x, _ := range orderbookNew.Asks { + for x := range orderbookNew.Asks { data := orderbookNew.Asks[x] orderBook.Asks = append(ob.Asks, orderbook.OrderbookItem{Price: data[0], Amount: data[1]}) } @@ -92,8 +96,8 @@ func (b *BTCC) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, err //TODO: Retrieve BTCC info //GetExchangeAccountInfo : Retrieves balances for all enabled currencies for the Kraken exchange -func (e *BTCC) GetExchangeAccountInfo() (exchange.AccountInfo, error) { +func (b *BTCC) GetExchangeAccountInfo() (exchange.AccountInfo, error) { var response exchange.AccountInfo - response.ExchangeName = e.GetName() + response.ExchangeName = b.GetName() return response, nil } diff --git a/exchanges/coinut/coinut.go b/exchanges/coinut/coinut.go index c85e857c..1b6fc0f8 100644 --- a/exchanges/coinut/coinut.go +++ b/exchanges/coinut/coinut.go @@ -14,7 +14,7 @@ import ( const ( COINUT_API_URL = "https://api.coinut.com" - COINUT_API_VERISON = "1" + COINUT_API_VERSION = "1" COINUT_INSTRUMENTS = "inst_list" COINUT_TICKER = "inst_tick" COINUT_ORDERBOOK = "inst_order_book" @@ -299,7 +299,7 @@ func (c *COINUT) SendAuthenticatedHTTPRequest(apiRequest string, params map[stri resp, err := common.SendHTTPRequest("POST", COINUT_API_URL, headers, bytes.NewBuffer(payload)) if c.Verbose { - log.Printf("Recieved raw: \n%s", resp) + log.Printf("Received raw: \n%s", resp) } genResp := CoinutGenericResponse{} @@ -307,17 +307,17 @@ func (c *COINUT) SendAuthenticatedHTTPRequest(apiRequest string, params map[stri err = common.JSONDecode([]byte(resp), &genResp) if err != nil { - return errors.New("Unable to JSON Unmarshal generic response.") + return errors.New("unable to JSON Unmarshal generic response") } if genResp.Status[0] != "OK" { - return errors.New("Status is not OK.") + return errors.New("status is not OK") } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/gdax/gdax.go b/exchanges/gdax/gdax.go index 856f4f52..ba294a82 100644 --- a/exchanges/gdax/gdax.go +++ b/exchanges/gdax/gdax.go @@ -16,7 +16,7 @@ import ( const ( GDAX_API_URL = "https://api.gdax.com/" - GDAX_API_VERISON = "0" + GDAX_API_VERSION = "0" GDAX_PRODUCTS = "products" GDAX_ORDERBOOK = "book" GDAX_TICKER = "ticker" @@ -398,13 +398,13 @@ func (g *GDAX) SendAuthenticatedHTTPRequest(method, path string, params map[stri resp, err := common.SendHTTPRequest(method, GDAX_API_URL+path, headers, bytes.NewBuffer(payload)) if g.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/gdax/gdax_types.go b/exchanges/gdax/gdax_types.go index 61118d4f..c14894c9 100644 --- a/exchanges/gdax/gdax_types.go +++ b/exchanges/gdax/gdax_types.go @@ -31,13 +31,13 @@ type GDAXOrderL3 struct { type GDAXOrderbookL1L2 struct { Sequence int64 `json:"sequence"` - Bids []GDAXOrderL1L2 `json:"asks"` + Bids []GDAXOrderL1L2 `json:"bids"` Asks []GDAXOrderL1L2 `json:"asks"` } type GDAXOrderbookL3 struct { Sequence int64 `json:"sequence"` - Bids []GDAXOrderL3 `json:"asks"` + Bids []GDAXOrderL3 `json:"bids"` Asks []GDAXOrderL3 `json:"asks"` } diff --git a/exchanges/gdax/gdax_wrapper.go b/exchanges/gdax/gdax_wrapper.go index 5953d5db..c68dab0c 100644 --- a/exchanges/gdax/gdax_wrapper.go +++ b/exchanges/gdax/gdax_wrapper.go @@ -63,10 +63,10 @@ func (g *GDAX) Run() { } //GetExchangeAccountInfo : Retrieves balances for all enabled currencies for the GDAX exchange -func (e *GDAX) GetExchangeAccountInfo() (exchange.AccountInfo, error) { +func (g *GDAX) GetExchangeAccountInfo() (exchange.AccountInfo, error) { var response exchange.AccountInfo - response.ExchangeName = e.GetName() - accountBalance, err := e.GetAccounts() + response.ExchangeName = g.GetName() + accountBalance, err := g.GetAccounts() if err != nil { return response, err } @@ -122,11 +122,11 @@ func (g *GDAX) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, err obNew := orderbookNew.(GDAXOrderbookL1L2) - for x, _ := range obNew.Bids { + for x := range obNew.Bids { orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: obNew.Bids[x].Amount, Price: obNew.Bids[x].Price}) } - for x, _ := range obNew.Asks { + for x := range obNew.Asks { orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: obNew.Bids[x].Amount, Price: obNew.Bids[x].Price}) } orderBook.Pair = p diff --git a/exchanges/gemini/gemini.go b/exchanges/gemini/gemini.go index a0d923fe..ef2f40a4 100644 --- a/exchanges/gemini/gemini.go +++ b/exchanges/gemini/gemini.go @@ -275,13 +275,13 @@ func (g *Gemini) SendAuthenticatedHTTPRequest(method, path string, params map[st resp, err := common.SendHTTPRequest(method, GEMINI_API_URL+path, headers, strings.NewReader("")) if g.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/huobi/huobi.go b/exchanges/huobi/huobi.go index deede501..672bb8d3 100644 --- a/exchanges/huobi/huobi.go +++ b/exchanges/huobi/huobi.go @@ -198,7 +198,7 @@ func (h *HUOBI) SendAuthenticatedRequest(method string, v url.Values) error { } if h.Verbose { - log.Printf("Recieved raw: %s\n", resp) + log.Printf("Received raw: %s\n", resp) } return nil diff --git a/exchanges/itbit/itbit.go b/exchanges/itbit/itbit.go index 9f275f6c..e051e099 100644 --- a/exchanges/itbit/itbit.go +++ b/exchanges/itbit/itbit.go @@ -51,27 +51,26 @@ func (i *ItBit) Setup(exch config.ExchangeConfig) { func (i *ItBit) GetFee(maker bool) float64 { if maker { return i.MakerFee - } else { - return i.TakerFee } + return i.TakerFee } -func (i *ItBit) GetTicker(currency string) (ItBitTicker, error) { +func (i *ItBit) GetTicker(currency string) (Ticker, error) { path := ITBIT_API_URL + "/markets/" + currency + "/ticker" - var itbitTicker ItBitTicker + var itbitTicker Ticker err := common.SendHTTPGetRequest(path, true, &itbitTicker) if err != nil { - return ItBitTicker{}, err + return Ticker{}, err } return itbitTicker, nil } -func (i *ItBit) GetOrderbook(currency string) (ItBitOrderbookResponse, error) { - response := ItBitOrderbookResponse{} +func (i *ItBit) GetOrderbook(currency string) (OrderbookResponse, error) { + response := OrderbookResponse{} path := ITBIT_API_URL + "/markets/" + currency + "/order_book" err := common.SendHTTPGetRequest(path, true, &response) if err != nil { - return ItBitOrderbookResponse{}, err + return OrderbookResponse{}, err } return response, nil } @@ -234,7 +233,7 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params return err } - nonce -= 1 + nonce-- request := make(map[string]interface{}) url := ITBIT_API_URL + path @@ -244,22 +243,22 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params } } - PayloadJson := []byte("") + PayloadJSON := []byte("") if params != nil { - PayloadJson, err = common.JSONEncode(request) + PayloadJSON, err = common.JSONEncode(request) if err != nil { return errors.New("SendAuthenticatedHTTPRequest: Unable to JSON Marshal request") } if i.Verbose { - log.Printf("Request JSON: %s\n", PayloadJson) + log.Printf("Request JSON: %s\n", PayloadJSON) } } nonceStr := strconv.Itoa(nonce) - message, err := common.JSONEncode([]string{method, url, string(PayloadJson), nonceStr, timestamp}) + message, err := common.JSONEncode([]string{method, url, string(PayloadJSON), nonceStr, timestamp}) if err != nil { log.Println(err) return @@ -275,10 +274,10 @@ func (i *ItBit) SendAuthenticatedHTTPRequest(method string, path string, params headers["X-Auth-Nonce"] = nonceStr headers["Content-Type"] = "application/json" - resp, err := common.SendHTTPRequest(method, url, headers, bytes.NewBuffer([]byte(PayloadJson))) + resp, err := common.SendHTTPRequest(method, url, headers, bytes.NewBuffer([]byte(PayloadJSON))) if i.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } return nil } diff --git a/exchanges/itbit/itbit_types.go b/exchanges/itbit/itbit_types.go index fdfc96f8..9613404d 100644 --- a/exchanges/itbit/itbit_types.go +++ b/exchanges/itbit/itbit_types.go @@ -1,6 +1,6 @@ package itbit -type ItBitTicker struct { +type Ticker struct { Pair string Bid float64 `json:",string"` BidAmt float64 `json:",string"` @@ -20,7 +20,7 @@ type ItBitTicker struct { ServertimeUTC string } -type ItBitOrderbookResponse struct { +type OrderbookResponse struct { Bids [][]string `json:"bids"` Asks [][]string `json:"asks"` } diff --git a/exchanges/itbit/itbit_wrapper.go b/exchanges/itbit/itbit_wrapper.go index 99bec337..d6276475 100644 --- a/exchanges/itbit/itbit_wrapper.go +++ b/exchanges/itbit/itbit_wrapper.go @@ -73,7 +73,7 @@ func (i *ItBit) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, er return orderBook, err } - for x, _ := range orderbookNew.Bids { + for x := range orderbookNew.Bids { data := orderbookNew.Bids[x] price, err := strconv.ParseFloat(data[0], 64) if err != nil { @@ -86,7 +86,7 @@ func (i *ItBit) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, er orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: amount, Price: price}) } - for x, _ := range orderbookNew.Asks { + for x := range orderbookNew.Asks { data := orderbookNew.Asks[x] price, err := strconv.ParseFloat(data[0], 64) if err != nil { @@ -105,8 +105,8 @@ func (i *ItBit) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, er //TODO Get current holdings from ItBit //GetExchangeAccountInfo : Retrieves balances for all enabled currencies for the ItBit exchange -func (e *ItBit) GetExchangeAccountInfo() (exchange.AccountInfo, error) { +func (i *ItBit) GetExchangeAccountInfo() (exchange.AccountInfo, error) { var response exchange.AccountInfo - response.ExchangeName = e.GetName() + response.ExchangeName = i.GetName() return response, nil } diff --git a/exchanges/kraken/kraken.go b/exchanges/kraken/kraken.go index 36cf5dde..bee3ea15 100644 --- a/exchanges/kraken/kraken.go +++ b/exchanges/kraken/kraken.go @@ -535,7 +535,7 @@ func (k *Kraken) SendAuthenticatedHTTPRequest(method string, values url.Values) } if k.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } return resp, nil diff --git a/exchanges/lakebtc/lakebtc.go b/exchanges/lakebtc/lakebtc.go index 83f2c01e..ecb50f29 100644 --- a/exchanges/lakebtc/lakebtc.go +++ b/exchanges/lakebtc/lakebtc.go @@ -301,7 +301,7 @@ func (l *LakeBTC) SendAuthenticatedHTTPRequest(method, params string, result int } if l.Verbose { - log.Printf("Recieved raw: %s\n", resp) + log.Printf("Received raw: %s\n", resp) } type ErrorResponse struct { @@ -311,7 +311,7 @@ func (l *LakeBTC) SendAuthenticatedHTTPRequest(method, params string, result int errResponse := ErrorResponse{} err = common.JSONDecode([]byte(resp), &errResponse) if err != nil { - return errors.New("Unable to check response for error.") + return errors.New("unable to check response for error") } if errResponse.Error != "" { @@ -321,7 +321,7 @@ func (l *LakeBTC) SendAuthenticatedHTTPRequest(method, params string, result int err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/localbitcoins/localbitcoins.go b/exchanges/localbitcoins/localbitcoins.go index 47ffd5df..43ad14a7 100644 --- a/exchanges/localbitcoins/localbitcoins.go +++ b/exchanges/localbitcoins/localbitcoins.go @@ -286,13 +286,13 @@ func (l *LocalBitcoins) SendAuthenticatedHTTPRequest(method, path string, values resp, err := common.SendHTTPRequest(method, LOCALBITCOINS_API_URL+path, headers, bytes.NewBuffer([]byte(payload))) if l.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/exchanges/okcoin/okcoin.go b/exchanges/okcoin/okcoin.go index d13feb8f..6a7d531f 100644 --- a/exchanges/okcoin/okcoin.go +++ b/exchanges/okcoin/okcoin.go @@ -898,13 +898,13 @@ func (o *OKCoin) SendAuthenticatedHTTPRequest(method string, v url.Values, resul } if o.Verbose { - log.Printf("Recieved raw: \n%s\n", resp) + log.Printf("Received raw: \n%s\n", resp) } err = common.JSONDecode([]byte(resp), &result) if err != nil { - return errors.New("Unable to JSON Unmarshal response.") + return errors.New("unable to JSON Unmarshal response") } return nil diff --git a/main.go b/main.go index df192f48..e91ef439 100644 --- a/main.go +++ b/main.go @@ -281,7 +281,7 @@ func SeedExchangeAccountInfo(data []exchange.AccountInfo) { port.Addresses = append( port.Addresses, portfolio.Address{Address: exchangeName, CoinType: currencyName, - Balance: total, Decscription: portfolio.PortfolioAddressExchange}, + Balance: total, Description: portfolio.PortfolioAddressExchange}, ) } else { port.UpdateExchangeAddressBalance(exchangeName, currencyName, total) diff --git a/portfolio/portfolio.go b/portfolio/portfolio.go index 5b5f9a51..1de4676d 100644 --- a/portfolio/portfolio.go +++ b/portfolio/portfolio.go @@ -31,10 +31,10 @@ type Base struct { // Address sub type holding address information for portfolio type Address struct { - Address string - CoinType string - Balance float64 - Decscription string + Address string + CoinType string + Balance float64 + Description string } // BlockrAddress holds JSON incoming and outgoing data for BLOCKR with address @@ -236,7 +236,7 @@ func (p *Base) AddAddress(address, coinType, description string, balance float64 if !p.AddressExists(address) { p.Addresses = append( p.Addresses, Address{Address: address, CoinType: coinType, - Balance: balance, Decscription: description}, + Balance: balance, Description: description}, ) } else { p.UpdateAddressBalance(address, balance) @@ -284,7 +284,7 @@ func (p *Base) UpdatePortfolio(addresses []string, coinType string) bool { func (p *Base) GetExchangePortfolio() map[string]float64 { result := make(map[string]float64) for _, x := range p.Addresses { - if x.Decscription != PortfolioAddressExchange { + if x.Description != PortfolioAddressExchange { continue } balance, ok := result[x.CoinType] @@ -301,7 +301,7 @@ func (p *Base) GetExchangePortfolio() map[string]float64 { func (p *Base) GetPersonalPortfolio() map[string]float64 { result := make(map[string]float64) for _, x := range p.Addresses { - if x.Decscription == PortfolioAddressExchange { + if x.Description == PortfolioAddressExchange { continue } balance, ok := result[x.CoinType] @@ -335,7 +335,7 @@ func (p *Base) GetPortfolioSummary(coinFilter string) map[string]float64 { func (p *Base) GetPortfolioGroupedCoin() map[string][]string { result := make(map[string][]string) for _, x := range p.Addresses { - if common.StringContains(x.Decscription, PortfolioAddressExchange) || common.StringContains(x.Decscription, portfolioAddressPersonal) { + if common.StringContains(x.Description, PortfolioAddressExchange) || common.StringContains(x.Description, portfolioAddressPersonal) { continue } result[x.CoinType] = append(result[x.CoinType], x.Address)