-
-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: simplify booksignal struct #1526
Conversation
Welcome back! @c9s, This pull request may get 250 BBG. |
) | ||
|
||
type BookSignal struct { | ||
Type BookSignalType | ||
Book SliceOrderBook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take off this big struct, could be too big to copy
newTree := NewRBTree() | ||
tree.InorderReverse(func(n *RBNode) bool { | ||
if cnt >= limit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing limit > 0 check
@@ -473,3 +464,23 @@ func (tree *RBTree) Print() { | |||
return true | |||
}) | |||
} | |||
|
|||
func copyNodeFast(newTree *RBTree) func(n *RBNode) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this functional
@@ -162,9 +162,7 @@ func (sb *StreamOrderBook) BindStream(stream Stream) { | |||
|
|||
sb.Load(book) | |||
sb.EmitSnapshot(book) | |||
|
|||
// when it's snapshot, it's very important to push the snapshot signal to the caller | |||
sb.C <- BookSignal{Type: BookSignalSnapshot, Book: book} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the blocking behavior
pkg/exchange/binance/parse.go
Outdated
@@ -510,6 +510,8 @@ func parseDepthEvent(val *fastjson.Value) (*DepthEvent, error) { | |||
Symbol: string(val.GetStringBytes("s")), | |||
FirstUpdateID: val.GetInt64("U"), | |||
FinalUpdateID: val.GetInt64("u"), | |||
Bids: make(types.PriceVolumeSlice, 0, 50), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to determine 50?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just a guess LOL
Hi @c9s, Well done! 315 BBG has been sent to your polygon wallet. Please check the following tx: https://polygonscan.com/tx/0x340c95f6c9e833e1b62dab842337e266a97c6a276bf73a49947ae51ffa43323c Thank you for your contribution! |
No description provided.