forked from thrasher-corp/gocryptotrader
/
coinut_types.go
213 lines (188 loc) · 6.61 KB
/
coinut_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
package coinut
type CoinutGenericResponse struct {
Nonce int64 `json:"nonce"`
Reply string `json:"reply"`
Status []string `json:"status"`
TransID int64 `json:"trans_id"`
Timestamp int64 `json:"timestamp"`
}
type CoinutInstrumentBase struct {
Base string `json:"base"`
DecimalPlaces int `json:"decimal_places"`
InstID int `json:"inst_id"`
Quote string `json:"quote"`
}
type CoinutInstruments struct {
Instruments map[string][]CoinutInstrumentBase `json:"SPOT"`
}
type CoinutTicker struct {
HighestBuy float64 `json:"highest_buy,string"`
InstrumentID int `json:"inst_id"`
Last float64 `json:"last,string"`
LowestSell float64 `json:"lowest_sell,string"`
OpenInterest float64 `json:"open_interest,string"`
Timestamp float64 `json:"timestamp"`
TransID int64 `json:"trans_id"`
Volume float64 `json:"volume,string"`
Volume24 float64 `json:"volume24,string"`
}
type CoinutOrderbookBase struct {
Count int `json:"count"`
Price float64 `json:"price,string"`
Quantity float64 `json:"qty,string"`
}
type CoinutOrderbook struct {
Buy []CoinutOrderbookBase `json:"buy"`
Sell []CoinutOrderbookBase `json:"sell"`
InstrumentID int `json:"inst_id"`
TotalBuy float64 `json:"total_buy,string"`
TotalSell float64 `json:"total_sell,string"`
TransID int64 `json:"trans_id"`
}
type CoinutTradeBase struct {
Price float64 `json:"price,string"`
Quantity float64 `json:"quantity,string"`
Side string `json:"side"`
Timestamp float64 `json:"timestamp"`
TransID int64 `json:"trans_id"`
}
type CoinutTrades struct {
Trades []CoinutTradeBase `json:"trades"`
}
type CoinutUserBalance struct {
BTC float64 `json:"btc,string"`
ETC float64 `json:"etc,string"`
ETH float64 `json:"eth,string"`
LTC float64 `json:"ltc,string"`
Equity float64 `json:"equity,string,string"`
InitialMargin float64 `json:"initial_margin,string"`
MaintenanceMargin float64 `json:"maintenance_margin,string"`
RealizedPL float64 `json:"realized_pl,string"`
TransID int64 `json:"trans_id"`
UnrealizedPL float64 `json:"unrealized_pl,string"`
}
type CoinutOrder struct {
InstrumentID int64 `json:"inst_id"`
Price float64 `json:"price,string"`
Quantity float64 `json:"qty,string"`
ClientOrderID int `json:"client_ord_id"`
Side string `json:"side,string"`
}
type CoinutOrderResponse struct {
OrderID int64 `json:"order_id"`
OpenQuantity float64 `json:"open_qty,string"`
Price float64 `json:"price,string"`
Quantity float64 `json:"qty,string"`
InstrumentID int64 `json:"inst_id"`
ClientOrderID int64 `json:"client_ord_id"`
Timestamp int64 `json:"timestamp"`
OrderPrice float64 `json:"order_price,string"`
Side string `json:"side"`
}
type CoinutCommission struct {
Currency string `json:"currency"`
Amount float64 `json:"amount,string"`
}
type CoinutOrderFilledResponse struct {
CoinutGenericResponse
Commission CoinutCommission `json:"commission"`
FillPrice float64 `json:"fill_price,string"`
FillQuantity float64 `json:"fill_qty,string"`
Order CoinutOrderResponse `json:"order"`
}
type CoinutOrderRejectResponse struct {
CoinutOrderResponse
Reasons []string `json:"reasons"`
}
type CoinutOrdersBase struct {
CoinutGenericResponse
CoinutOrderResponse
}
type CoinutOrdersResponse struct {
Data []CoinutOrdersBase
}
type CoinutCancelOrders struct {
InstrumentID int `json:"int"`
OrderID int64 `json:"order_id"`
}
type CoinutCancelOrdersResponse struct {
CoinutGenericResponse
Results []struct {
OrderID int64 `json:"order_id"`
Status string `json:"status"`
InstrumentID int `json:"inst_id"`
} `json:"results"`
}
type CoinutTradeHistory struct {
TotalNumber int64 `json:"total_number"`
Trades []CoinutOrderFilledResponse `json:"trades"`
}
type CoinutIndexTicker struct {
Asset string `json:"asset"`
Price float64 `json:"price,string"`
}
type CoinutOption struct {
HighestBuy float64 `json:"highest_buy,string"`
InstrumentID int `json:"inst_id"`
Last float64 `json:"last,string"`
LowestSell float64 `json:"lowest_sell,string"`
OpenInterest float64 `json:"open_interest,string"`
}
type CoinutOptionChainResponse struct {
ExpiryTime int64 `json:"expiry_time"`
SecurityType string `json:"sec_type"`
Asset string `json:"asset"`
Entries []struct {
Call CoinutOption `json:"call"`
Put CoinutOption `json:"put"`
Strike float64 `json:"strike,string"`
}
}
type CoinutOptionChainUpdate struct {
CoinutOption
CoinutGenericResponse
Asset string `json:"asset"`
ExpiryTime int64 `json:"expiry_time"`
SecurityType string `json:"sec_type"`
Volume float64 `json:"volume,string"`
}
type CoinutPositionHistory struct {
Positions []struct {
PositionID int `json:"position_id"`
Records []struct {
Commission CoinutCommission `json:"commission"`
FillPrice float64 `json:"fill_price,string,omitempty"`
TransactionID int `json:"trans_id"`
FillQuantity float64 `json:"fill_qty,omitempty"`
Position struct {
Commission CoinutCommission `json:"commission"`
Timestamp int64 `json:"timestamp"`
OpenPrice float64 `json:"open_price,string"`
RealizedPL float64 `json:"realized_pl,string"`
Quantity float64 `json:"qty,string"`
} `json:"position"`
AssetAtExpiry float64 `json:"asset_at_expiry,string,omitempty"`
} `json:"records"`
Instrument struct {
ExpiryTime int64 `json:"expiry_time"`
ContractSize float64 `json:"contract_size,string"`
ConversionRate float64 `json:"conversion_rate,string"`
OptionType string `json:"option_type"`
InstrumentID int `json:"inst_id"`
SecType string `json:"sec_type"`
Asset string `json:"asset"`
Strike float64 `json:"strike,string"`
} `json:"inst"`
OpenTimestamp int64 `json:"open_timestamp"`
} `json:"positions"`
TotalNumber int `json:"total_number"`
}
type CoinutOpenPosition struct {
PositionID int `json:"position_id"`
Commission CoinutCommission `json:"commission"`
OpenPrice float64 `json:"open_price,string"`
RealizedPL float64 `json:"realized_pl,string"`
Quantity float64 `json:"qty,string"`
OpenTimestamp int64 `json:"open_timestamp"`
InstrumentID int `json:"inst_id"`
}