-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add best_orders RPC #840
Add best_orders RPC #840
Conversation
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.
Just a few comments 💬
mm2src/lp_ordermatch.rs
Outdated
None => return Ok(None), | ||
}; | ||
let mut result = HashMap::new(); | ||
let pairs: Vec<_> = tickers.iter().map(|ticker| (coin.clone(), ticker.clone())).collect(); |
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.
I guess we could avoid collect()
.
I mean something like that:
let pairs = tickets.iter().map(|ticker| (coin.clone(), ticker.clone()));
for pair in pairs
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.
Good point, let me check it.
mm2src/lp_ordermatch.rs
Outdated
}, | ||
}; | ||
} | ||
result.insert(pair.1.clone(), best_orders); |
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.
Considering the previous comment, we could replace pair.1.clone()
with pair.1
fn orderbook_item_with_proof(&self, order: OrderbookItem) -> Result<OrderbookItemWithProof, ()> { | ||
Ok(OrderbookItemWithProof { | ||
order, | ||
last_message_payload: vec![], |
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.
Are the default last_message_payload
and proof
just temporary?
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.
Yeah, I added these fields for future use to have a proper validation of the received data.
@sergeyboyko0791 Thanks for your review! Please recheck the code 🙂 |
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.
Looks good! Thank you for the changes 👍
#805