39 lines
764 B
Go
39 lines
764 B
Go
package batch
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"git.qtrade.icu/lychiyu/bbgo/pkg/exchange/binance"
|
|
"git.qtrade.icu/lychiyu/bbgo/pkg/testutil"
|
|
)
|
|
|
|
func TestWithdrawBatchQuery(t *testing.T) {
|
|
key, secret, ok := testutil.IntegrationTestConfigured(t, "BINANCE")
|
|
if !ok {
|
|
t.Skip("binance api is not set")
|
|
}
|
|
|
|
ex := binance.New(key, secret)
|
|
q := WithdrawBatchQuery{
|
|
ExchangeTransferService: ex,
|
|
}
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
|
defer cancel()
|
|
now := time.Now()
|
|
startTime := now.AddDate(0, -6, 0)
|
|
endTime := now
|
|
dataC, errC := q.Query(ctx, "", startTime, endTime)
|
|
|
|
for withdraw := range dataC {
|
|
t.Logf("%+v", withdraw)
|
|
}
|
|
|
|
err := <-errC
|
|
assert.NoError(t, err)
|
|
}
|