New features and bug fixes

- Modifications made to the request package. Planned improvements will be
sending requests on intervals, rate limiter back off support, dynamic tuning
and requests packaged into a request job group.
- Can modify each exchanges individual HTTP client (e.g timeout and
transport settings).
- Bot now uses an exchange config HTTP timeout value.
- Bot now uses a global HTTP timeout (configurable).
- Batched ticker request support for exchanges.
- Ticker and Orderbook fetching now are spanned accross multiple
go routines and regulated by a sync wait group.
- Fixes hack used to load exchanges, now uses a sync wait group.
- Ticker and Orderbook storage and fetching now uses mutex locks.
- New pair function for finding different pairs between two supplied
 pair arrays. This is used for currency pair updates for exchange which
support dynamic updating.
- Shows removal/additions of dynamic updates currencies.
This commit is contained in:
Adrian Gallagher
2018-05-04 13:20:19 +10:00
parent 8eef67339d
commit ac41a7cfad
73 changed files with 1327 additions and 742 deletions

View File

@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"log"
"net/http"
"net/url"
"strconv"
"strings"
@@ -46,7 +45,6 @@ const (
type WEX struct {
exchange.Base
Ticker map[string]Ticker
*request.Handler
}
// SetDefaults sets current default value for WEX
@@ -65,8 +63,8 @@ func (w *WEX) SetDefaults() {
w.ConfigCurrencyPairFormat.Uppercase = true
w.AssetTypes = []string{ticker.Spot}
w.SupportsAutoPairUpdating = false
w.Handler = new(request.Handler)
w.SetRequestHandler(w.Name, wexAuthRate, wexUnauthRate, new(http.Client))
w.SupportsRESTTickerBatching = true
w.Requester = request.New(w.Name, request.NewRateLimit(time.Second, wexAuthRate), request.NewRateLimit(time.Second, wexUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
}
// Setup sets exchange configuration parameters for WEX
@@ -77,6 +75,7 @@ func (w *WEX) Setup(exch config.ExchangeConfig) {
w.Enabled = true
w.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
w.SetAPIKeys(exch.APIKey, exch.APISecret, "", false)
w.SetHTTPClientTimeout(exch.HTTPTimeout)
w.RESTPollingDelay = exch.RESTPollingDelay
w.Verbose = exch.Verbose
w.Websocket = exch.Websocket

View File

@@ -3,6 +3,7 @@ package wex
import (
"errors"
"log"
"sync"
"github.com/thrasher-/gocryptotrader/common"
"github.com/thrasher-/gocryptotrader/currency/pair"
@@ -12,8 +13,12 @@ import (
)
// Start starts the WEX go routine
func (w *WEX) Start() {
go w.Run()
func (w *WEX) Start(wg *sync.WaitGroup) {
wg.Add(1)
go func() {
w.Run()
wg.Done()
}()
}
// Run implements the WEX wrapper