Fix WEX linter issues

This commit is contained in:
Adrian Gallagher
2017-09-16 13:18:28 +10:00
parent 542828e957
commit 05b2bc0d56
2 changed files with 30 additions and 13 deletions

View File

@@ -1,22 +1,25 @@
package wex
// Ticker stores the ticker information
type Ticker struct {
High float64
Low float64
Avg float64
Vol float64
Vol_cur float64
Last float64
Buy float64
Sell float64
Updated int64
High float64
Low float64
Avg float64
Vol float64
VolumeCurrent float64 `json:"vol_cur"`
Last float64
Buy float64
Sell float64
Updated int64
}
// Orderbook stores the asks and bids orderbook information
type Orderbook struct {
Asks [][]float64 `json:"asks"`
Bids [][]float64 `json:"bids"`
}
// Trades stores trade information
type Trades struct {
Type string `json:"type"`
Price float64 `json:"bid"`
@@ -25,12 +28,14 @@ type Trades struct {
Timestamp int64 `json:"timestamp"`
}
// Response is a generic struct used for exchange API request result
type Response struct {
Return interface{} `json:"return"`
Success int `json:"success"`
Error string `json:"error"`
}
// Pair holds pair information
type Pair struct {
DecimalPlaces int `json:"decimal_places"`
MinPrice float64 `json:"min_price"`
@@ -40,11 +45,13 @@ type Pair struct {
Fee float64 `json:"fee"`
}
// Info holds server time and pair information
type Info struct {
ServerTime int64 `json:"server_time"`
Pairs map[string]Pair `json:"pairs"`
}
// AccountInfo stores the account information for a user
type AccountInfo struct {
Funds map[string]float64 `json:"funds"`
OpenOrders int `json:"open_orders"`
@@ -57,6 +64,7 @@ type AccountInfo struct {
TransactionCount int `json:"transaction_count"`
}
// ActiveOrders stores active order information
type ActiveOrders struct {
Pair string `json:"pair"`
Type string `json:"sell"`
@@ -66,6 +74,7 @@ type ActiveOrders struct {
Status int `json:"status"`
}
// OrderInfo stores order information
type OrderInfo struct {
Pair string `json:"pair"`
Type string `json:"sell"`
@@ -76,11 +85,13 @@ type OrderInfo struct {
Status int `json:"status"`
}
// CancelOrder is used for the CancelOrder API request response
type CancelOrder struct {
OrderID float64 `json:"order_id"`
Funds map[string]float64 `json:"funds"`
}
// Trade stores the trade information
type Trade struct {
Received float64 `json:"received"`
Remains float64 `json:"remains"`
@@ -88,6 +99,7 @@ type Trade struct {
Funds map[string]float64 `json:"funds"`
}
// TransHistory stores transaction history
type TransHistory struct {
Type int `json:"type"`
Amount float64 `json:"amount"`
@@ -97,6 +109,7 @@ type TransHistory struct {
Timestamp float64 `json:"timestamp"`
}
// TradeHistory stores trade history
type TradeHistory struct {
Pair string `json:"pair"`
Type string `json:"type"`
@@ -107,22 +120,26 @@ type TradeHistory struct {
Timestamp float64 `json:"timestamp"`
}
// CoinDepositAddress stores a curency deposit address
type CoinDepositAddress struct {
Address string `json:"address"`
}
// WithdrawCoins stores information for a withdrawcoins request
type WithdrawCoins struct {
TID int64 `json:"tId"`
AmountSent float64 `json:"amountSent"`
Funds map[string]float64 `json:"funds"`
}
// CreateCoupon stores information coupon information
type CreateCoupon struct {
Coupon string `json:"coupon"`
TransID int64 `json:"transID"`
Funds map[string]float64 `json:"funds"`
}
// RedeemCoupon stores redeem coupon information
type RedeemCoupon struct {
CouponAmount float64 `json:"couponAmount,string"`
CouponCurrency string `json:"couponCurrency"`

View File

@@ -10,12 +10,12 @@ import (
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
)
// Start starts the BTCE go routine
// Start starts the WEX go routine
func (w *WEX) Start() {
go w.Run()
}
// Run implements the BTCE wrapper
// Run implements the WEX wrapper
func (w *WEX) Run() {
if w.Verbose {
log.Printf("%s Websocket: %s.", w.GetName(), common.IsEnabled(w.Websocket))
@@ -46,7 +46,7 @@ func (w *WEX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price,
tp.Bid = result[currency].Buy
tp.Last = result[currency].Last
tp.Low = result[currency].Low
tp.Volume = result[currency].Vol_cur
tp.Volume = result[currency].VolumeCurrent
ticker.ProcessTicker(w.Name, x, tp, assetType)
}
return ticker.GetTicker(w.Name, p, assetType)
@@ -93,7 +93,7 @@ func (w *WEX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.
}
// GetExchangeAccountInfo retrieves balances for all enabled currencies for the
// BTCE exchange
// WEX exchange
func (w *WEX) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
var response exchange.AccountInfo
response.ExchangeName = w.GetName()