-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdeposit_test.go
78 lines (69 loc) · 1.96 KB
/
deposit_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
package upbit
import (
"github.com/sangx2/upbit/model/exchange"
"testing"
)
func TestDeposit(t *testing.T) {
var uuids []string
if len(accessKey) != 0 && len(secretKey) != 0 {
u := NewUpbit(accessKey, secretKey)
if u == nil {
t.Fatalf("NewUpbit is nil")
}
deposits, remaining, e := u.GetDeposits(currency, exchange.DEPOSIT_STATE_ACCEPTED, nil, nil, "100", "1", exchange.ORDERBY_ASC)
if e != nil {
t.Errorf("GetDeposits error : %s", e.Error())
} else {
t.Logf("GetDeposits[remaining:%+v]", *remaining)
for _, deposit := range deposits {
t.Logf("%+v", *deposit)
uuids = append(uuids, deposit.UUID)
}
}
if len(uuids) != 0 {
deposit, remaining, e := u.GetDeposit(uuids[0], "", "")
if e != nil {
t.Logf("GetDeposit error : %s", e.Error())
} else {
if deposit != nil {
t.Logf("GetDeposit[remaining:%+v]\n%+v", *remaining, *deposit)
}
}
}
coinAddress, remaining, e := u.GenerateDepositCoinAddress(currency)
if e != nil {
t.Logf("GenerateDepositCoinAddress error : %s", e.Error())
} else {
if coinAddress != nil {
t.Logf("GenerateDepositCoinAddress[remaining:%+v]\n%+v", *remaining, *coinAddress)
}
}
coinAddresses, remaining, e := u.GetDepositCoinAddresses()
if e != nil {
t.Logf("GetDepositCoinAddresses error : %s", e.Error())
} else {
t.Logf("GetDepositCoinAddresses[remaining:%+v]", *remaining)
for _, coinAddress := range coinAddresses {
t.Logf("%+v", *coinAddress)
}
}
coinAddress, remaining, e = u.GetDepositCoinAddress(currency)
if e != nil {
t.Fatalf("GetDepositCoinAddress error : %s", e.Error())
} else {
if coinAddress != nil {
t.Logf("GetDepositCoinAddress[remaining:%+v]\n%+v", *remaining, *coinAddress)
}
}
/*
deposit, remaining, e := u.DepositKrw("5000")
if e != nil {
t.Fatalf("DepositKrw error : %s", e.Error())
} else {
if deposit != nil {
t.Logf("DepositKrw[remaining:%+v]\n%+v", *remaining, *deposit)
}
}
*/
}
}