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

feat(cli): format buy & sell output #669

Merged
merged 2 commits into from
Nov 16, 2018
Merged

feat(cli): format buy & sell output #669

merged 2 commits into from
Nov 16, 2018

Conversation

sangaman
Copy link
Collaborator

This attempts to make the cli output for the buy and sell commands more human-readable and succint.

Closes #620.

The missing features that will need to be added in separate PRs are adding price to the swap result (#656) and adding an event for failed swaps to the streaming placeOrder rpc call (#609).

@sangaman sangaman added the command line (CLI) Relating to the command line interface tools label Nov 13, 2018
@sangaman sangaman requested review from a user, offerm and moshababo November 13, 2018 16:24
@ghost ghost assigned sangaman Nov 13, 2018
@ghost ghost added the in progress label Nov 13, 2018
@sangaman
Copy link
Collaborator Author

sangaman commented Nov 13, 2018

I made a small tweak to the formatting. Here's an example of what the output looks like:

$ xucli sell 10 LTC/BTC 1
matched 1 LTC @ 1 with own order da8d3401-e75a-11e8-972d-a9036be5a943
matched 1 LTC @ 1 with own order 68381201-e75d-11e8-972d-a9036be5a943
matched 1 LTC @ 1 with own order 6c5191e1-e75d-11e8-972d-a9036be5a943
matched 1 LTC @ 1 with own order 9f589e81-e75d-11e8-972d-a9036be5a943
matched 1 LTC @ 1 with own order a2a160e1-e75d-11e8-972d-a9036be5a943
new order 8a22d201-e75e-11e8-972d-a9036be5a943 entered the order book with 5 quantity

@kilrau
Copy link
Contributor

kilrau commented Nov 13, 2018

Looks much better!

How about:
matched 1 LTC @ price 1 with own order da8d3401-e75a-11e8-972d-a9036be5a943

Why this?
new order 8a22d201-e75e-11e8-972d-a9036be5a943 entered the order book with 5 quantity

don't see a need for this in the buy/sell output. Just matches.

@sangaman
Copy link
Collaborator Author

sangaman commented Nov 13, 2018

How about:
matched 1 LTC @ price 1 with own order da8d3401-e75a-11e8-972d-a9036be5a943

I thought about explicitly stating "price" too but I felt it was a little superfluous. It seems clear enough to me and also I know the "traded [quantity] @ [price]" shorthand is used elsewhere. Still it's close so maybe someone else can weigh in on which way looks better?

Edit: Also I realized I'd posted an older example before I'd changed the formatting to use the base currency ("LTC" in this case) instead of "quantity". So if that's what you were suggesting as well I'd already made that change.

Why this?
new order 8a22d201-e75e-11e8-972d-a9036be5a943 entered the order book with 5 quantity

don't see a need for this in the buy/sell output. Just matches.

To me it's an easy way to tell which portion of your order was unmatched and is being added to the orderbook. Also I figure we'd want something like that, otherwise there'd be no output in the case where we place a limit order that doesn't get matched. Others can weigh in on this too tho.

@kilrau
Copy link
Contributor

kilrau commented Nov 13, 2018

Edit: Also I realized I'd posted an older example before I'd changed the formatting to use the base currency ("LTC" in this case) instead of "quantity". So if that's what you were suggesting as well I'd already made that change.

👍 that was the main feedback, yes (sry, didn't check the code). Leaving out price is fine.

Why this?
new order 8a22d201-e75e-11e8-972d-a9036be5a943 entered the order book with 5 quantity
don't see a need for this in the buy/sell output. Just matches.

To me it's an easy way to tell which portion of your order was unmatched and is being added to the orderbook. Also I figure we'd want something like that, otherwise there'd be no output in the case where we place a limit order that doesn't get matched. Others can weigh in on this too tho.

Oh then it's just confusing. To me this looks like some new peerOrder came in and the CLI reported about it which doesn't make much sense. Suggest to restructure to sth like this:
No more matches found
Remaining quantity 5 LTC entered order book as new order 8a22d201-e75e-11e8-972d-a9036be5a943

@sangaman
Copy link
Collaborator Author

Ok yeah I see what you mean. Basically I was trying to think about how it would look if there were no matches at all, where I think it's a bit confusing to say "no more matches found." Maybe just 5 unmatched quantity entered order book as 8a22d201-e75e-11e8-972d-a9036be5a943? @kilrau

@kilrau
Copy link
Contributor

kilrau commented Nov 14, 2018

I'd prefer to stick with '"remaining" instead of "unmatched" since we use this elsewhere to, but your call. And definitely add "LTC", not only "quantity". Also, if there were no matches found we should say "No matches found".

No matches found
5 LTC remaining quantity entered order book as 8a22d201-e75e-11e8-972d-a9036be5a943

Copy link

@ghost ghost 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. Once we have the sinon dependency merged in #650 we can easily cover orderHandler with an integration test for the added logic.

In case of no matches found I'd display:
No matches found
remaining ${quantity} ${baseCurrency} entered the order book as ${orderId}

@sangaman
Copy link
Collaborator Author

OK thanks, I'm going to go with @erkarl's suggestion.

@sangaman sangaman requested a review from a user November 14, 2018 17:02
This attempts to make the cli output for the `buy` and `sell` commands
more human-readable and succint.

Closes #620.
@sangaman sangaman merged commit 1efe30a into master Nov 16, 2018
@ghost ghost removed the in progress label Nov 16, 2018
@ghost ghost deleted the placeorder-cli branch November 16, 2018 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command line (CLI) Relating to the command line interface tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants