Skip to content
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

Merged
merged 8 commits into from
Feb 6, 2024
Merged

FIX: simplify booksignal struct #1526

merged 8 commits into from
Feb 6, 2024

Conversation

c9s
Copy link
Owner

@c9s c9s commented Feb 5, 2024

No description provided.

@bbgokarma-bot
Copy link

Welcome back! @c9s, This pull request may get 250 BBG.

)

type BookSignal struct {
Type BookSignalType
Book SliceOrderBook
Copy link
Owner Author

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 {
Copy link
Owner Author

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 {
Copy link
Owner Author

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}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the blocking behavior

@@ -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),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to determine 50?

Copy link
Owner Author

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

@c9s c9s merged commit 2495258 into main Feb 6, 2024
@c9s c9s deleted the c9s/simplify-booksignal-struct branch February 6, 2024 05:02
@bbgokarma-bot
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants