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

@@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"log"
"net/http"
"net/url"
"strconv"
"time"
@@ -38,7 +37,6 @@ const (
// ItBit is the overarching type across the ItBit package
type ItBit struct {
exchange.Base
*request.Handler
}
// SetDefaults sets the defaults for the exchange
@@ -56,8 +54,8 @@ func (i *ItBit) SetDefaults() {
i.ConfigCurrencyPairFormat.Uppercase = true
i.AssetTypes = []string{ticker.Spot}
i.SupportsAutoPairUpdating = false
i.Handler = new(request.Handler)
i.SetRequestHandler(i.Name, itbitAuthRate, itbitUnauthRate, new(http.Client))
i.SupportsRESTTickerBatching = false
i.Requester = request.New(i.Name, request.NewRateLimit(time.Second, itbitAuthRate), request.NewRateLimit(time.Second, itbitUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
}
// Setup sets the exchange parameters from exchange config
@@ -68,6 +66,7 @@ func (i *ItBit) Setup(exch config.ExchangeConfig) {
i.Enabled = true
i.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
i.SetAPIKeys(exch.APIKey, exch.APISecret, exch.ClientID, false)
i.SetHTTPClientTimeout(exch.HTTPTimeout)
i.RESTPollingDelay = exch.RESTPollingDelay
i.Verbose = exch.Verbose
i.Websocket = exch.Websocket

View File

@@ -4,6 +4,7 @@ import (
"errors"
"log"
"strconv"
"sync"
"github.com/thrasher-/gocryptotrader/currency/pair"
"github.com/thrasher-/gocryptotrader/exchanges"
@@ -12,8 +13,12 @@ import (
)
// Start starts the ItBit go routine
func (i *ItBit) Start() {
go i.Run()
func (i *ItBit) Start(wg *sync.WaitGroup) {
wg.Add(1)
go func() {
i.Run()
wg.Done()
}()
}
// Run implements the ItBit wrapper