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

Add best_orders RPC #840

Merged
merged 7 commits into from
Mar 3, 2021
Merged

Add best_orders RPC #840

merged 7 commits into from
Mar 3, 2021

Conversation

artemii235
Copy link
Member

Copy link

@sergeyboyko0791 sergeyboyko0791 left a 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 💬

None => return Ok(None),
};
let mut result = HashMap::new();
let pairs: Vec<_> = tickers.iter().map(|ticker| (coin.clone(), ticker.clone())).collect();

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

Copy link
Member Author

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.

},
};
}
result.insert(pair.1.clone(), best_orders);

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![],

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?

Copy link
Member Author

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.

@artemii235
Copy link
Member Author

artemii235 commented Mar 2, 2021

@sergeyboyko0791 Thanks for your review! Please recheck the code 🙂

Copy link

@sergeyboyko0791 sergeyboyko0791 left a 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 👍

@artemii235 artemii235 merged commit 4f378cd into mm2.1 Mar 3, 2021
@artemii235 artemii235 deleted the mm2.1-best-orders branch March 3, 2021 04:56
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.

2 participants