/
params.go
212 lines (193 loc) · 4.39 KB
/
params.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
package types
import "time"
// nolint
const (
DefaultPage = 1
DefaultPerPage = 50
)
// nolint
type QueryDealsParams struct {
Address string
Product string
Start int64
End int64
Page int
PerPage int
Side string
}
// NewQueryDealsParams creates a new instance of QueryDealsParams
func NewQueryDealsParams(addr, product string, start, end int64, page, perPage int, side string) QueryDealsParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryDealsParams{
Address: addr,
Product: product,
Start: start,
End: end,
Page: page,
PerPage: perPage,
Side: side,
}
}
// nolint
type QueryMatchParams struct {
Product string
Start int64
End int64
Page int
PerPage int
}
// NewQueryMatchParams creates a new instance of QueryMatchParams
func NewQueryMatchParams(product string, start, end int64, page, perPage int) QueryMatchParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryMatchParams{
Product: product,
Start: start,
End: end,
Page: page,
PerPage: perPage,
}
}
// nolint
type QueryFeeDetailsParams struct {
Address string
Page int
PerPage int
}
// NewQueryFeeDetailsParams creates a new instance of QueryFeeDetailsParams
func NewQueryFeeDetailsParams(addr string, page, perPage int) QueryFeeDetailsParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryFeeDetailsParams{
Address: addr,
Page: page,
PerPage: perPage,
}
}
// nolint
type QueryKlinesParams struct {
Product string
Granularity int
Size int
}
// NewQueryKlinesParams creates a new instance of QueryKlinesParams
func NewQueryKlinesParams(product string, granularity, size int) QueryKlinesParams {
return QueryKlinesParams{
product,
granularity,
size,
}
}
// nolint
type QueryTickerParams struct {
Product string `json:"product"`
Count int `json:"count"`
Sort bool `json:"sort"`
}
// nolint
type QueryOrderListParams struct {
Address string
Product string
Page int
PerPage int
Start int64
End int64
Side string
HideNoFill bool
}
// NewQueryOrderListParams creates a new instance of QueryOrderListParams
func NewQueryOrderListParams(addr, product, side string, page, perPage int, start, end int64,
hideNoFill bool) QueryOrderListParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
if start == 0 && end == 0 {
end = time.Now().Unix()
}
return QueryOrderListParams{
Address: addr,
Product: product,
Page: page,
PerPage: perPage,
Start: start,
End: end,
Side: side,
HideNoFill: hideNoFill,
}
}
// nolint
type QueryAccountOrdersParams struct {
Address string
Start int64
End int64
Page int
PerPage int
}
// NewQueryAccountOrdersParams creates a new instance of QueryAccountOrdersParams
func NewQueryAccountOrdersParams(address string, start int64, end int64, page, perPage int) QueryAccountOrdersParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryAccountOrdersParams{
Address: address,
Start: start,
End: end,
Page: page,
PerPage: perPage,
}
}
// nolint
type QueryTxListParams struct {
Address string
TxType int64
StartTime int64
EndTime int64
Page int
PerPage int
}
// NewQueryTxListParams creates a new instance of QueryTxListParams
func NewQueryTxListParams(addr string, txType, startTime, endTime int64, page, perPage int) QueryTxListParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryTxListParams{
Address: addr,
TxType: txType,
StartTime: startTime,
EndTime: endTime,
Page: page,
PerPage: perPage,
}
}
// nolint
type QueryDexFeesParams struct {
DexHandlingAddr string
BaseAsset string
QuoteAsset string
Page int
PerPage int
}
// NewQueryDexFeesParams creates a new instance of QueryDexFeesParams
func NewQueryDexFeesParams(dexHandlingAddr, baseAsset, quoteAsset string, page, perPage int) QueryDexFeesParams {
if page == 0 && perPage == 0 {
page = DefaultPage
perPage = DefaultPerPage
}
return QueryDexFeesParams{
DexHandlingAddr: dexHandlingAddr,
BaseAsset: baseAsset,
QuoteAsset: quoteAsset,
Page: page,
PerPage: perPage,
}
}