mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 15:11:03 +00:00
Fix various issues for goreport
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user