forked from hirokisan/bybit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
v5_asset_service.go
293 lines (244 loc) · 10.6 KB
/
v5_asset_service.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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
package bybit
import "github.com/google/go-querystring/query"
// V5AssetServiceI :
type V5AssetServiceI interface {
GetInternalTransferRecords(V5GetInternalTransferRecordsParam) (*V5GetInternalTransferRecordsResponse, error)
GetDepositRecords(V5GetDepositRecordsParam) (*V5GetDepositRecordsResponse, error)
GetSubDepositRecords(V5GetSubDepositRecordsParam) (*V5GetSubDepositRecordsResponse, error)
GetInternalDepositRecords(V5GetInternalDepositRecordsParam) (*V5GetInternalDepositRecordsResponse, error)
GetWithdrawalRecords(V5GetWithdrawalRecordsParam) (*V5GetWithdrawalRecordsResponse, error)
}
// V5AssetService :
type V5AssetService struct {
client *Client
}
// V5GetInternalTransferRecordsParam :
type V5GetInternalTransferRecordsParam struct {
TransferID *string `url:"transferId,omitempty"`
Coin *Coin `url:"coin,omitempty"`
Status *TransferStatusV5 `url:"status,omitempty"`
StartTime *int64 `url:"startTime,omitempty"` // The start timestamp (ms)
EndTime *int64 `url:"endTime,omitempty"` // The start timestamp (ms)
Limit *int `url:"limit,omitempty"` // Limit for data size per page. [1, 50]. Default: 20
Cursor *string `url:"cursor,omitempty"`
}
// V5GetInternalTransferRecordsResponse :
type V5GetInternalTransferRecordsResponse struct {
CommonV5Response `json:",inline"`
Result V5GetInternalTransferRecordsResult `json:"result"`
}
// V5GetInternalTransferRecordsResult :
type V5GetInternalTransferRecordsResult struct {
List V5GetInternalTransferRecordsList `json:"list"`
NextPageCursor string `json:"nextPageCursor"`
}
// V5GetInternalTransferRecordsList :
type V5GetInternalTransferRecordsList []V5GetInternalTransferRecordsItem
// V5GetInternalTransferRecordsItem :
type V5GetInternalTransferRecordsItem struct {
TransferID string `json:"transferId"`
Coin Coin `json:"coin"`
Amount string `json:"amount"`
FromAccountType AccountTypeV5 `json:"fromAccountType"`
ToAccountType AccountTypeV5 `json:"toAccountType"`
Timestamp string `json:"timestamp"`
Status TransferStatusV5 `json:"status"`
}
// GetInternalTransferRecords :
func (s *V5AssetService) GetInternalTransferRecords(param V5GetInternalTransferRecordsParam) (*V5GetInternalTransferRecordsResponse, error) {
var res V5GetInternalTransferRecordsResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/asset/transfer/query-inter-transfer-list", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}
// V5GetDepositRecordsParam :
type V5GetDepositRecordsParam struct {
Coin *Coin `url:"coin,omitempty"`
StartTime *int64 `url:"startTime,omitempty"` // Start time (ms). Default value: 30 days before the current time
EndTime *int64 `url:"endTime,omitempty"` // End time (ms). Default value: current time
Limit *int `url:"limit,omitempty"` // Number of items per page, [1, 50]. Default value: 50
Cursor *string `url:"cursor,omitempty"`
}
// V5GetDepositRecordsResponse :
type V5GetDepositRecordsResponse struct {
CommonV5Response `json:",inline"`
Result V5GetDepositRecordsResult `json:"result"`
}
// V5GetDepositRecordsResult :
type V5GetDepositRecordsResult struct {
Rows V5GetDepositRecordsRows `json:"rows"`
NextPageCursor string `json:"nextPageCursor"`
}
// V5GetDepositRecordsRows :
type V5GetDepositRecordsRows []V5GetDepositRecordsRow
// V5GetDepositRecordsRow :
type V5GetDepositRecordsRow struct {
Coin Coin `json:"coin"`
Chain string `json:"chain"`
Amount string `json:"amount"`
TxID string `json:"txID"`
Status DepositStatusV5 `json:"status"`
ToAddress string `json:"toAddress"`
Tag string `json:"tag"`
DepositFee string `json:"depositFee"`
SuccessAt string `json:"successAt"`
Confirmations string `json:"confirmations"`
TxIndex string `json:"txIndex"`
BlockHash string `json:"blockHash"`
}
// GetDepositRecords :
func (s *V5AssetService) GetDepositRecords(param V5GetDepositRecordsParam) (*V5GetDepositRecordsResponse, error) {
var res V5GetDepositRecordsResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/asset/deposit/query-record", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}
// V5GetSubDepositRecordsParam :
type V5GetSubDepositRecordsParam struct {
SubMemberID string `url:"subMemberId"`
Coin *Coin `url:"coin,omitempty"`
StartTime *int64 `url:"startTime,omitempty"` // Start time (ms). Default value: 30 days before the current time
EndTime *int64 `url:"endTime,omitempty"` // The start timestamp (ms)
Limit *int `url:"limit,omitempty"` // Limit for data size per page. [1, 50]. Default: 50
Cursor *string `url:"cursor,omitempty"`
}
// V5GetSubDepositRecordsResponse :
type V5GetSubDepositRecordsResponse struct {
CommonV5Response `json:",inline"`
Result V5GetSubDepositRecordsResult `json:"result"`
}
// V5GetSubDepositRecordsResult :
type V5GetSubDepositRecordsResult struct {
Rows V5GetSubDepositRecordsRows `json:"rows"`
NextPageCursor string `json:"nextPageCursor"`
}
// V5GetSubDepositRecordsRows :
type V5GetSubDepositRecordsRows []V5GetSubDepositRecordsRow
// V5GetSubDepositRecordsRow :
type V5GetSubDepositRecordsRow struct {
Coin Coin `json:"coin"`
Chain string `json:"chain"`
Amount string `json:"amount"`
TxID string `json:"txID"`
Status DepositStatusV5 `json:"status"`
ToAddress string `json:"toAddress"`
Tag string `json:"tag"`
DepositFee string `json:"depositFee"`
SuccessAt string `json:"successAt"`
Confirmations string `json:"confirmations"`
TxIndex string `json:"txIndex"`
BlockHash string `json:"blockHash"`
}
// GetSubDepositRecords :
func (s *V5AssetService) GetSubDepositRecords(param V5GetSubDepositRecordsParam) (*V5GetSubDepositRecordsResponse, error) {
var res V5GetSubDepositRecordsResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/asset/deposit/query-sub-member-record", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}
// V5GetInternalDepositRecordsParam :
type V5GetInternalDepositRecordsParam struct {
StartTime *int64 `url:"startTime,omitempty"` // Start time (ms). Default value: 30 days before the current time
EndTime *int64 `url:"endTime,omitempty"` // End time (ms). Default value: current time
Coin *Coin `url:"coin,omitempty"`
Cursor *string `url:"cursor,omitempty"`
Limit *int `url:"limit,omitempty"` // Number of items per page, [1, 50]. Default value: 50
}
// V5GetInternalDepositRecordsResponse :
type V5GetInternalDepositRecordsResponse struct {
CommonV5Response `json:",inline"`
Result V5GetInternalDepositRecordsResult `json:"result"`
}
// V5GetInternalDepositRecordsResult :
type V5GetInternalDepositRecordsResult struct {
Rows V5GetInternalDepositRecordsRows `json:"rows"`
NextPageCursor string `json:"nextPageCursor"`
}
// V5GetInternalDepositRecordsRows :
type V5GetInternalDepositRecordsRows []V5GetInternalDepositRecordsRow
// V5GetInternalDepositRecordsRow :
type V5GetInternalDepositRecordsRow struct {
ID string `json:"id"`
Type string `json:"type"`
Coin Coin `json:"coin"`
Amount string `json:"amount"`
Status InternalDepositStatusV5 `json:"status"`
Address string `json:"address"` // Email address or phone number
CreatedTime string `json:"createdTime"`
}
// GetInternalDepositRecords :
func (s *V5AssetService) GetInternalDepositRecords(param V5GetInternalDepositRecordsParam) (*V5GetInternalDepositRecordsResponse, error) {
var res V5GetInternalDepositRecordsResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/asset/deposit/query-internal-record", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}
// V5GetWithdrawalRecordsParam :
type V5GetWithdrawalRecordsParam struct {
WithdrawID *string `url:"withdrawId,omitempty"`
Coin *Coin `url:"coin,omitempty"`
WithdrawType *WithdrawTypeV5 `url:"withdrawType,omitempty"`
StartTime *int64 `url:"startTime,omitempty"` // The start timestamp (ms)
EndTime *int64 `url:"endTime,omitempty"` // The start timestamp (ms)
Limit *int `url:"limit,omitempty"` // Limit for data size per page. [1, 50]. Default: 50
Cursor *string `url:"cursor,omitempty"`
}
// V5GetWithdrawalRecordsResponse :
type V5GetWithdrawalRecordsResponse struct {
CommonV5Response `json:",inline"`
Result V5GetWithdrawalRecordsResult `json:"result"`
}
// V5GetWithdrawalRecordsResult :
type V5GetWithdrawalRecordsResult struct {
Rows V5GetWithdrawalRecordsRows `json:"rows"`
NextPageCursor string `json:"nextPageCursor"`
}
// V5GetWithdrawalRecordsRows :
type V5GetWithdrawalRecordsRows []V5GetWithdrawalRecordsRow
// V5GetWithdrawalRecordsRow :
type V5GetWithdrawalRecordsRow struct {
WithdrawId string `json:"withdrawId"`
TxID string `json:"txId"`
WithdrawType WithdrawTypeV5 `json:"withdrawType"`
Coin Coin `json:"coin"`
Chain string `json:"chain"`
Amount string `json:"amount"`
WithdrawFee string `json:"withdrawFee"`
Status WithdrawStatusV5 `json:"status"`
ToAddress string `json:"toAddress"`
Tag string `json:"tag"`
CreatedTime string `json:"createTime"`
UpdatedTime string `json:"updateTime"`
}
// GetWithdrawalRecords :
func (s *V5AssetService) GetWithdrawalRecords(param V5GetWithdrawalRecordsParam) (*V5GetWithdrawalRecordsResponse, error) {
var res V5GetWithdrawalRecordsResponse
queryString, err := query.Values(param)
if err != nil {
return nil, err
}
if err := s.client.getV5Privately("/v5/asset/withdraw/query-record", queryString, &res); err != nil {
return nil, err
}
return &res, nil
}