mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-30 07:26:46 +00:00
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:
@@ -3,7 +3,6 @@ package exmo
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strconv"
|
||||
@@ -42,14 +41,13 @@ const (
|
||||
exmoWalletHistory = "wallet_history"
|
||||
|
||||
// Rate limit: 180 per/minute
|
||||
exmoAuthRate = 333
|
||||
exmoUnauthRate = 333
|
||||
exmoAuthRate = 180
|
||||
exmoUnauthRate = 180
|
||||
)
|
||||
|
||||
// EXMO exchange struct
|
||||
type EXMO struct {
|
||||
exchange.Base
|
||||
*request.Handler
|
||||
}
|
||||
|
||||
// SetDefaults sets the basic defaults for exmo
|
||||
@@ -66,8 +64,8 @@ func (e *EXMO) SetDefaults() {
|
||||
e.ConfigCurrencyPairFormat.Uppercase = true
|
||||
e.AssetTypes = []string{ticker.Spot}
|
||||
e.SupportsAutoPairUpdating = true
|
||||
e.Handler = new(request.Handler)
|
||||
e.SetRequestHandler(e.Name, exmoAuthRate, exmoUnauthRate, new(http.Client))
|
||||
e.SupportsRESTTickerBatching = true
|
||||
e.Requester = request.New(e.Name, request.NewRateLimit(time.Minute, exmoAuthRate), request.NewRateLimit(time.Minute, exmoUnauthRate), common.NewHTTPClientWithTimeout(exchange.DefaultHTTPTimeout))
|
||||
}
|
||||
|
||||
// Setup takes in the supplied exchange configuration details and sets params
|
||||
@@ -78,6 +76,7 @@ func (e *EXMO) Setup(exch config.ExchangeConfig) {
|
||||
e.Enabled = true
|
||||
e.AuthenticatedAPISupport = exch.AuthenticatedAPISupport
|
||||
e.SetAPIKeys(exch.APIKey, exch.APISecret, "", false)
|
||||
e.SetHTTPClientTimeout(exch.HTTPTimeout)
|
||||
e.RESTPollingDelay = exch.RESTPollingDelay
|
||||
e.Verbose = exch.Verbose
|
||||
e.Websocket = exch.Websocket
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
@@ -13,8 +14,12 @@ import (
|
||||
)
|
||||
|
||||
// Start starts the EXMO go routine
|
||||
func (e *EXMO) Start() {
|
||||
go e.Run()
|
||||
func (e *EXMO) Start(wg *sync.WaitGroup) {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
e.Run()
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
|
||||
// Run implements the EXMO wrapper
|
||||
@@ -32,7 +37,7 @@ func (e *EXMO) Run() {
|
||||
for x := range exchangeProducts {
|
||||
currencies = append(currencies, x)
|
||||
}
|
||||
err = e.UpdateAvailableCurrencies(currencies, false)
|
||||
err = e.UpdateCurrencies(currencies, false, false)
|
||||
if err != nil {
|
||||
log.Printf("%s Failed to update available currencies.\n", e.GetName())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user