From 54784f8c54eca9d5476f36b0301f8e2c5be23afd Mon Sep 17 00:00:00 2001 From: edwin Date: Mon, 5 Feb 2024 17:02:46 +0800 Subject: [PATCH] pkg/exchange: rm timestamp --- pkg/exchange/binance/binanceapi/client_test.go | 1 - .../binanceapi/transfer_asset_request.go | 4 ---- .../transfer_asset_request_requestgen.go | 18 +----------------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/pkg/exchange/binance/binanceapi/client_test.go b/pkg/exchange/binance/binanceapi/client_test.go index bbff02195..3aadde969 100644 --- a/pkg/exchange/binance/binanceapi/client_test.go +++ b/pkg/exchange/binance/binanceapi/client_test.go @@ -168,7 +168,6 @@ func TestClient_NewTransferAssetRequest(t *testing.T) { req.FromSymbol("BTCUSDT") req.ToSymbol("BTCUSDT") req.Amount("0.01") - req.Timestamp(time.Now()) req.TransferType(TransferAssetTypeIsolatedMarginToMain) res, err := req.Do(ctx) assert.NoError(t, err) diff --git a/pkg/exchange/binance/binanceapi/transfer_asset_request.go b/pkg/exchange/binance/binanceapi/transfer_asset_request.go index b61276fc8..5c3f7404e 100644 --- a/pkg/exchange/binance/binanceapi/transfer_asset_request.go +++ b/pkg/exchange/binance/binanceapi/transfer_asset_request.go @@ -1,8 +1,6 @@ package binanceapi import ( - "time" - "github.com/c9s/requestgen" ) @@ -29,8 +27,6 @@ type TransferAssetRequest struct { amount string `param:"amount"` - timestamp time.Time `param:"timestamp,milliseconds,query"` - fromSymbol *string `param:"fromSymbol"` toSymbol *string `param:"toSymbol"` } diff --git a/pkg/exchange/binance/binanceapi/transfer_asset_request_requestgen.go b/pkg/exchange/binance/binanceapi/transfer_asset_request_requestgen.go index 5b22a5e2e..12e98f083 100644 --- a/pkg/exchange/binance/binanceapi/transfer_asset_request_requestgen.go +++ b/pkg/exchange/binance/binanceapi/transfer_asset_request_requestgen.go @@ -9,15 +9,8 @@ import ( "net/url" "reflect" "regexp" - "strconv" - "time" ) -func (t *TransferAssetRequest) Timestamp(timestamp time.Time) *TransferAssetRequest { - t.timestamp = timestamp - return t -} - func (t *TransferAssetRequest) Asset(asset string) *TransferAssetRequest { t.asset = asset return t @@ -46,12 +39,6 @@ func (t *TransferAssetRequest) ToSymbol(toSymbol string) *TransferAssetRequest { // GetQueryParameters builds and checks the query parameters and returns url.Values func (t *TransferAssetRequest) GetQueryParameters() (url.Values, error) { var params = map[string]interface{}{} - // check timestamp field -> json key timestamp - timestamp := t.timestamp - - // assign parameter of timestamp - // convert time.Time to milliseconds time stamp - params["timestamp"] = strconv.FormatInt(timestamp.UnixNano()/int64(time.Millisecond), 10) query := url.Values{} for _k, _v := range params { @@ -201,10 +188,7 @@ func (t *TransferAssetRequest) Do(ctx context.Context) (*TransferResponse, error if err != nil { return nil, err } - query, err := t.GetQueryParameters() - if err != nil { - return nil, err - } + query := url.Values{} var apiURL string