Split common package more and QA

This commit is contained in:
Adrian Gallagher
2019-06-07 20:52:44 +10:00
parent cbd3e7bacd
commit 04c7c4895f
16 changed files with 148 additions and 180 deletions

View File

@@ -13,6 +13,7 @@ import (
"github.com/gorilla/websocket"
"github.com/thrasher-/gocryptotrader/common"
"github.com/thrasher-/gocryptotrader/common/convert"
"github.com/thrasher-/gocryptotrader/common/crypto"
"github.com/thrasher-/gocryptotrader/currency"
exchange "github.com/thrasher-/gocryptotrader/exchanges"
@@ -487,7 +488,7 @@ func (b *Binance) SendAuthHTTPRequest(method, path string, params url.Values, re
if params == nil {
params = url.Values{}
}
params.Set("recvWindow", strconv.FormatInt(common.RecvWindow(5*time.Second), 10))
params.Set("recvWindow", strconv.FormatInt(convert.RecvWindow(5*time.Second), 10))
params.Set("timestamp", strconv.FormatInt(time.Now().Unix()*1000, 10))
signature := params.Encode()

View File

@@ -144,6 +144,9 @@ func (e *Base) SetFeatureDefaults() {
// SetAPICredentialDefaults sets the API Credential validator defaults
func (e *Base) SetAPICredentialDefaults() {
// Exchange hardcoded settings take precedence and overwrite the config settings
if e.Config.API.CredentialsValidator == nil {
e.Config.API.CredentialsValidator = new(config.APICredentialsValidatorConfig)
}
if e.Config.API.CredentialsValidator.RequiresKey != e.API.CredentialsValidator.RequiresKey {
e.Config.API.CredentialsValidator.RequiresKey = e.API.CredentialsValidator.RequiresKey
}

View File

@@ -303,7 +303,7 @@ func (z *ZB) SendAuthenticatedHTTPRequest(httpMethod string, params url.Values,
[]byte(params.Encode()),
[]byte(crypto.Sha1ToHex(z.API.Credentials.Secret)))
params.Set("reqTime", fmt.Sprintf("%d", common.UnixMillis(time.Now())))
params.Set("reqTime", fmt.Sprintf("%d", convert.UnixMillis(time.Now())))
params.Set("sign", fmt.Sprintf("%x", hmac))
urlPath := fmt.Sprintf("%s/%s?%s",