Order Techniques with Project Serum

 

Order Techniques with Project Serum

    I've started noticing different Order placement/cancellation patterns on Serum, than what normally occurs through the user interface (serum-dex-ui).

Normal post-only limit order (serum-dex-ui)


(Left: serum-dex-ui, Right: market maker)

The left order from serum-dex-ui contains pre-and-post Match Orders instructions, which are no longer needed. This is likely maintained for backwards compatibility. Then as expected there is the New Order V3 instruction to place the limit order. Let's compare this to the market maker on the right.
  1. NewOrderV3
  2. ConsumeEvents with the trader's open orders account included
  3. Settle Funds from the open orders wallet for the market.
Both instructions are for a post-only limit order. Yet this market maker is calling Consume Events, which processes the Event Queue, and Settle Funds, which clears out any unsettled balances and useful for smoother trading.

Order cancellation



(Left: serum-dex-ui, Right: market maker)

The left order still has the unneeded Match Orders instructions, and a single Cancel Order instruction. The market maker has the following flow:
  1. ConsumeEvents with the trader's open orders account included (decreases settlement time or something)
  2. CancelOrderByClientIdV2 (normal, nothing special here)
  3. ConsumeEvents with the trader's open orders account included (again)
  4. Settle Funds from the open orders wallet for the market.
This acts like a "Super Cancel", which should probably be implemented in serum-dex-ui. It cranks the market, cancels the order, cranks again, then settle funds. This should lead to a smoother trading experience.

Comments