Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 2.49 KB

0052-FPOS-fractional_orders_positions.md

File metadata and controls

27 lines (19 loc) · 2.49 KB

Fractional order sizes and positions

To ensure that Vega markets can be quoted in standardised units but also support a wide variety of trader types and needs, in must be possible to submit orders and therefore hold positions with fractional sizes. For example in a BTCUSD market one might take out a position equivalent to 0.02 BTC.

Although prior versions of the specs have not specified a data type, the initial implementation of the Vega protocol accepts only integer sized positions.

The solution to this is to:

  • Introduce a new market framework parameter for all markets known as Position Decimal Places that specifies the precision allowable on that market.
  • Convert at API boundaries OR instruct clients to do so by dividing outputs and multiplying inputs by 10^PDP where PDP is the configured position decimal places for the market.
  • Wherever notional sizes, margins, fees, valuations, etc. are calculated in the core, to also ensure the input quantity if divided by 10^PDP. This may be done centrally e.g. for positions so that trading/position management are dealing with integer sizes but fees, margins, valuation calculations use the "true" position size.

Specs affected by this change (Note: in many cases the implementation may not change):

Acceptance Criteria

  • All proposed markets will have a decimal places property available via the API (0052-FPOS-001). For product spot: (0052-FPOS-003)
  • An order created on the client with a price of 1 results in an order being created with a price of 1 * 10^[Market.DecimalPlaces] (0052-FPOS-002). For product spot: (0052-FPOS-004)
  • Fees are calculated as per (0029-FEES-013)
  • Mark-to-market settlement happens correctly with PDP > 0 (0003-MTMK-0015)
  • Margins are correctly calculated for markets with PDP > 0 (0019-MCAL-008).
  • Market framework reports position decimal places (0001-MKTF-001).