Add nonce package for exchanges

This commit is contained in:
Adrian Gallagher
2017-08-21 15:57:41 +10:00
parent 0fea98857c
commit f3c1f4880d
20 changed files with 256 additions and 61 deletions

View File

@@ -297,8 +297,12 @@ func (b *BTCE) SendAuthenticatedHTTPRequest(method string, values url.Values, re
return fmt.Errorf(exchange.WarningAuthenticatedRequestWithoutCredentialsSet, b.Name)
}
nonce := strconv.FormatInt(time.Now().Unix(), 10)
values.Set("nonce", nonce)
if b.Nonce.Get() == 0 {
b.Nonce.Set(time.Now().Unix())
} else {
b.Nonce.Inc()
}
values.Set("nonce", b.Nonce.String())
values.Set("method", method)
encoded := values.Encode()