File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ func (e *Engine) runSnapshots() {
221
221
222
222
for {
223
223
select {
224
- case <- time .After (10 * time .Second ):
224
+ case <- time .After (30 * time .Second ):
225
225
// make a new snapshot request
226
226
e .snapshotReqCh <- & Snapshot {
227
227
OrderOffset : orderOffset ,
Original file line number Diff line number Diff line change @@ -65,19 +65,6 @@ type orderBookSnapshot struct {
65
65
OrderIdWindow Window
66
66
}
67
67
68
- type depth struct {
69
- // 保存所有正在book上的order
70
- orders map [int64 ]* BookOrder
71
-
72
- // 价格优先的priceLevel队列,用于获取level2
73
- // Price -> *PriceLevel
74
- levels * treemap.Map
75
-
76
- // 价格优先,时间优先的订单队列,用于订单match
77
- // priceOrderIdKey -> orderId
78
- queue * treemap.Map
79
- }
80
-
81
68
type PriceLevel struct {
82
69
Price decimal.Decimal
83
70
Size decimal.Decimal
@@ -341,6 +328,19 @@ func (o *orderBook) nextTradeSeq() int64 {
341
328
return o .tradeSeq
342
329
}
343
330
331
+ type depth struct {
332
+ // 保存所有正在book上的order
333
+ orders map [int64 ]* BookOrder
334
+
335
+ // 价格优先的priceLevel队列,用于获取level2
336
+ // Price -> *PriceLevel
337
+ levels * treemap.Map
338
+
339
+ // 价格优先,时间优先的订单队列,用于订单match
340
+ // priceOrderIdKey -> orderId
341
+ queue * treemap.Map
342
+ }
343
+
344
344
func (d * depth ) add (order BookOrder ) {
345
345
d .orders [order .OrderId ] = & order
346
346
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ func (s *OrderBookStream) runApplier() {
122
122
s .snapshotCh <- lastLevel2Snapshot
123
123
}
124
124
125
- if lastFullSnapshot == nil || s .orderBook .seq - lastFullSnapshot .Seq > 1000 {
125
+ if lastFullSnapshot == nil || s .orderBook .seq - lastFullSnapshot .Seq > 10000 {
126
126
lastFullSnapshot = s .orderBook .SnapshotFull ()
127
127
s .snapshotCh <- lastFullSnapshot
128
128
}
You can’t perform that action at this time.
0 commit comments