-
Notifications
You must be signed in to change notification settings - Fork 26
/
contracts_test.go
60 lines (54 loc) · 1.23 KB
/
contracts_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
package kumex
import "testing"
func TestApiService_ActiveContracts(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.ActiveContracts()
if err != nil {
t.Fatal(err)
}
c := ContractsModels{}
if err := rsp.ReadData(&c); err != nil {
t.Fatal(err)
}
for _, o := range c {
t.Log(ToJsonString(o))
switch {
case o.BaseCurrency == "":
t.Error("Empty key 'baseCurrency'")
case o.Symbol == "":
t.Error("Empty key 'symbol'")
//case o.FairMethod == "":
// t.Error("Empty key 'fairMethod'")
case o.IndexSymbol == "":
t.Error("Empty key 'indexSymbol'")
case o.MaxLeverage < 0:
t.Error("Empty key 'maxLeverage'")
}
}
}
func TestApiService_Contracts(t *testing.T) {
t.SkipNow()
s := NewApiServiceFromEnv()
rsp, err := s.Contracts("XBTUSDTM")
if err != nil {
t.Fatal(err)
}
o := &ContractsModel{}
if err := rsp.ReadData(o); err != nil {
t.Fatal(err)
}
t.Log(ToJsonString(o))
switch {
case o.BaseCurrency == "":
t.Error("Empty key 'baseCurrency'")
case o.Symbol == "":
t.Error("Empty key 'symbol'")
case o.FairMethod == "":
t.Error("Empty key 'fairMethod'")
case o.IndexSymbol == "":
t.Error("Empty key 'indexSymbol'")
case o.MaxLeverage < 0:
t.Error("Empty key 'maxLeverage'")
}
}