forked from Kucoin/kucoin-futures-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transfer_test.go
100 lines (91 loc) · 1.97 KB
/
transfer_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package kumex
import (
"testing"
)
func TestApiService_TransferOut(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.TransferOut("123", "0.1")
if err != nil {
t.Fatal(err)
}
w := &TransferOutModel{}
if err := rsp.ReadData(w); err != nil {
t.Fatal(err)
}
t.Log(ToJsonString(w))
switch {
case w.ApplyId == "":
t.Error("Empty key 'applyId'")
}
}
func TestApiService_TransferList(t *testing.T) {
s := NewApiServiceFromEnv()
p := map[string]string{}
pp := &PaginationParam{CurrentPage: 1, PageSize: 10}
rsp, err := s.TransferList(p, pp)
if err != nil {
t.Fatal(err)
}
ds := TransfersModel{}
if _, err := rsp.ReadPaginationData(&ds); err != nil {
t.Fatal(err)
}
for _, d := range ds {
t.Log(ToJsonString(d))
switch {
case d.ApplyId == "":
t.Error("Empty key 'applyId'")
case d.Amount == "":
t.Error("Empty key 'amount'")
case d.Currency == "":
t.Error("Empty key 'currency'")
case d.Offset == 0:
t.Error("Empty key 'offset'")
case d.Status == "":
t.Error("Empty key 'status'")
case d.CreatedAt == 0:
t.Error("Empty key 'createdAt'")
}
}
}
func TestApiService_CancelTransfer(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.CancelTransfer("xxx")
if err != nil {
t.Fatal(err)
}
w := &CancelTransferModel{}
if err := rsp.ReadData(w); err != nil {
t.Fatal(err)
}
t.Log(ToJsonString(w))
switch {
case len(w.ApplyId) == 0:
t.Error("Empty key 'applyId'")
}
}
func TestApiService_TransferIn(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.TransferIn("USDT", "TRADE", "2")
if err != nil {
t.Fatal(err)
}
t.Log(ToJsonString(rsp.Message))
t.Log(ToJsonString(rsp.Code))
}
func TestApiService_TransferOutV3(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.TransferOutV3("USDT", "TRADE", "0.5")
if err != nil {
t.Fatal(err)
}
w := &TransferOutV3Res{}
if err := rsp.ReadData(w); err != nil {
t.Fatal(err)
}
t.Log(ToJsonString(w))
}