diff --git a/btce.go b/btce.go index f7357c6..760448b 100644 --- a/btce.go +++ b/btce.go @@ -1,3 +1,4 @@ +// Package btce // TODO package level documentation // Include example usage package btce diff --git a/public.go b/public.go index 6ad9995..0dbca11 100644 --- a/public.go +++ b/public.go @@ -9,12 +9,12 @@ import ( // PublicAPI provides access to such information as tickers of currency pairs, active orders on different pairs, the latest trades for each pair etc. type PublicAPI struct{} -const API_URL = "https://btc-e.com/api/3/" +const apiURL = "https://btc-e.com/api/3/" // Info provides all the information about currently active pairs, such as the maximum number of digits after the decimal point, the minimum price, the maximum price, the minimum transaction size, whether the pair is hidden, the commission for each pair. func (api *PublicAPI) Info() (Info, error) { - url := API_URL + "info" + url := apiURL + "info" r, err := http.Get(url) if err == nil { @@ -29,7 +29,7 @@ func (api *PublicAPI) Info() (Info, error) { // All information is provided over the past 24 hours. func (api *PublicAPI) Ticker(currency []string) (Ticker, error) { - url := API_URL + "ticker/" + url := apiURL + "ticker/" for _, c := range currency { url = url + c + "-" } @@ -47,7 +47,7 @@ func (api *PublicAPI) Ticker(currency []string) (Ticker, error) { // Depth provides the information about active orders on the pair. func (api *PublicAPI) Depth(currency []string, limit int) (Depth, error) { - url := API_URL + "depth/" + url := apiURL + "depth/" for _, c := range currency { url = url + c + "-" } @@ -69,7 +69,7 @@ func (api *PublicAPI) Depth(currency []string, limit int) (Depth, error) { // Trades provides the information about the last trades. func (api *PublicAPI) Trades(currency []string, limit int) (Trades, error) { - url := API_URL + "trades/" + url := apiURL + "trades/" for _, c := range currency { url = url + c + "-" } diff --git a/trade.go b/trade.go index b7eb6b2..45c88b0 100644 --- a/trade.go +++ b/trade.go @@ -26,7 +26,7 @@ type TradeAPI struct { lastNonce int64 } -const trade_URL = "https://btc-e.com/tapi" +const tradeURL = "https://btc-e.com/tapi" // Auth provides API key and secret setting for Trade API func (tapi *TradeAPI) Auth(key string, secret string) { @@ -41,9 +41,8 @@ func (tapi *TradeAPI) GetInfo() (AccountInfo, error) { err := tapi.call("getInfo", &info, nil) if err == nil { return info, nil - } else { - return info, err } + return info, err } // GetInfoAuth provides GetInfo capability with authorization @@ -295,7 +294,7 @@ func (tapi *TradeAPI) call(method string, v interface{}, params map[string]strin postData := tapi.encodePostData(method, params) - req, err := http.NewRequest("POST", trade_URL, bytes.NewBufferString(postData)) + req, err := http.NewRequest("POST", tradeURL, bytes.NewBufferString(postData)) req.Header.Add("Key", tapi.API_KEY) req.Header.Add("Sign", sign(tapi.API_SECRET, postData)) req.Header.Add("Content-Type", "application/x-www-form-urlencoded")