vega-frontend-monorepo/specs/7003-MORD-manage_orders.md
Maciek ef26d03d36
chore(markets): distinguish between product types - add specs (#4564)
Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
2023-08-17 17:27:15 +01:00

12 KiB
Raw Permalink Blame History

Manage orders

Users place orders to describe the trades they would like to make: buy or sell, at what price, how long it is valid for etc. In many cases they can amend or cancel these orders while they are still active, for example: changing price.

Once a user has placed an order they may wish to confirm it's status in a list of other orders. e.g. whether it has been accepted, filled, how close it is to being filled etc. Users may be interested in the price of their orders relative to the price of the market and how much of the order's size has been filled.

Orders can also be placed on behalf of a user/party via liquidity or pegged order shapes. These order cannot be amended on canceled in the same way as other orders.

Markets also have statuses that may affect how a user perceives the state of an order, e.g if the order was placed while in "normal" continuous trading, but the market is now in auction.

Orders list

User will have differing needs/preferences in terms of what they want to see about an order and how orders are grouped and listed. It is common for interfaces to allow users to customize how orders are displayed.

Field customization

  • should have the ability to select what fields/data are shown for each order in the list
  • should have the ability to change the order of fields (e.g. table columns)
  • should have the ability to give each column in the list more or less space

Fields

When looking at a list of orders, I...

  • must see status of the order (7003-MORD-001), and therefore (nested bullets added for context, ACs are on fields that follow)...

    • Active
      • How much of the order is filled / remains unfilled
      • How close the mark price is to order
      • If this order was filled at the limit price what would what effect would it have on realized PnL
      • I may want to amend or cancel this order
    • Expired
      • When did it expire
      • How much was filled / remaining
    • Cancelled
      • What canceled it? When did I cancel it TODO double check that "cancelled" only comes from user action
    • Stopped
      • What stopped it (e.g. was it because an FOC that was not filled, or because of margin availability)
    • Filled
      • What was the average fill price I got for this order
    • Rejected
      • Why was this order rejected (show rejectedReason)
    • PartiallyFilled
      • How much was filled before the order was canceled
      • What was the average fill price I got for this order
    • Parked
      • Why is the market currently in auction
      • Link to pegged shape (see below)
  • must see any reason (mainnet docs) that has been supplied by the API along with the order status e.g. "Rejected: Due to insufficient margin", "Stopped: Reduce only, would open new volume" (7003-MORD-018)

  • must see what market an order is related to (either code, ID or name, preferable name) (7003-MORD-002)

    • should see what the status is of the market (particularly if it is not "normal")
  • must see product type of market's instrument (7003-MORD-020)

  • must see the size of the order (7003-MORD-003)

  • must see the direction/side (Long or Short) of the order (this can be implied with a + or negative suffix on the size, + for Long, - for short) (7003-MORD-004)

  • must see order type (7003-MORD-005)

  • if order created by pegged or liquidity provision shape: should see order origin

    • could see what part of the liquidity shape or pegged order shape this relates to or it's offset+reference See pegged orders and liquidity provisions shapes below.
    • could see link to full shape
  • should see how much of the order's size has been filled e.g. if the order was for 50 but so far only 10 have traded I should see Filled = 10. Note: this is marked as a should because in the case of Rejected order and some other scenarios it isn't relevant.

  • should see how much of the order's size remains.

  • if order type = Limit: must see the Limit price that was set on the order

  • if order type = Market: must not see a price for active or parked orders, a -, Market or n/a is more appropriate (API may return 0).

  • must see the time in force applied to the order (can be abbreviated here) (7003-MORD-006)

  • must see if any execution flags (aka conditions. e.g. Post only, Reduce only) were applied to the order (7003-MORD-019)

  • should see "created at" time

  • could see updated at (this is used by the system when an order is amended, or repriced (in pegged and LP) not sure this in needed)

  • must be able to see a single order view dialog with all the fields present above

  • should see time priority (how many orders are before mine at this price)

  • if the order is Active & not part of a liquidity or peg shape: must see an option to amend the individual order (7003-MORD-007)

  • if the order is Active & is part of a liquidity or peg shape: must not see an option to amend the individual order (7003-MORD-008)

    • could see a link to amend shape
  • if the order is Active & not part of a liquidity or peg shape: must see an option to cancel the individual order

  • if the order is Active & is part of a liquidity or peg shape: must not see an option to cancel the individual order

    • could see a link to cancel shape

... so I can understand the state of my orders and decide what to do next

Filters

When looking at a list of orders, I...

  • should have the ability to see all orders regardless of status in one list
  • should have the ability to see only active & parked orders
  • should have the ability to see only non-active & parked order (i.e. all orders that do not have the status of Active & Parked)
  • could have the ability to filter by any field(s)
    • where a field is an enum: should be able to select one on or more values for a field that should be included

... so I can focus on the type of orders statuses etc that I want to at that time

Sorting

When looking at a list of orders, I...

  • should be able to sort the list (both directions) by any field in the order list
    • should be able to add a secondary sort. e.g. by market then by date
  • should have the default sorted by created time (or updated time if newer), with newest at the top
  • should retain sorting preferences between switching views / browser reload

... so the sort order matches my mental model and or makes it easy for me to find the orders I am looking for

Grouping

When looking at a list of orders, I...

  • should be able to group orders by any field e.g. by market, lp etc
  • should have default grouping by market

... so I can make decisions easily on a set of orders

Cancel orders

When looking to take order out of the book, I...

  • must select whether to cancel an individual order or all orders on a market (7003-MORD-009)
  • could be able to cancel all orders for markets in a given settlement asset
  • would like to cancel all orders for all markets
  • must be able to submit the Vega transaction to cancel order(s) (7003-MORD-010)
    • could show the margin requirement reduction/increase that will take place before submitting
  • must see feedback on order status after the Vega transaction (7003-MORD-011)

... so that the order will not be filled and I don't end up with a change in my position that I was not expecting

Amend order - price

Read more about order amends.

When looking to amend an order, I...

... so the order is more likely to get filled or will be filled at a more competitive price

Amend order - other than price

TODO - Acceptance criteria for other types of order amend

On a price history chart

when looking at a price history chart, I...

  • would like to see all my active orders shown on the vertical axis
  • would like to drag orders to change their price

... so I can see my orders in context of price history

On a depth chart

when looking at a depth chart, I...

  • would like to see all my active orders shown on the horizontal axis
  • would like to drag orders to change their price

... so I can see my orders in context of price history

In order book

when looking at an order book, I...

  • would like to see all my active orders shown next to the prices they have

... so I can see my orders in context of price history

Pegged order shapes

When looking to understand the state of a pegged order shape...

  • should see the whole shape of a pegged order
  • must see the reference, offset and direction for each part pegged order (7003-MORD-016)
  • should see the current price for each buy/sell
  • should see the filled/remaining for each part of the order
  • when order is not Active: should show the order status (perhaps instead of price)
  • should be able to cancel the whole pegged order
  • would like to see link to edit the shape of a pegged order
  • would like to see the date submitted/updated

... so I can decide if I wish to amend or cancel my pegged order shape

Cancel Pegged order shapes

TODO

Liquidity order shapes

When looking to understand the state of a liquidity provision, with a provided shape...

  • would like to see the liquidity commitment order status (pending, active, parked, canceled etc)

  • would like to see the fee bid

  • should see the whole shape of a liquidity order

  • must see the reference, offset and direction for each part liquidity order order (7003-MORD-017)

  • should see the current price for each buy/sell

  • when order is not Active: should show the order status (perhaps instead of price)

  • should see link to cancel the whole liquidity order shape (see liquidity provision)

  • would like to see link to edit the shape of a pegged order (see liquidity provision)

  • would like to see the date submitted/updated

... so I can decide if I wish to amend or cancel my shape

Cancel or amend Pegged order shapes

See liquidity provision,