mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +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.FromSymbol("BTCUSDT")
|
||||||
req.ToSymbol("BTCUSDT")
|
req.ToSymbol("BTCUSDT")
|
||||||
req.Amount("0.01")
|
req.Amount("0.01")
|
||||||
req.Timestamp(time.Now())
|
|
||||||
req.TransferType(TransferAssetTypeIsolatedMarginToMain)
|
req.TransferType(TransferAssetTypeIsolatedMarginToMain)
|
||||||
res, err := req.Do(ctx)
|
res, err := req.Do(ctx)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package binanceapi
|
package binanceapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/c9s/requestgen"
|
"github.com/c9s/requestgen"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,8 +27,6 @@ type TransferAssetRequest struct {
|
||||||
|
|
||||||
amount string `param:"amount"`
|
amount string `param:"amount"`
|
||||||
|
|
||||||
timestamp time.Time `param:"timestamp,milliseconds,query"`
|
|
||||||
|
|
||||||
fromSymbol *string `param:"fromSymbol"`
|
fromSymbol *string `param:"fromSymbol"`
|
||||||
toSymbol *string `param:"toSymbol"`
|
toSymbol *string `param:"toSymbol"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,8 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (t *TransferAssetRequest) Timestamp(timestamp time.Time) *TransferAssetRequest {
|
|
||||||
t.timestamp = timestamp
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TransferAssetRequest) Asset(asset string) *TransferAssetRequest {
|
func (t *TransferAssetRequest) Asset(asset string) *TransferAssetRequest {
|
||||||
t.asset = asset
|
t.asset = asset
|
||||||
return t
|
return t
|
||||||
|
@ -46,12 +39,6 @@ func (t *TransferAssetRequest) ToSymbol(toSymbol string) *TransferAssetRequest {
|
||||||
// GetQueryParameters builds and checks the query parameters and returns url.Values
|
// GetQueryParameters builds and checks the query parameters and returns url.Values
|
||||||
func (t *TransferAssetRequest) GetQueryParameters() (url.Values, error) {
|
func (t *TransferAssetRequest) GetQueryParameters() (url.Values, error) {
|
||||||
var params = map[string]interface{}{}
|
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{}
|
query := url.Values{}
|
||||||
for _k, _v := range params {
|
for _k, _v := range params {
|
||||||
|
@ -201,10 +188,7 @@ func (t *TransferAssetRequest) Do(ctx context.Context) (*TransferResponse, error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
query, err := t.GetQueryParameters()
|
query := url.Values{}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var apiURL string
|
var apiURL string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user