-
Notifications
You must be signed in to change notification settings - Fork 100
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
tatanka: Add orderbook. #3115
Comments
User requests orderbook per market they are interested in and subscribes to those. They are also expected to participate in sharing all order info on those markets. Clients can request all order ids or individual orders from other clients. When requesting all orders, it's just the order ids, no info. They may be divided into several sends. orderbook res
On the subscription channel, only individual order changes are broadcast. Orders can be created or updated. updated includes qty changing/cancellation and the timeout being extended. Messages for orders are signed with the private key matching the user's PeerID or ignored. The signature should be passed along with the update and saved with it. Update requests should contain all info so that a listener could eventually know the whole book contents after all timeouts have happened. Quantity can be moved up or down, no need to add settled amount. order update
Multiple orders (up to some limit) can also be requested. In that case they would be requested by id and they would get a slice of OrderUpdate from the user. When a user decides to match an order, they send messages directly to that peer and start negotiation. The maker will update their order if the taker meets their requirements. Some thoughts:
|
Copying my chat comment: |
How about when the user subscribes to the orderbook (subject), the mesh will send a new_subscriber broadcast to other subscribers, and the other subscribers who have standing orders can message the user.
Lot size should be a power of 2, e.g. From the user's perspective, lot size is presented as **maximum fee exposure", which is translated to lot size behind the scenes. The variable lot size also means we need to introduce some conception of "visibility", since some orders on the book may not be compatible with the user's current setting. We want to track those orders anyway, so that the user can modify their setting without having to resync the book. This visibility will be a challenge, because say a user has a fee exposure setting that translates to a lot size of 100, while an order on the books has a lot size of 50, but has 2 lots available. We could still match that order, but with the stipulation that we must match both lots.
Yeah this will be interested to figure out. We should talk about the concept of "funded messages" or "funded broadcasts", where the server validates the funding backing an order, and attaches that validation, in some form, to the message. They could also attach the users current reputation to the message. |
WIP
https://github.com/decred/dcrdex/blob/master/tatanka/spec/meshdex.md contains most of the guidelines we have so far and should be read first.
Some more points about orders from matrix:
Lot size is defined per-order based on the user's desired maximum fee exposure, and must be a power of 2.
Rate step is always 1 atom / atom equivalent
All orders are limit orders, so no marketBuyBuffer is required
All orders will have an expiration time shortly into the future, and must be refreshed by the orderer
Probably no epochs
The server does not have anything to do with the orderbook, it is only kept by clients. This issue currently aims to figure out the protocol to use to keep clients synchronized.
The text was updated successfully, but these errors were encountered: