-
Notifications
You must be signed in to change notification settings - Fork 2
/
structs.go
280 lines (243 loc) · 9.18 KB
/
structs.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
package uexchange
// Client - ..
type Client struct {
APICredentials Credentials `json:"credentials"`
AuthToken string `json:"authToken"`
}
// Credentials - ..
type Credentials struct {
AccountPublicKey string `json:"PublicKey"` // Utopia Account public key
Password string `json:"password"` // Exchange User password
TwoFACode string `json:"2fa_pin"` // 2-factor-authorization code. optional
}
// APIPlainResponse - ..
type APIPlainResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result string `json:"result"`
}
// APIAuthResponse - ..
type APIAuthResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result APIAuthResultContainer `json:"result"`
}
// APIAuthResultContainer - ..
type APIAuthResultContainer struct {
UserSession UserSessionData `json:"user_session"`
AuthToken string `json:"auth_token"`
}
// UserSessionData - ..
type UserSessionData struct {
User UserData `json:"user"`
APISession APISessionData `json:"session"`
}
// UserData - ..
type UserData struct {
ID string `json:"id"` // exchange user ID -- UUID format
Name string `json:"name"` // username
Status string `json:"status"` // example: active
Lang string `json:"lang"` // user language
}
// APISessionData - ..
type APISessionData struct {
ID string `json:"id"` // session ID -- UUID format
}
// APIBalanceResponse - ..
type APIBalanceResponse struct {
Success bool `json:"success"`
Error string `json:"text"` // srly? text? oh my god, crp.is developers...
Result BalanceResponse `json:"result"`
}
// BalanceResponse - ..
type BalanceResponse struct {
AllBalance []BalanceData `json:"allbalance"`
UserID string `json:"user_id"`
}
// BalanceData - ..
type BalanceData struct {
ID int `json:"id"`
Currency CurrencyData `json:"currency"`
Reserve float64 `json:"reserve"`
Balance float64 `json:"balance"`
}
// APITradeResponse - ..
type APITradeResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result APITradeData `json:"result"`
}
// APITradeData - ..
type APITradeData struct {
OrderID int64 `json:"order_id"`
DaemonID int64 `json:"daemon_id"`
}
// APIPairsResponse - ..
type APIPairsResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result APIPairsData `json:"result"`
}
// APIPairsData - ..
type APIPairsData struct {
Pairs []PairsDataContainer `json:"pairs"`
}
// PairsDataContainer - ..
type PairsDataContainer struct {
Pair PairData `json:"pair"`
MarketData MarketDataContainer `json:"data_market"`
}
// PairData - ..
type PairData struct {
ID int64 `json:"pair_id"` // example: 25
PairCode string `json:"pair"` // example: crp_usdt
PairTitle string `json:"pair_show"` // example: CRP / USDT
CoinsGroup string `json:"group"` // example: crp
Visible bool `json:"visible"` // example: true
Enabled bool `json:"enable"` // example: true
RoundDealAmount int `json:"round_deal_amount"` // example: 3
RoundDealPrice int `json:"round_deal_price"` // example: 4
MinAmount float64 `json:"min_amount"` // 1
MinPrice float64 `json:"min_price"` // 0.001
MaxPrice float64 `json:"max_price"` // 100
}
// MarketDataContainer - ..
type MarketDataContainer struct {
Open float64 `json:"open"` // example: 0.1744
Close float64 `json:"close"` // example: 0.1752
High float64 `json:"high"` // example: 0.1766
Low float64 `json:"low"` // example: 0.1553
Volume float64 `json:"volume"` // example: 67044.815
VolumeUSD float64 `json:"volume_usd"` // example: 1174.6252
Value float64 `json:"value"` // example: 11346.6402207
Rate float64 `json:"rate"` // example: 0.46
DateNow int64 `json:"date_now"` // example: 1634566376377
}
// CurrencyData - ..
type CurrencyData struct {
ID int64 `json:"id"`
Name string `json:"name"` // example: crp
FullName string `json:"fullname"` // example: Utopia Crypton
AppName string `json:"appname"` // example: crypton
Icon string `json:"icon"` // example: crp
Round int `json:"round"` // round precision, example: 8
DepositFee float64 `json:"deposit_fee"` // example: 0
DepositFeePRO float64 `json:"withdraw_fee_pro"` // example: 0.1
MinWithdraw float64 `json:"withdraw_min"` // example: 5
AddressSize int `json:"address_size"` // example: 64
MinFee float64 `json:"min_fee"` // example: 0.00000001
Enable bool `json:"enable"` // example: true
Visible bool `json:"show"` // example: true
}
// APIBookValueResponse - ..
type APIBookValueResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result BookValueDataContainer `json:"result"`
}
// BookValueDataContainer - ..
type BookValueDataContainer struct {
Sell []BookValueData `json:"book_sell"`
Buy []BookValueData `json:"book_buy"`
}
// BookValueData - ..
type BookValueData struct {
Price float64 `json:"price"` // example: 0.1752
Amount float64 `json:"amount"` // example: 1555
Value float64 `json:"value"` // example: 272.436
}
// APICurrenciesListResponse - ..
type APICurrenciesListResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result CurrenciesListData `json:"result"`
}
// CurrenciesListData - ..
type CurrenciesListData map[string]CurrencyData
// APIOrdersResponse - response from get orders list
type APIOrdersResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result OrdersDataContainer `json:"result"`
}
// OrdersDataContainer - orders response data
type OrdersDataContainer struct {
AllOrders []OrderData `json:"allorders"`
Pagination PaginationData `json:"paginator"`
Filters []string `json:"filters"`
MyOrdersCount int `json:"my_order_count"`
}
// OrderData - ..
type OrderData struct {
OrderID int64 `json:"order_id"` // example: 3747944
Amount float64 `json:"amount"` // example: 1
Price float64 `json:"price"` // example: 3
Value float64 `json:"value"` // example: 3
OriginalValue float64 `json:"orig_value"` // example: 3
OriginalAmount float64 `json:"orig_amount"` // example: 1
OrderRegistrationDate int64 `json:"date_reg"` // example: 1527883807109
TaskType string `json:"task"` // example: sell
Status string `json:"status"` // example: open
BaseTicker string `json:"cur"` // example: crp
QuoteTicker string `json:"ecur"` // example: usdt
ExecutedPrice float64 `json:"price_executed"` // example: 0
ExecutedValue float64 `json:"value_executed"` // example: 0
}
// PaginationData - ..
type PaginationData struct {
Count int `json:"count"`
Page int `json:"page"`
Limit int `json:"limit"`
}
// APIOrdersHistoryResponse - ..
type APIOrdersHistoryResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result OrdersHistoryDataContainer `json:"result"`
}
// OrdersHistoryDataContainer - ..
type OrdersHistoryDataContainer struct {
Order OrderData `json:"order"`
History []OrderData `json:"history"`
Pair OrdersHistoryPairData `json:"pair"`
}
// OrdersHistoryPairData - ..
type OrdersHistoryPairData struct {
BaseTicker string `json:"cur"`
QuoteTicker string `json:"ecur"`
}
// APITradeHistoryResponse - ..
type APITradeHistoryResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result TradeHistoryDataContainer `json:"result"`
}
// TradeHistoryDataContainer - ..
type TradeHistoryDataContainer struct {
Items []TradeHistoryData `json:"items"`
Pair OrdersHistoryPairData `json:"pair"`
}
// TradeHistoryData - ..
type TradeHistoryData struct {
RecordID string `json:"record_id"` // UUID format, example: f914ea5d-32ae-4eac-a5e0-e94d55f7b4a7
RecordType string `json:"record_type"` // example: buy
Price float64 `json:"price"` // example: 0.1752
Amount float64 `json:"amount"` // example: 1
Value float64 `json:"value"` // 0.1752
CreatedAt int64 `json:"created_at"` // date, example: 1634566302532
}
// APIOperationsHistoryResponse - ..
type APIOperationsHistoryResponse struct {
Success bool `json:"success"`
Error string `json:"text"`
Result OperationsHistoryDataContainer `json:"result"`
}
// OperationsHistoryDataContainer - ..
type OperationsHistoryDataContainer struct {
Items []TradeHistoryData `json:"items"`
}
type PairPriceData struct {
PairCode string
BestAskPrice float64
BestBidPrice float64
}