qbtrade/pkg/exchange/okex/query_order_trades_test.go
2024-06-27 22:42:38 +08:00

41 lines
1022 B
Go

package okex
import (
"context"
"testing"
"time"
"git.qtrade.icu/lychiyu/qbtrade/pkg/testutil"
"git.qtrade.icu/lychiyu/qbtrade/pkg/types"
"github.com/stretchr/testify/assert"
)
func Test_QueryOrderTrades(t *testing.T) {
key, secret, passphrase, ok := testutil.IntegrationTestWithPassphraseConfigured(t, "OKEX")
if !ok {
t.Skip("Please configure all credentials about OKEX")
}
e := New(key, secret, passphrase)
queryOrder := types.OrderQuery{
OrderID: "609869603774656544",
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
transactionDetail, err := e.QueryOrderTrades(ctx, queryOrder)
if assert.NoError(t, err) {
assert.NotEmpty(t, transactionDetail)
}
t.Logf("transaction detail: %+v", transactionDetail)
queryOrder = types.OrderQuery{
Symbol: "BTC-USDT",
}
transactionDetail, err = e.QueryOrderTrades(ctx, queryOrder)
if assert.NoError(t, err) {
assert.NotEmpty(t, transactionDetail)
}
t.Logf("transaction detail: %+v", transactionDetail)
}