mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
113 lines
2.4 KiB
Go
113 lines
2.4 KiB
Go
package max
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAccountService_GetAccountsRequest(t *testing.T) {
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
if !ok {
|
|
t.SkipNow()
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
client.Auth(key, secret)
|
|
|
|
req := client.NewGetAccountsRequest()
|
|
accounts, err := req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, accounts)
|
|
assert.NotEmpty(t, accounts)
|
|
|
|
t.Logf("accounts: %+v", accounts)
|
|
}
|
|
|
|
func TestAccountService_GetAccountRequest(t *testing.T) {
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
if !ok {
|
|
t.SkipNow()
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
client.Auth(key, secret)
|
|
|
|
req := client.NewGetAccountRequest()
|
|
req.Currency("twd")
|
|
account, err := req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, account)
|
|
t.Logf("account: %+v", account)
|
|
|
|
req2 := client.NewGetAccountRequest()
|
|
req2.Currency("usdt")
|
|
account, err = req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, account)
|
|
t.Logf("account: %+v", account)
|
|
}
|
|
|
|
func TestAccountService_GetVipLevelRequest(t *testing.T) {
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
if !ok {
|
|
t.SkipNow()
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
client.Auth(key, secret)
|
|
|
|
req := client.NewGetVipLevelRequest()
|
|
vipLevel, err := req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, vipLevel)
|
|
t.Logf("vipLevel: %+v", vipLevel)
|
|
}
|
|
|
|
func TestAccountService_GetWithdrawHistoryRequest(t *testing.T) {
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
if !ok {
|
|
t.SkipNow()
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
client.Auth(key, secret)
|
|
|
|
req := client.NewGetWithdrawalHistoryRequest()
|
|
req.Currency("usdt")
|
|
withdraws, err := req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, withdraws)
|
|
assert.NotEmpty(t, withdraws)
|
|
t.Logf("withdraws: %+v", withdraws)
|
|
}
|
|
|
|
func TestAccountService_NewGetDepositHistoryRequest(t *testing.T) {
|
|
key, secret, ok := integrationTestConfigured(t, "MAX")
|
|
if !ok {
|
|
t.SkipNow()
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
client := NewRestClient(ProductionAPIURL)
|
|
client.Auth(key, secret)
|
|
|
|
req := client.NewGetDepositHistoryRequest()
|
|
req.Currency("usdt")
|
|
deposits, err := req.Do(ctx)
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, deposits)
|
|
assert.NotEmpty(t, deposits)
|
|
t.Logf("deposits: %+v", deposits)
|
|
}
|