forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
poloniex_types.go
303 lines (268 loc) · 9.19 KB
/
poloniex_types.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
294
295
296
297
298
299
300
301
302
303
package poloniex
// Ticker holds ticker data
type Ticker struct {
Last float64 `json:"last,string"`
LowestAsk float64 `json:"lowestAsk,string"`
HighestBid float64 `json:"highestBid,string"`
PercentChange float64 `json:"percentChange,string"`
BaseVolume float64 `json:"baseVolume,string"`
QuoteVolume float64 `json:"quoteVolume,string"`
IsFrozen int `json:"isFrozen,string"`
High24Hr float64 `json:"high24hr,string"`
Low24Hr float64 `json:"low24hr,string"`
}
// OrderbookResponseAll holds the full response type orderbook
type OrderbookResponseAll struct {
Data map[string]OrderbookResponse
}
// CompleteBalances holds the full balance data
type CompleteBalances struct {
Currency map[string]CompleteBalance
}
// OrderbookResponse is a sub-type for orderbooks
type OrderbookResponse struct {
Asks [][]interface{} `json:"asks"`
Bids [][]interface{} `json:"bids"`
IsFrozen string `json:"isFrozen"`
Error string `json:"error"`
}
// OrderbookItem holds data on an individual item
type OrderbookItem struct {
Price float64
Amount float64
}
// OrderbookAll contains the full range of orderbooks
type OrderbookAll struct {
Data map[string]Orderbook
}
// Orderbook is a generic type golding orderbook information
type Orderbook struct {
Asks []OrderbookItem `json:"asks"`
Bids []OrderbookItem `json:"bids"`
}
// TradeHistory holds trade history data
type TradeHistory struct {
GlobalTradeID int64 `json:"globalTradeID"`
TradeID int64 `json:"tradeID"`
Date string `json:"date"`
Type string `json:"type"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Total float64 `json:"total,string"`
}
// ChartData holds kline data
type ChartData struct {
Date int `json:"date"`
High float64 `json:"high"`
Low float64 `json:"low"`
Open float64 `json:"open"`
Close float64 `json:"close"`
Volume float64 `json:"volume"`
QuoteVolume float64 `json:"quoteVolume"`
WeightedAverage float64 `json:"weightedAverage"`
Error string `json:"error"`
}
// Currencies contains currency information
type Currencies struct {
Name string `json:"name"`
MaxDailyWithdrawal string `json:"maxDailyWithdrawal"`
TxFee float64 `json:"txFee,string"`
MinConfirmations int `json:"minConf"`
DepositAddresses interface{} `json:"depositAddress"`
Disabled int `json:"disabled"`
Delisted int `json:"delisted"`
Frozen int `json:"frozen"`
}
// LoanOrder holds loan order information
type LoanOrder struct {
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
RangeMin int `json:"rangeMin"`
RangeMax int `json:"rangeMax"`
}
// LoanOrders holds loan order information range
type LoanOrders struct {
Offers []LoanOrder `json:"offers"`
Demands []LoanOrder `json:"demands"`
}
// Balance holds data for a range of currencies
type Balance struct {
Currency map[string]float64
}
// CompleteBalance contains the complete balance with a btcvalue
type CompleteBalance struct {
Available float64
OnOrders float64
BTCValue float64
}
// DepositAddresses holds the full address per crypto-currency
type DepositAddresses struct {
Addresses map[string]string
}
// DepositsWithdrawals holds withdrawal information
type DepositsWithdrawals struct {
Deposits []struct {
Currency string `json:"currency"`
Address string `json:"address"`
Amount float64 `json:"amount,string"`
Confirmations int `json:"confirmations"`
TransactionID string `json:"txid"`
Timestamp int64 `json:"timestamp"`
Status string `json:"status"`
} `json:"deposits"`
Withdrawals []struct {
WithdrawalNumber int64 `json:"withdrawalNumber"`
Currency string `json:"currency"`
Address string `json:"address"`
Amount float64 `json:"amount,string"`
Confirmations int `json:"confirmations"`
TransactionID string `json:"txid"`
Timestamp int64 `json:"timestamp"`
Status string `json:"status"`
IPAddress string `json:"ipAddress"`
} `json:"withdrawals"`
}
// Order hold order information
type Order struct {
OrderNumber int64 `json:"orderNumber,string"`
Type string `json:"type"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Total float64 `json:"total,string"`
Date string `json:"date"`
Margin float64 `json:"margin"`
}
// OpenOrdersResponseAll holds all open order responses
type OpenOrdersResponseAll struct {
Data map[string][]Order
}
// OpenOrdersResponse holds open response orders
type OpenOrdersResponse struct {
Data []Order
}
// AuthentictedTradeHistory holds client trade history information
type AuthentictedTradeHistory struct {
GlobalTradeID int64 `json:"globalTradeID"`
TradeID int64 `json:"tradeID,string"`
Date string `json:"date"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Total float64 `json:"total,string"`
Fee float64 `json:"fee,string"`
OrderNumber int64 `json:"orderNumber,string"`
Type string `json:"type"`
Category string `json:"category"`
}
// AuthenticatedTradeHistoryAll holds the full client trade history
type AuthenticatedTradeHistoryAll struct {
Data map[string][]AuthentictedTradeHistory
}
// AuthenticatedTradeHistoryResponse is a response type for trade history
type AuthenticatedTradeHistoryResponse struct {
Data []AuthentictedTradeHistory
}
// ResultingTrades holds resultant trade information
type ResultingTrades struct {
Amount float64 `json:"amount,string"`
Date string `json:"date"`
Rate float64 `json:"rate,string"`
Total float64 `json:"total,string"`
TradeID int64 `json:"tradeID,string"`
Type string `json:"type"`
}
// OrderResponse is a response type of trades
type OrderResponse struct {
OrderNumber int64 `json:"orderNumber,string"`
Trades []ResultingTrades `json:"resultingTrades"`
}
// GenericResponse is a response type for exchange generic responses
type GenericResponse struct {
Success int `json:"success"`
Error string `json:"error"`
}
// MoveOrderResponse is a response type for move order trades
type MoveOrderResponse struct {
Success int `json:"success"`
Error string `json:"error"`
OrderNumber int64 `json:"orderNumber,string"`
Trades map[string][]ResultingTrades `json:"resultingTrades"`
}
// Withdraw holds withdraw information
type Withdraw struct {
Response string `json:"response"`
Error string `json:"error"`
}
// Fee holds fees for specific trades
type Fee struct {
MakerFee float64 `json:"makerFee,string"`
TakerFee float64 `json:"takerFee,string"`
ThirtyDayVolume float64 `json:"thirtyDayVolume,string"`
NextTier float64 `json:"nextTier,string"`
}
// Margin holds margin information
type Margin struct {
TotalValue float64 `json:"totalValue,string"`
ProfitLoss float64 `json:"pl,string"`
LendingFees float64 `json:"lendingFees,string"`
NetValue float64 `json:"netValue,string"`
BorrowedValue float64 `json:"totalBorrowedValue,string"`
CurrentMargin float64 `json:"currentMargin,string"`
}
// MarginPosition holds margin positional information
type MarginPosition struct {
Amount float64 `json:"amount,string"`
Total float64 `json:"total,string"`
BasePrice float64 `json:"basePrice,string"`
LiquidiationPrice float64 `json:"liquidiationPrice"`
ProfitLoss float64 `json:"pl,string"`
LendingFees float64 `json:"lendingFees,string"`
Type string `json:"type"`
}
// LoanOffer holds loan offer information
type LoanOffer struct {
ID int64 `json:"id"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Duration int `json:"duration"`
AutoRenew bool `json:"autoRenew,int"`
Date string `json:"date"`
}
// ActiveLoans shows the full active loans on the exchange
type ActiveLoans struct {
Provided []LoanOffer `json:"provided"`
Used []LoanOffer `json:"used"`
}
// LendingHistory holds the full lending history data
type LendingHistory struct {
ID int64 `json:"id"`
Currency string `json:"currency"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Duration float64 `json:"duration,string"`
Interest float64 `json:"interest,string"`
Fee float64 `json:"fee,string"`
Earned float64 `json:"earned,string"`
Open string `json:"open"`
Close string `json:"close"`
}
// WebsocketTicker holds ticker data for the websocket
type WebsocketTicker struct {
CurrencyPair string
Last float64
LowestAsk float64
HighestBid float64
PercentChange float64
BaseVolume float64
QuoteVolume float64
IsFrozen bool
High float64
Low float64
}
// WebsocketTrollboxMessage holds trollbox messages and information for
// websocket
type WebsocketTrollboxMessage struct {
MessageNumber float64
Username string
Message string
Reputation float64
}