mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Split common package more and QA
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user