vega-frontend-monorepo/specs/7002-SORD-submit_orders.md

20 KiB

Submit order

As a user I want change my exposure on a market (e.g. open a position, increase or decrease my open volume), I want to submit an order with instructions for how my order should be executed so I have some control over the price that I get, as well as if when/my order should stay on the book. See specs about orders for more info.

Before seeing a "deal ticket"

When looking at a market, I...

  • must see/select the Market I am submitting the order for (7002-SORD-001)

  • must see the current status of the market (7002-SORD-061)

    if the market is in a state of rejected, canceled or closed:

    • must see that the market is not accepting orders and never will be (7002-SORD-062)

    if the market is in a state of tradingTerminated:

    • must see that the market is not accepting orders and never will be (7002-SORD-063)
    • should see the price that was used to settle the market
    • should see a link to oracle spec and data

    if the market is in a state of settled:

    • must see that the market is not accepting orders and never will be (7002-SORD-066)
    • should see the oracle events that terminated the market
    • should see a link to oracle spec and data

    if the market is in a state of suspended:

    • should see what suspended the market
    • should see the conditioned required for the auction to end
    • should see the current data values that the auction end is measured against (e.g. Supplied stake)

...so I know if the market is accepting orders.

The rest of this document only applies if the state of the market is pending, active or suspended:

Deal ticket

When populating a deal ticket I...

  • must see the current market trading mode (Continuous, Auction etc) (7002-SORD-002)

  • If I have a 0 total balance of the settlement asset: must be warned that I have insufficient collateral (but also allow you to populate ticket because I might want to try before I deposit) (7002-SORD-003)

    • should have a way to easily deposit the required collateral
  • must select a side/direction e.g. long/short (note: some implementations may do this with two different submit buttons long/short rather than a toggle) (7002-SORD-004)

  • must be able to select the order type that I wish to submit (7002-SORD-005)

Order size

...need to select a size, when selecting a size for my order, I...

  • must input an order size (aka amount or contracts) (7002-SORD-010)
    • should have the previous value for the selected market available e.g. pre-populated (last submitted or last changed)
    • should be able to quickly change the size by the market's min-contract size e.g. hit up/down on the keyboard to increase
      • should be able to use modifier keys (SHIFT, ALT etc) to increase/decrease in larger increments with arrows
      • would like to be able to enter a number followed be "k" or "m" or "e2" etc. to make it thousands or millions or hundreds, etc.
  • must be warned (pre-submit) if input has too many digits after the decimal place for the market's "position" decimal places (7002-SORD-016)

... so I get the size of exposure (open volume) that I want

Price - Limit order

... if wanting to place a limit on the price that I trade at, I...

  • must enter a price. (7002-SORD-017)
  • must see the price unit (as defined in market) (7002-SORD-018)
    • should be able quickly pre-populate the price with the current mark price (if there is one, 0 if not) e.g. by focusing the input and hitting up/down
    • should have the previous value for the selected market pre-populated (last submitted or last changed)
    • should be able to hit up/down on the keyboard to increase the price by the market's tick size (if set, or smallest increment)
      • should be able to use modifier keys (SHIFT, ALT etc) to increase/decrease in larger increments with arrows
      • would like to be able to enter a number followed be "k" or "m" or "e2" etc. to make it thousands or millions or hundreds, etc.
  • must be warned (pre-submit) if the input price has too many digits after the decimal place for the market "quote" (7002-SORD-059)

... so that my order only trades at up/down to a particular price

Price - Limit stop order

... if wanting to place a stop limit on the price that I trade at, I...

  • must enter a price (7002-SORD-020)
  • must see the price unit (as defined in market) (7002-SORD-021)
    • must have the previous value for the selected market pre-populated (last submitted or last changed) (7002-SORD-022)
    • must be able to hit up/down on the keyboard to increase the price by the market's tick size (if set, or smallest increment) (7002-SORD-029)
  • must be warned (pre-submit) if the input price has too many digits after the decimal place for the market "quote" (7002-SORD-032)
  • must select a trigger direction (7002-SORD-033)
  • must enter a trigger value (7002-SORD-037)
  • must select a trigger type (7002-SORD-038)

... so that my order only trades after reaching the trigger and at up/down to a particular price - it is reduce only order

Market order

... if wanting to trade regardless of price (or assuming that the market is liquid enough that the current best prices are enough of an indication of the price I'll get)...

  • must not see a price input (7002-SORD-019)
  • should be warning if the market is in auction and the market order may be rejected

... so I can quickly submit an order without populating the ticket with elements I don't care about

Market stop order

... if wanting to trade regardless of price with trigger (or assuming that the market is liquid enough that the current best prices are enough of an indication of the price I'll get)...

... so that my order only trades after reaching the trigger and with market price - it is reduce only order

Pegged

... submit an order where the price is offset from a price in system (best bid etc)

  • TODO

... so my order will move with the market

Time in force

... should to select a time in force, when selecting a time in force, I...

  • must select a time in force
  • should only be warned if the time in force is not applicable to the order type I have selected
  • should only be warned if the time in force is not applicable to current period's trading mode
  • if the user has not set a preference: market orders must default to IOC (7002-SORD-030)
  • if the user has not set a preference: limit orders must default to GTC (7002-SORD-031)
  • if it is stop order limit or stop order market then must select

... so I can control if and how my order stays on the order book

Execution flags

... could select some execution flags. When selecting execution flags (aka order conditions)...

  • must see an option to select "Post only" (7003-SORD-054)

    • should see explanation of what Post only is/does
    • must see the post only option is unselected and disabled (can not be checked) if the time in force is set to IOC or FOK (7003-SORD-055)
      • must see an explanation of why the option is disabled (7003-SORD-056)
  • must see an option to select "Reduce only" (7003-SORD-057)

    • should see explanation of what Reduce only is/does (7003-SORD-058)
  • must see that selecting "Post only" or "reduce only" de-select the other (if selected). As is it not possibly to apply them both to an order (7003-SORD-059)

  • must see an option to select expire for stop order limit and market (7002-SORD-071)

  • must see an option to select oco for stop order limit and market (7002-SORD-082)

... so I can control in more detail how my order is executed

Auto Populating a deal ticket non-manual methods

  • TODO Populate by selecting a size/price in the order book
  • TODO Populate by selecting a size/price in the chart
  • TODO Populate by selecting a size/price in the depth chart
  • TODO Input price as a % of account, given the current price field
  • should be able to determine how much leverage I'd like (given general balance, and other inputs)

See the potential consequences of an order before it is submit

... based on the current inputs I'd like an indication of the consequences of my order based on my position and the state of the market, I...

  • could see my resulting open volume
  • could see the amount this order might move the market in percentage terms
  • could see what the new best prices of the market would be after placing this order (assuming my order moves the market)
  • could see new volume weighted average entry price if not 0
  • could see and indication the volume weighted price that this particular order
  • could see an indication of how much of the order will trade when it hits the book and how much might remain passive
  • could see a new liquidation level
  • could see an estimate of the fees that will be paid (if any)
  • could see my "position leverage" TODO - define this
  • could see my "account leverage" TODO - define this
  • could see an amount of realized Profit / Loss
  • could see any change in margin requirements (if more or less margin will be required)
  • could see the notional value of my order

... so that I can adjust my inputs before submitting

Submit an order

... need to submit my order, when submitting my order, I...

... so that I am aware of the status of my order before seeing it in the orders table.

... so I get the sort of order, and price, I wish.

Manage positions and order

After submitting orders I'll want to manage orders. If my orders resulted in a position I may wish to manage positions).


Typical order scenarios to design/test for

Market in continuous trading:

  • Limit order, Long, GTC, with a price that is lower than the current price
  • Limit order, Short, GFN, that crosses the book but only gets a partial fill when order is processed
  • Market order, IOC, that increases open volume (aka size of position)
  • a limit order GFA when market is in Auction
  • an limit that reduces exposure from something to 0
  • a limit order, FOK, that squares and reverses e.g. I'm long 10, I short 20 to end short 10

Market in auction:

  • Attempt Market order in Auction mode: should warn order is invalid
  • Attempt limit order GFN when market is normally Continuous (but currently in auction), should warn that GFN will not work