mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
pkg/exchange: rm timestamp
This commit is contained in:
parent
c73fc65c6d
commit
54784f8c54
|
@ -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)
|
||||
|
|
|
@ -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"`
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user