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

multi: connect order book #278

Merged
merged 3 commits into from
Apr 27, 2020
Merged

multi: connect order book #278

merged 3 commits into from
Apr 27, 2020

Conversation

buck54321
Copy link
Member

app

Completes the MarketsPage js class, and hooks up the /markets page. Better handling of zoom in the depth chart. Epoch orders are also added to depth, but I plan to follow up with a customization to
differentiate the display of order book and epoch depth.

core

Subscribe to the order book when the user navigates to the /market page. Unsubscribe from the order 1 minute after last tab navigates away from the market's page. Send notifications for book, unbook and epoch orders. Send a notification when a new epoch is known to have started, which could be triggered by either a order book notification or a match_proof notification.

client/orders

Modifies client/orders to be more permissive of sequencing issues, which might be temporary, and also to allow orders from multiple epochs to be in the queue at the same time. The latter is necessary because order book notifications might come before the match_proof notification for the prior epoch.

Comment on lines +583 to +586
numBuys = 0
numSells = 0
feedPeriod = 5000 * time.Millisecond
register := true
Copy link
Member Author

Choose a reason for hiding this comment

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

Just a reminder to go test -tags live -timeout 60m and connect to localhost:54321 for the test server. I've added numBuys, numSells, and feedPeriod to control the initial state of the orderbook, and register to control the initial user registration state on the test server so you don't have to go through all of the forms. Try the live server with feedPeriod = 250 * time.Millisecond too.

Copy link
Member

@chappjc chappjc left a comment

Choose a reason for hiding this comment

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

Been doing some simnet testing and it's all working well with the depth chart, notifications, and trades, smooth as butter. I have noticed a couple UI quirks that don't necessarily pertain to the work in this PR though.

When you have the page opened at a given width and you narrow the browser window, the components don't resize as one would expect. You actually have to F5 to make it adjust. e.g. before:

image

narrowed window:

image

Note that this shows more than just the visible portion, with the visible portion indicated by the header/menu bar's width. This was a FF screenshot of the full page vs. visible.
F5:

image

still cramped because I made the windows really narrow, but the elements take reasonable size and position.

I haven't done live_test yet, or finished code review but I'm going to be done reviewing pretty soon.

@chappjc
Copy link
Member

chappjc commented Apr 27, 2020

Another note for future work. We'll need the ability to clear out inactive orders from Your Orders, including 100% filled and canceled orders:

image

@chappjc
Copy link
Member

chappjc commented Apr 27, 2020

Some other testing observations (webserver/site rebuilt):

When cancelling I see two errors, but the cancel succeeds:

[ERR] CORE: expected order id length of 32, got 0
[ERR] CORE: unable to generate match proof for epoch 264666078: cannot generate match proof with an empty epoch queue
[INF] CORE: maker notification for cancel order received for order b9081752809c073c2041be3ccaf1a07d5050347230a709a4442c89e3780ffa7b. match id = 1268f0ae2a36e4218d5e58e26dfe7b4e9732b4649d01657497708b7978bdc42b
[INF] CORE: taker notification for cancel order received for order a9dc00c227534df0a2783c8c5816c4746f44eb1dd89a9085817c442270ffe525. match id = 1268f0ae2a36e4218d5e58e26dfe7b4e9732b4649d01657497708b7978bdc42b

BTW, these two errors could use some context to say where they are coming from.

The client/UI also gets into a state if I try to cancel more than one order without a F5 between:

[ERR] WEB: error cancelling order ac026ee2a24d8e803b8045e139d01aabad2381c4d4906d74605b29e5d551bc89: rpc error: 19: target order not known
[ERR] WEB: error cancelling order 57dee117be3a403e575da8fc2967e01c9a54cb7bd25a126326b284b81b20fb05: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order fd0efa2ecb4a1e1a2ea2e52118ebbee51db6dc29de2fb8e50abdee685153a2c6: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order fd0efa2ecb4a1e1a2ea2e52118ebbee51db6dc29de2fb8e50abdee685153a2c6: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order 57dee117be3a403e575da8fc2967e01c9a54cb7bd25a126326b284b81b20fb05: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order ac026ee2a24d8e803b8045e139d01aabad2381c4d4906d74605b29e5d551bc89: rpc error: 19: target order not known
[ERR] WEB: error cancelling order 57dee117be3a403e575da8fc2967e01c9a54cb7bd25a126326b284b81b20fb05: Trade password error: encryption key deserialization error: incorrect password
[TRC] CORE: processing tip change for btc
[ERR] WEB: error cancelling order 57dee117be3a403e575da8fc2967e01c9a54cb7bd25a126326b284b81b20fb05: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order 57dee117be3a403e575da8fc2967e01c9a54cb7bd25a126326b284b81b20fb05: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order fd0efa2ecb4a1e1a2ea2e52118ebbee51db6dc29de2fb8e50abdee685153a2c6: Trade password error: encryption key deserialization error: incorrect password
[ERR] WEB: error cancelling order ac026ee2a24d8e803b8045e139d01aabad2381c4d4906d74605b29e5d551bc89: rpc error: 19: target order not known
[ERR] WEB: error cancelling order fd0efa2ecb4a1e1a2ea2e52118ebbee51db6dc29de2fb8e50abdee685153a2c6: Trade password error: encryption key deserialization error: incorrect password

The "rpc error: 19: target order not known" and "Trade password error: encryption key deserialization error: incorrect password" happen together it seems. The pass is correct, tried repeatedly.
The above state is escaped with F5, and back to canceling orders, although with the "expected order id length" and "unable to generate match proof" error messages, followed by successful cancel ntfns. I think the above "incorrect password" state happens if I try to cancel multiple orders without refreshing. The "target order not known" may be me trying to cancel the same order somehow, but the UI doesn't seem to permit that in my testing.

@chappjc
Copy link
Member

chappjc commented Apr 27, 2020

Your Orders table suggestions (unrelated to PR):

  • sorting seems random. Best to sort by Age.
  • order type (market or limit+force) could be shown. My table has a buy order that is 0.0% filled, but not cancelable, I think because it was market or immediate.

Copy link
Member

@chappjc chappjc 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, although something is going on with GenerateMatchProof getting called for an empty epoch queue. The previous comments were just playing on simnet.

client/core/bookie.go Show resolved Hide resolved
client/core/bookie.go Outdated Show resolved Hide resolved
client/core/bookie.go Outdated Show resolved Hide resolved
client/order/orderbook_test.go Show resolved Hide resolved
server/market/bookrouter.go Show resolved Hide resolved
app:

Completes the `MarketsPage` js class, and hooks up the /markets page.
Better handling of zoom in the depth chart. Epoch orders are also
added to depth, but I plan to follow up with a customization to
differentiate the display of order book and epoch depth.

core:

Subscribe to the order book when the user navigates to the /market
page. Unsubscribe from the order 1 minute after last tab navigates
away from the market's page. Send notifications for book, unbook and
epoch orders. Send a notification when a new epoch is known to have
started, which could be triggered by either a order book notification
or a match_proof notification.

client/orders:

Modifies client/orders to be more permissive of sequencing issues,
which might be temporary, and also to allow orders from multiple epochs
to be in the queue at the same time. The latter is necessary because
order book notifications might come before the match_proof notification
for the prior epoch.
@buck54321
Copy link
Member Author

This one should be good now. I threw in a bug fix that I found during final testing though, so check that out. I'll open some issues for the other stuff.

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