-
Notifications
You must be signed in to change notification settings - Fork 76
/
fill_test.go
63 lines (58 loc) · 1.27 KB
/
fill_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
package kucoin
import (
"context"
"testing"
)
func TestApiService_Fills(t *testing.T) {
s := NewApiServiceFromEnv()
p := &PaginationParam{CurrentPage: 1, PageSize: 10}
rsp, err := s.Fills(context.Background(), map[string]string{}, p)
if err != nil {
t.Fatal(err)
}
fs := FillsModel{}
if _, err := rsp.ReadPaginationData(&fs); err != nil {
t.Fatal(err)
}
for _, f := range fs {
t.Log(ToJsonString(f))
switch {
case f.Symbol == "":
t.Error("Empty key 'symbol'")
case f.TradeId == "":
t.Error("Empty key 'tradeId'")
case f.OrderId == "":
t.Error("Empty key 'orderId'")
case f.Type == "":
t.Error("Empty key 'type'")
case f.Side == "":
t.Error("Empty key 'side'")
}
}
}
func TestApiService_RecentFills(t *testing.T) {
s := NewApiServiceFromEnv()
rsp, err := s.RecentFills(context.Background())
if err != nil {
t.Fatal(err)
}
fs := FillsModel{}
if err := rsp.ReadData(&fs); err != nil {
t.Fatal(err)
}
for _, f := range fs {
t.Log(ToJsonString(f))
switch {
case f.Symbol == "":
t.Error("Empty key 'symbol'")
case f.TradeId == "":
t.Error("Empty key 'tradeId'")
case f.OrderId == "":
t.Error("Empty key 'orderId'")
case f.Type == "":
t.Error("Empty key 'type'")
case f.Side == "":
t.Error("Empty key 'side'")
}
}
}