mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 15:10:44 +00:00
modernise: Run new gopls modernise tool against the codebase and fix minor issues (#1826)
* modernise: Run new gopls modernise tool against codebase
* Address shazbert's nits
* apichecker, gctcli: Simplify HTML scraping functions and improve depth limit handling
* refactor: Create minSyncInterval const and update order book limit handling for binance and binanceUS
* refactor: Various slice usage improvements and rename TODO
* tranches: Revert deleteByID changes due to performance decrease
Shazbert was a F1 driver in a past lifetime 🏎️
* tranches: Simply retrieve copy
Thanks to shazbert
* documentation: Sort contributors list by contributions
* tranches: Remove deadcode in deleteByID
This commit is contained in:
@@ -928,7 +928,7 @@ func (g *Gateio) CancelPriceTriggeredOrder(ctx context.Context, orderID string)
|
||||
}
|
||||
|
||||
// GenerateSignature returns hash for authenticated requests
|
||||
func (g *Gateio) GenerateSignature(secret, method, path, query string, body interface{}, dtime time.Time) (string, error) {
|
||||
func (g *Gateio) GenerateSignature(secret, method, path, query string, body any, dtime time.Time) (string, error) {
|
||||
h := sha512.New()
|
||||
if body != nil {
|
||||
val, err := json.Marshal(body)
|
||||
@@ -952,7 +952,7 @@ func (g *Gateio) GenerateSignature(secret, method, path, query string, body inte
|
||||
|
||||
// SendAuthenticatedHTTPRequest sends authenticated requests to the Gateio API
|
||||
// To use this you must setup an APIKey and APISecret from the exchange
|
||||
func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, method, endpoint string, param url.Values, data, result interface{}) error {
|
||||
func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, method, endpoint string, param url.Values, data, result any) error {
|
||||
creds, err := g.GetCredentials(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1026,7 +1026,7 @@ func (g *Gateio) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.U
|
||||
}
|
||||
|
||||
// SendHTTPRequest sends an unauthenticated HTTP request
|
||||
func (g *Gateio) SendHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, path string, result interface{}) error {
|
||||
func (g *Gateio) SendHTTPRequest(ctx context.Context, ep exchange.URL, epl request.EndpointLimit, path string, result any) error {
|
||||
endpoint, err := g.API.Endpoints.GetURL(ep)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -2742,7 +2742,7 @@ func TestOptionsOrderbookPushData(t *testing.T) {
|
||||
assert.NoError(t, g.WsHandleOptionsData(context.Background(), []byte(optionsOrderbookTickerPushDataJSON)))
|
||||
avail, err := g.GetAvailablePairs(asset.Options)
|
||||
require.NoError(t, err, "GetAvailablePairs must not error")
|
||||
assert.NoError(t, g.WsHandleOptionsData(context.Background(), []byte(fmt.Sprintf(optionsOrderbookUpdatePushDataJSON, avail[0].Upper().String()))))
|
||||
assert.NoError(t, g.WsHandleOptionsData(context.Background(), fmt.Appendf(nil, optionsOrderbookUpdatePushDataJSON, avail[0].Upper().String())))
|
||||
assert.NoError(t, g.WsHandleOptionsData(context.Background(), []byte(optionsOrderbookSnapshotPushDataJSON)))
|
||||
assert.NoError(t, g.WsHandleOptionsData(context.Background(), []byte(optionsOrderbookSnapshotUpdateEventPushDataJSON)))
|
||||
}
|
||||
|
||||
@@ -1240,7 +1240,7 @@ type MarginLoanRequestParam struct {
|
||||
Amount types.Number `json:"amount,omitempty"`
|
||||
Days int64 `json:"days,omitempty"`
|
||||
AutoRenew bool `json:"auto_renew,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitzero"`
|
||||
FeeRate types.Number `json:"fee_rate,omitempty"`
|
||||
OrigID string `json:"orig_id,omitempty"`
|
||||
Text string `json:"text,omitempty"`
|
||||
@@ -1367,7 +1367,7 @@ type SpotAccount struct {
|
||||
// CreateOrderRequestData represents a single order creation param.
|
||||
type CreateOrderRequestData struct {
|
||||
Text string `json:"text,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitzero"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Side string `json:"side,omitempty"`
|
||||
@@ -1385,8 +1385,8 @@ type SpotOrder struct {
|
||||
Succeeded bool `json:"succeeded"`
|
||||
ErrorLabel string `json:"label,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
CreateTime types.Time `json:"create_time_ms,omitempty"`
|
||||
UpdateTime types.Time `json:"update_time_ms,omitempty"`
|
||||
CreateTime types.Time `json:"create_time_ms,omitzero"`
|
||||
UpdateTime types.Time `json:"update_time_ms,omitzero"`
|
||||
CurrencyPair string `json:"currency_pair,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
@@ -2077,7 +2077,7 @@ type WsSpotOrder struct {
|
||||
Succeeded bool `json:"succeeded,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitempty"`
|
||||
CurrencyPair currency.Pair `json:"currency_pair,omitzero"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
Side string `json:"side,omitempty"`
|
||||
@@ -2095,8 +2095,8 @@ type WsSpotOrder struct {
|
||||
RebatedFee string `json:"rebated_fee,omitempty"`
|
||||
RebatedFeeCurrency string `json:"rebated_fee_currency,omitempty"`
|
||||
Event string `json:"event"`
|
||||
CreateTime types.Time `json:"create_time_ms,omitempty"`
|
||||
UpdateTime types.Time `json:"update_time_ms,omitempty"`
|
||||
CreateTime types.Time `json:"create_time_ms,omitzero"`
|
||||
UpdateTime types.Time `json:"update_time_ms,omitzero"`
|
||||
}
|
||||
|
||||
// WsUserPersonalTrade represents a user's personal trade pushed through the websocket connection.
|
||||
|
||||
Reference in New Issue
Block a user