mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 15:10:03 +00:00
Run gofmt and fix poloniex orderbook issue
Fixes https://github.com/thrasher-/gocryptotrader/issues/40
This commit is contained in:
@@ -268,7 +268,7 @@ func QueryYahooCurrencyValues(currencies string) error {
|
||||
pairs = currencyPairs[index : index+maxCurrencyPairsPerRequest]
|
||||
index += maxCurrencyPairsPerRequest
|
||||
} else {
|
||||
pairs = currencyPairs[index:len(currencyPairs)]
|
||||
pairs = currencyPairs[index:]
|
||||
index += (len(currencyPairs) - index)
|
||||
}
|
||||
err = FetchYahooCurrencyData(pairs)
|
||||
@@ -277,7 +277,7 @@ func QueryYahooCurrencyValues(currencies string) error {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pairs = currencyPairs[index:len(currencyPairs)]
|
||||
pairs = currencyPairs[index:]
|
||||
err = FetchYahooCurrencyData(pairs)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -54,12 +54,12 @@ func (a *Alphapoint) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBas
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data.Quantity, Price: data.Price})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data.Quantity, Price: data.Price})
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ func (b *Bitfinex) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase,
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
price, _ := strconv.ParseFloat(orderbookNew.Asks[x].Price, 64)
|
||||
amount, _ := strconv.ParseFloat(orderbookNew.Asks[x].Amount, 64)
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Price: price, Amount: amount})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
price, _ := strconv.ParseFloat(orderbookNew.Bids[x].Price, 64)
|
||||
amount, _ := strconv.ParseFloat(orderbookNew.Bids[x].Amount, 64)
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Price: price, Amount: amount})
|
||||
|
||||
@@ -79,12 +79,12 @@ func (b *Bitstamp) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase,
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data.Amount, Price: data.Price})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data.Amount, Price: data.Price})
|
||||
}
|
||||
|
||||
@@ -78,12 +78,12 @@ func (b *BTCE) 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]})
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ func (b *BTCMarkets) SendAuthenticatedRequest(reqType, path string, data interfa
|
||||
}
|
||||
|
||||
if b.Verbose {
|
||||
log.Printf("Recieved raw: %s\n", resp)
|
||||
log.Printf("Received raw: %s\n", resp)
|
||||
}
|
||||
|
||||
err = common.JSONDecode([]byte(resp), &result)
|
||||
|
||||
@@ -73,12 +73,12 @@ func (b *BTCMarkets) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBas
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
@@ -100,11 +100,11 @@ func (g *Gemini) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, e
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: orderbookNew.Bids[x].Amount, Price: orderbookNew.Bids[x].Price})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: orderbookNew.Asks[x].Amount, Price: orderbookNew.Asks[x].Price})
|
||||
}
|
||||
|
||||
|
||||
@@ -83,12 +83,12 @@ func (h *HUOBI) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, er
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ func (l *LakeBTC) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase,
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: orderbookNew.Bids[x].Amount, Price: orderbookNew.Bids[x].Price})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: orderbookNew.Asks[x].Amount, Price: orderbookNew.Asks[x].Price})
|
||||
}
|
||||
|
||||
|
||||
@@ -90,12 +90,12 @@ func (l *Liqui) GetOrderbookEx(p pair.CurrencyPair) (orderbook.OrderbookBase, er
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
@@ -108,12 +108,12 @@ func (o *OKCoin) GetOrderbookEx(currency pair.CurrencyPair) (orderbook.Orderbook
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data[1], Price: data[0]})
|
||||
}
|
||||
|
||||
@@ -122,15 +122,15 @@ func (p *Poloniex) GetOrderbook(currencyPair string, depth int) (PoloniexOrderbo
|
||||
}
|
||||
|
||||
ob := PoloniexOrderbook{}
|
||||
for x, _ := range resp.Asks {
|
||||
for x := range resp.Asks {
|
||||
data := resp.Asks[x]
|
||||
price, _ := strconv.ParseFloat(data[0].(string), 64)
|
||||
amount := data[1].(float64)
|
||||
ob.Asks = append(ob.Asks, PoloniexOrderbookItem{Price: price, Amount: amount})
|
||||
}
|
||||
|
||||
for x, _ := range resp.Bids {
|
||||
data := resp.Asks[x]
|
||||
for x := range resp.Bids {
|
||||
data := resp.Bids[x]
|
||||
price, _ := strconv.ParseFloat(data[0].(string), 64)
|
||||
amount := data[1].(float64)
|
||||
ob.Bids = append(ob.Bids, PoloniexOrderbookItem{Price: price, Amount: amount})
|
||||
|
||||
@@ -81,12 +81,12 @@ func (p *Poloniex) GetOrderbookEx(currencyPair pair.CurrencyPair) (orderbook.Ord
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Bids {
|
||||
for x := range orderbookNew.Bids {
|
||||
data := orderbookNew.Bids[x]
|
||||
orderBook.Bids = append(orderBook.Bids, orderbook.OrderbookItem{Amount: data.Amount, Price: data.Price})
|
||||
}
|
||||
|
||||
for x, _ := range orderbookNew.Asks {
|
||||
for x := range orderbookNew.Asks {
|
||||
data := orderbookNew.Asks[x]
|
||||
orderBook.Asks = append(orderBook.Asks, orderbook.OrderbookItem{Amount: data.Amount, Price: data.Price})
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func AppendExchangeInfo(exchange, crypto, fiat string, price, volume float64) {
|
||||
}
|
||||
|
||||
func ExchangeInfoAlreadyExists(exchange, crypto, fiat string, price, volume float64) bool {
|
||||
for i, _ := range ExchInfo {
|
||||
for i := range ExchInfo {
|
||||
if ExchInfo[i].Exchange == exchange && ExchInfo[i].FirstCurrency == crypto && ExchInfo[i].FiatCurrency == fiat {
|
||||
ExchInfo[i].Price, ExchInfo[i].Volume = price, volume
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user