forked from f0cii/deribit-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
252 lines (215 loc) · 18.4 KB
/
client_test.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
package deribit
import (
"encoding/json"
"github.com/finnag/deribit-api/models"
"github.com/stretchr/testify/assert"
"testing"
)
func newClient() *Client {
cfg := &Configuration{
Addr: TestBaseURL,
ApiKey: "AsJTU16U",
SecretKey: "mM5_K8LVxztN6TjjYpv_cJVGQBvk4jglrEpqkw1b87U",
AutoReconnect: true,
DebugMode: true,
}
client := New(cfg)
return client
}
func TestClient_GetTime(t *testing.T) {
client := newClient()
tm, err := client.GetTime()
if err != nil {
t.Error(err)
return
}
t.Logf("%v", tm)
}
func TestClient_Test(t *testing.T) {
client := newClient()
result, err := client.Test()
assert.Nil(t, err)
t.Logf("%v", result)
}
func TestClient_GetBookSummaryByCurrency(t *testing.T) {
client := newClient()
params := &models.GetBookSummaryByCurrencyParams{
Currency: "BTC",
Kind: "future",
}
result, err := client.GetBookSummaryByCurrency(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_GetBookSummaryByInstrument(t *testing.T) {
client := newClient()
params := &models.GetBookSummaryByInstrumentParams{
InstrumentName: "BTC-PERPETUAL",
}
result, err := client.GetBookSummaryByInstrument(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_GetOrderBook(t *testing.T) {
client := newClient()
params := &models.GetOrderBookParams{
InstrumentName: "BTC-PERPETUAL",
Depth: 5,
}
result, err := client.GetOrderBook(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_Ticker(t *testing.T) {
client := newClient()
params := &models.TickerParams{
InstrumentName: "BTC-PERPETUAL",
}
result, err := client.Ticker(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_GetPosition(t *testing.T) {
client := newClient()
params := &models.GetPositionParams{
InstrumentName: "BTC-PERPETUAL",
}
result, err := client.GetPosition(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_BuyMarket(t *testing.T) {
client := newClient()
params := &models.BuyParams{
InstrumentName: "BTC-PERPETUAL",
Amount: 10,
Price: 0,
Type: "market",
}
result, err := client.Buy(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestClient_Buy(t *testing.T) {
client := newClient()
params := &models.BuyParams{
InstrumentName: "BTC-PERPETUAL",
Amount: 40,
Price: 6000.0,
Type: "limit",
}
result, err := client.Buy(params)
if err != nil {
t.Error(err)
return
}
t.Logf("%#v", result)
}
func TestJsonOmitempty(t *testing.T) {
params := &models.BuyParams{
InstrumentName: "BTC-PERPETUAL",
Amount: 40,
//Price: 6000.0,
Type: "limit",
TimeInForce: "good_til_cancelled",
MaxShow: Float64Pointer(40.0),
}
data, _ := json.Marshal(params)
t.Log(string(data))
}
func TestClient_Subscribe(t *testing.T) {
client := newClient()
client.On("announcements", func(e *models.AnnouncementsNotification) {
})
client.On("book.ETH-PERPETUAL.100.1.100ms", func(e *models.OrderBookGroupNotification) {
})
client.On("book.BTC-PERPETUAL.100ms", func(e *models.OrderBookNotification) {
})
client.On("book.BTC-PERPETUAL.raw", func(e *models.OrderBookRawNotification) {
})
client.On("deribit_price_index.btc_usd", func(e *models.DeribitPriceIndexNotification) {
})
client.On("deribit_price_ranking.btc_usd", func(e *models.DeribitPriceRankingNotification) {
})
client.On("estimated_expiration_price.btc_usd", func(e *models.EstimatedExpirationPriceNotification) {
})
client.On("markprice.options.btc_usd", func(e *models.MarkpriceOptionsNotification) {
})
client.On("perpetual.BTC-PERPETUAL.raw", func(e *models.PerpetualNotification) {
})
client.On("quote.BTC-PERPETUAL", func(e *models.QuoteNotification) {
})
client.On("ticker.BTC-PERPETUAL.raw", func(e *models.TickerNotification) {
})
client.On("trades.BTC-PERPETUAL.raw", func(e *models.TradesNotification) {
})
client.On("user.changes.BTC-PERPETUAL.raw", func(e *models.UserChangesNotification) {
})
client.On("user.changes.future.BTC.raw", func(e *models.UserChangesNotification) {
})
client.On("user.orders.BTC-PERPETUAL.raw", func(e *models.UserOrderNotification) {
})
client.On("user.orders.future.BTC.100ms", func(e *models.UserOrderNotification) {
})
client.On("user.portfolio.btc", func(e *models.PortfolioNotification) {
})
client.On("user.trades.BTC-PERPETUAL.raw", func(e *models.UserTradesNotification) {
})
client.On("user.trades.future.BTC.100ms", func(e *models.UserTradesNotification) {
})
client.Subscribe([]string{
//"announcements",
//"book.BTC-PERPETUAL.none.10.100ms", // none/1,2,5,10,25,100,250
//"book.BTC-PERPETUAL.100ms", // type: snapshot/change
"book.BTC-PERPETUAL.raw",
//"deribit_price_index.btc_usd",
//"deribit_price_ranking.btc_usd",
//"estimated_expiration_price.btc_usd",
//"markprice.options.btc_usd",
//"perpetual.BTC-PERPETUAL.raw",
//"quote.BTC-PERPETUAL",
//"ticker.BTC-PERPETUAL.raw",
//"trades.BTC-PERPETUAL.raw",
//"user.changes.BTC-PERPETUAL.raw",
//"user.changes.future.BTC.raw",
//"user.orders.BTC-PERPETUAL.raw",
//"user.orders.future.BTC.100ms",
//"user.portfolio.btc",
//"user.trades.BTC-PERPETUAL.raw",
//"user.trades.future.BTC.100ms",
})
select {}
}
func TestUnmarshalOrderBookNotification(t *testing.T) {
s := `{"timestamp":1587560603684,"instrument_name":"BTC-PERPETUAL","change_id":3884909145,"bids":[["new",6961.0,105420.0],["new",6960.5,3210.0],["new",6960.0,15360.0],["new",6959.5,10.0],["new",6959.0,47490.0],["new",6958.5,35450.0],["new",6958.0,16510.0],["new",6957.5,28020.0],["new",6957.0,72260.0],["new",6956.5,156210.0],["new",6955.0,540.0],["new",6953.5,7650.0],["new",6953.0,6990.0],["new",6952.5,7650.0],["new",6952.0,7800.0],["new",6951.0,70.0],["new",6950.0,1060.0],["new",6949.5,6940.0],["new",6948.5,10.0],["new",6948.0,800.0],["new",6946.5,1350.0],["new",6946.0,20.0],["new",6944.0,20.0],["new",6943.0,20.0],["new",6942.5,520680.0],["new",6942.0,70.0],["new",6941.5,100.0],["new",6940.0,50.0],["new",6937.0,40.0],["new",6932.5,3980.0],["new",6931.0,190.0],["new",6930.0,40.0],["new",6927.5,50.0],["new",6925.5,100.0],["new",6924.0,9000.0],["new",6922.0,800.0],["new",6919.0,170.0],["new",6914.0,120.0],["new",6913.0,5140.0],["new",6910.0,50000.0],["new",6909.5,1000.0],["new",6907.5,1000.0],["new",6907.0,80.0],["new",6906.0,3453460.0],["new",6905.5,1000.0],["new",6904.0,160.0],["new",6903.5,1000.0],["new",6903.0,27000.0],["new",6902.5,7960.0],["new",6901.5,1000.0],["new",6901.0,695750.0],["new",6900.5,3240.0],["new",6900.0,310.0],["new",6899.5,1000.0],["new",6898.5,160.0],["new",6897.5,1000.0],["new",6895.5,1000.0],["new",6893.5,1000.0],["new",6892.0,360.0],["new",6891.5,1000.0],["new",6891.0,440.0],["new",6890.5,3000.0],["new",6890.0,1000.0],["new",6889.5,1000.0],["new",6887.5,1000.0],["new",6885.5,1020.0],["new",6885.0,5030.0],["new",6883.5,1000.0],["new",6881.5,1000.0],["new",6875.0,700.0],["new",6869.0,30.0],["new",6867.5,60.0],["new",6867.0,8000.0],["new",6863.0,1720.0],["new",6859.0,560.0],["new",6858.5,20.0],["new",6857.0,1130.0],["new",6850.0,100.0],["new",6838.0,1800.0],["new",6833.0,6090.0],["new",6827.0,3620.0],["new",6826.0,3240.0],["new",6822.5,140000.0],["new",6821.0,9000.0],["new",6817.0,2890.0],["new",6812.5,31840.0],["new",6811.0,10.0],["new",6803.5,60000.0],["new",6800.0,110.0],["new",6797.0,2560.0],["new",6793.5,800.0],["new",6793.0,4620.0],["new",6778.0,10.0],["new",6771.5,3000.0],["new",6767.0,7390.0],["new",6763.0,320.0],["new",6752.0,10000.0],["new",6751.5,27000.0],["new",6740.0,20.0],["new",6738.0,11820.0],["new",6732.5,10.0],["new",6731.5,11270.0],["new",6730.0,10.0],["new",6722.5,100.0],["new",6720.0,10.0],["new",6715.0,10.0],["new",6711.0,2500.0],["new",6710.0,10.0],["new",6707.0,18920.0],["new",6689.0,1600.0],["new",6680.0,100.0],["new",6672.0,30260.0],["new",6670.0,60.0],["new",6660.0,60.0],["new",6650.0,10.0],["new",6644.5,720.0],["new",6640.0,20.0],["new",6633.0,10.0],["new",6613.0,7500.0],["new",6590.0,30930.0],["new",6589.0,6960.0],["new",6588.0,29290.0],["new",6587.0,36020.0],["new",6571.0,640.0],["new",6550.0,50.0],["new",6542.5,127360.0],["new",6521.5,3200.0],["new",6512.0,647950.0],["new",6511.0,187380.0],["new",6510.0,257320.0],["new",6509.0,57670.0],["new",6500.0,10750.0],["new",6479.5,8510.0],["new",6478.5,5140.0],["new",6469.0,450.0],["new",6418.5,20.0],["new",6400.0,700.0],["new",6395.0,196800.0],["new",6394.0,93740.0],["new",6393.0,383660.0],["new",6392.0,104990.0],["new",6359.0,1500.0],["new",6355.0,51380.0],["new",6353.0,10280.0],["new",6329.0,1500.0],["new",6295.0,100.0],["new",6286.5,373220.0],["new",6285.5,336060.0],["new",6284.5,309110.0],["new",6283.5,522010.0],["new",6272.5,8180.0],["new",6270.5,3200.0],["new",6259.5,750.0],["new",6256.0,20.0],["new",6231.5,20560.0],["new",6229.5,2240.0],["new",6228.5,20880.0],["new",6200.0,612680.0],["new",6186.5,354750.0],["new",6185.5,352580.0],["new",6184.5,175290.0],["new",6183.5,299890.0],["new",6169.5,450.0],["new",6150.0,500000.0],["new",6131.0,20.0],["new",6100.0,4000.0],["new",6084.0,2250.0],["new",6082.5,12160.0],["new",6082.0,41760.0],["new",6043.0,100000.0],["new",6036.0,6040.0],["new",6029.5,10.0],["new",6019.5,100000.0],["new",6000.0,509170.0],["new",5999.0,5000.0],["new",5946.5,10.0],["new",5943.0,12800.0],["new",5900.0,10110.0],["new",5803.0,5810.0],["new",5788.5,10.0],["new",5782.5,28450.0],["new",5732.5,509440.0],["new",5700.0,527500.0],["new",5655.5,67890.0],["new",5612.5,67300.0],["new",5571.5,10.0],["new",5568.5,10.0],["new",5536.0,65550.0],["new",5500.0,6510.0],["new",5456.0,66100.0],["new",5410.0,6360.0],["new",5372.5,66900.0],["new",5359.5,2250.0],["new",5309.0,50.0],["new",5118.0,2560.0],["new",5050.5,450.0],["new",5044.5,150.0],["new",5021.0,100000.0],["new",5000.0,23720.0],["new",4922.0,450.0],["new",4770.0,131220.0],["new",4757.5,200.0],["new",4662.5,10000.0],["new",4610.0,10000.0],["new",4600.0,2000.0],["new",4597.0,1600.0],["new",4594.5,450.0],["new",4514.5,1000000.0],["new",4456.5,300000.0],["new",4414.0,46280.0],["new",4300.0,10000.0],["new",4200.0,35000.0],["new",4073.0,393660.0],["new",4026.0,100000.0],["new",3928.5,300000.0],["new",3845.0,40.0],["new",3777.5,6400.0],["new",3775.0,250000.0],["new",3774.0,3000.0],["new",3773.0,1000.0],["new",3762.0,20000.0],["new",3754.5,1000.0],["new",3708.0,27000.0],["new",3655.0,20.0],["new",3600.0,36000.0],["new",3590.0,10000.0],["new",3577.25,1000000.0],["new",3567.0,500.0],["new",3400.0,80.0],["new",3336.75,20000.0],["new",3195.0,100000.0],["new",3119.5,90.0],["new",3011.0,1000.0],["new",3000.0,18460.0],["new",2879.0,300.0],["new",2467.0,25600.0],["new",2309.0,250.0],["new",2005.0,140.0],["new",2000.0,200.0],["new",1994.5,5000.0],["new",1857.0,100000.0],["new",1002.5,70.0],["new",1000.5,40.0],["new",1000.0,13030.0],["new",502.0,1350.0],["new",500.0,10.0],["new",200.0,110.0],["new",100.0,1010.0],["new",35.0,330.0],["new",15.0,20.0],["new",10.0,10.0],["new",6.0,40.0],["new",1.0,340.0],["new",0.5,50110.0],["new",0.25,10.0]],"asks":[["new",6961.5,118360.0],["new",6962.0,2900.0],["new",6962.5,40580.0],["new",6963.0,120.0],["new",6963.5,100780.0],["new",6964.0,32910.0],["new",6964.5,9110.0],["new",6965.0,4450.0],["new",6965.5,35160.0],["new",6966.0,109260.0],["new",6967.0,6970.0],["new",6967.5,100.0],["new",6968.0,1000.0],["new",6968.5,10.0],["new",6969.5,7670.0],["new",6970.0,110800.0],["new",6970.5,7670.0],["new",6972.0,1230.0],["new",6972.5,40.0],["new",6974.0,1010.0],["new",6974.5,523120.0],["new",6976.0,1000.0],["new",6978.0,1000.0],["new",6980.0,50.0],["new",6982.5,7960.0],["new",6984.0,440.0],["new",6985.0,4000.0],["new",6989.0,120.0],["new",6993.0,200.0],["new",6994.5,1200.0],["new",6997.0,1270.0],["new",6998.0,1000.0],["new",6999.0,160.0],["new",7000.0,120.0],["new",7004.0,370.0],["new",7004.5,10.0],["new",7006.0,1720.0],["new",7006.5,30.0],["new",7010.0,144000.0],["new",7010.5,3505440.0],["new",7011.0,360.0],["new",7012.0,440.0],["new",7014.0,1050.0],["new",7023.0,30.0],["new",7023.5,500.0],["new",7025.0,150000.0],["new",7027.0,1000.0],["new",7028.0,700.0],["new",7034.0,400.0],["new",7035.0,22000.0],["new",7035.5,1000.0],["new",7036.0,100130.0],["new",7038.5,450.0],["new",7039.0,250.0],["new",7040.0,6050.0],["new",7041.5,640.0],["new",7044.5,1000.0],["new",7046.0,1130.0],["new",7050.0,100.0],["new",7055.5,18000.0],["new",7065.0,1800.0],["new",7068.0,320.0],["new",7071.0,707100.0],["new",7072.5,31840.0],["new",7077.0,3240.0],["new",7086.0,2890.0],["new",7087.5,20.0],["new",7093.0,500.0],["new",7099.5,800.0],["new",7100.0,100.0],["new",7102.0,22000.0],["new",7103.0,100000.0],["new",7107.5,450.0],["new",7109.5,2560.0],["new",7110.0,4620.0],["new",7111.5,1120.0],["new",7113.5,38570.0],["new",7114.5,21240.0],["new",7125.0,10.0],["new",7136.0,7390.0],["new",7138.5,54000.0],["new",7140.0,250.0],["new",7150.0,35750.0],["new",7163.5,500.0],["new",7165.0,11820.0],["new",7176.5,450.0],["new",7188.0,10.0],["new",7192.5,29060.0],["new",7196.0,19560.0],["new",7204.0,3600.0],["new",7218.5,100000.0],["new",7231.0,30260.0],["new",7236.0,500.0],["new",7236.5,100.0],["new",7260.0,7260.0],["new",7266.0,1500.0],["new",7270.0,10.0],["new",7294.5,600.0],["new",7324.5,20580.0],["new",7325.5,44000.0],["new",7339.0,100.0],["new",7342.5,127360.0],["new",7371.5,3200.0],["new",7408.0,9940.0],["new",7417.0,450.0],["new",7448.5,10000.0],["new",7534.5,720.0],["new",7540.0,2440.0],["new",7550.0,760.0],["new",7560.0,10000.0],["new",7562.0,2250.0],["new",7562.5,2250.0],["new",7564.0,20590.0],["new",7565.0,41760.0],["new",7613.0,71980.0],["new",7614.0,78230.0],["new",7615.5,4260.0],["new",7641.5,450.0],["new",7650.0,20.0],["new",7654.0,20590.0],["new",7773.5,3850.0],["new",7796.0,78230.0],["new",7797.0,28060.0],["new",7800.0,20000.0],["new",7808.0,156160.0],["new",7852.0,260.0],["new",7860.0,880.0],["new",7894.0,200000.0],["new",7909.0,158180.0],["new",7938.5,1640.0],["new",7998.0,3730.0],["new",8000.0,180720.0],["new",8026.0,6910.0],["new",8073.5,100000.0],["new",8089.0,10.0],["new",8100.0,100000.0],["new",8121.0,10.0],["new",8152.5,509440.0],["new",8194.0,10.0],["new",8246.0,250.0],["new",8256.5,10000.0],["new",8285.0,10.0],["new",8321.0,150.0],["new",8333.0,10.0],["new",8347.5,8310.0],["new",8350.0,7330.0],["new",8401.0,300000.0],["new",8449.0,26180.0],["new",8450.0,99950.0],["new",8491.0,25600.0],["new",8536.0,99950.0],["new",8546.0,450.0],["new",8776.0,20000.0],["new",8800.0,100000.0],["new",8850.0,900.0],["new",8878.5,110000.0],["new",8889.0,15000.0],["new",8951.5,10.0],["new",9000.0,360.0],["new",9027.0,270000.0],["new",9050.5,240.0],["new",9084.5,200000.0],["new",9136.0,900.0],["new",9140.0,900.0],["new",9142.0,900.0],["new",9143.0,4100.0],["new",9143.5,900.0],["new",9144.5,900.0],["new",9150.0,900.0],["new",9155.0,900.0],["new",9160.0,900.0],["new",9165.0,900.0],["new",9170.0,2700.0],["new",9175.0,900.0],["new",9175.5,20000.0],["new",9180.0,900.0],["new",9270.5,150900.0],["new",9273.0,100.0],["new",9277.5,160.0],["new",9295.5,90.0],["new",9347.5,110.0],["new",9350.0,100.0],["new",9351.0,50000.0],["new",9359.5,640.0],["new",9370.5,480.0],["new",9382.0,110.0],["new",9436.0,110.0],["new",9444.0,110.0],["new",9456.0,100.0],["new",9475.5,450.0],["new",9490.5,2560.0],["new",9531.0,100.0],["new",9552.0,100100.0],["new",9597.5,120.0],["new",9600.0,1660470.0],["new",9609.5,100.0],["new",9632.5,120.0],["new",9660.0,100.0],["new",9674.0,100.0],["new",9695.0,100.0],["new",9755.5,110.0],["new",9800.0,1000.0],["new",9819.5,110.0],["new",9848.0,110.0],["new",9882.5,1920.0],["new",9982.0,120.0],["new",10000.0,100.0],["new",10001.5,120.0],["new",10060.0,120.0],["new",10126.0,60.0],["new",10131.0,60.0],["new",10136.0,60.0],["new",10146.0,60.0],["new",10161.0,60.0],["new",10176.0,60.0],["new",10196.0,60.0],["new",10216.0,20.0],["new",10309.0,250.0],["new",10428.0,100000.0],["new",10480.5,200.0],["new",10505.5,200.0],["new",10518.0,1350.0],["new",10530.5,400.0],["new",10531.0,200.0],["new",10555.5,400.0],["new",10580.5,400.0],["new",10702.0,7680.0],["new",10732.5,20.0],["new",10923.0,4050.0],["new",10943.5,2950.0],["new",11000.0,10040.0],["new",11004.0,10.0],["new",11008.0,10.0],["new",11013.0,10.0],["new",11111.0,40.0],["new",11116.0,25000.0],["new",11119.5,10.0],["new",11153.0,20.0],["new",11188.5,10000.0],["new",11300.0,10750.0],["new",11394.0,20.0],["new",11405.0,1020.0],["new",11500.0,186890.0],["new",11520.5,40.0],["new",11550.5,100000.0],["new",11800.0,2000.0],["new",11845.0,1000.0],["new",11860.0,10000.0],["new",11900.0,1000.0],["new",12000.0,97050.0],["new",12012.5,30720.0],["new",12138.0,12150.0],["new",12188.5,50.0],["new",12250.0,2000.0],["new",12269.0,20.0],["new",12447.0,20.0],["new",12500.0,3000.0],["new",12574.0,20.0],["new",12900.0,10.0],["new",13044.5,5000.0],["new",13078.5,20.0],["new",13119.5,30.0],["new",13144.0,20.0],["new",13209.5,30.0],["new",13275.5,40.0],["new",13320.0,1000.0],["new",13342.0,50.0],["new",13406.5,1000.0],["new",13409.0,60.0],["new",13427.0,9398900.0],["new",13550.0,1000.0],["new",13726.0,1000.0],["new",13900.0,10.0],["new",13945.0,50.0],["new",14000.0,10000.0],["new",14105.5,1000.0],["new",14110.0,122880.0],["new",14548.5,1000.0],["new",14900.0,10.0],["new",14999.0,10.0],["new",15000.0,55020.0],["new",15001.0,20.0],["new",15002.0,10.0],["new",15118.0,1000.0],["new",15498.0,1000.0],["new",15783.0,36450.0],["new",15900.0,10.0],["new",16130.5,1000.0],["new",16525.0,301010.0],["new",16900.0,10.0],["new",17119.5,90.0],["new",17465.5,491520.0],["new",19309.0,1250.0],["new",20000.0,2000.0],["new",23773.0,10.0],["new",23782.0,10.0],["new",23782.5,10.0],["new",23783.5,10.0],["new",23786.0,10.0],["new",23787.0,10.0],["new",23789.0,10.0],["new",25119.5,270.0],["new",26718.0,109350.0],["new",32491.0,36450.0],["new",35773.0,10.0],["new",35782.0,10.0],["new",35782.5,10.0],["new",35783.5,10.0],["new",35786.0,10.0],["new",35787.0,10.0],["new",35789.0,10.0],["new",38368.0,10.0],["new",41119.5,810.0],["new",46309.0,6250.0],["new",47773.0,10.0],["new",47782.0,10.0],["new",47782.5,10.0],["new",47783.5,10.0],["new",47786.0,10.0],["new",47787.0,10.0],["new",47789.0,10.0],["new",50000.0,870.0],["new",59523.0,328050.0],["new",59773.0,10.0],["new",59782.0,10.0],["new",59782.5,10.0],["new",59783.5,10.0],["new",59786.0,10.0],["new",59787.0,10.0],["new",59789.0,10.0],["new",63044.5,50000.0],["new",75508.0,200.0],["new",84441.0,2500.0],["new",99897.0,150000.0],["new",99999.0,20.0],["new",100000.0,40.0]]}`
var notification models.OrderBookNotification
err := json.Unmarshal([]byte(s), ¬ification)
if err != nil {
t.Error(err)
return
}
for _, v := range notification.Asks {
t.Logf("Ask: %#v", v)
}
for _, v := range notification.Bids {
t.Logf("Bid: %#v", v)
}
}