code.vegaprotocol.io/vega@v0.79.0/core/integration/features/capped-futures/0016-PFUT-015.feature (about) 1 Feature: Pegged orders are capped to max price. 2 3 Background: 4 Given the following assets are registered: 5 | id | decimal places | 6 | DAI | 5 | 7 Given the liquidity monitoring parameters: 8 | name | triggering ratio | time window | scaling factor | 9 | lqm-params | 1.0 | 20s | 10 | 10 And the log normal risk model named "dai-lognormal-risk": 11 | risk aversion | tau | mu | r | sigma | 12 | 0.00001 | 0.000114077 | 0 | 0 | 0.41 | 13 And the markets: 14 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | linear slippage factor | quadratic slippage factor | sla params | max price cap | binary | fully collateralised | 15 | DAI/DEC22 | DAI | DAI | lqm-params | dai-lognormal-risk | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 5 | 0.25 | 0 | default-futures | 4500000000 | false | false | 16 And the following network parameters are set: 17 | name | value | 18 | market.auction.minimumDuration | 1 | 19 | network.markPriceUpdateMaximumFrequency | 0s | 20 | limits.markets.maxPeggedOrders | 2 | 21 22 @MidPrice @NoPerp @Capped 23 Scenario: 0016-PFUT-015: pegged orders are capped to max price. 24 Given the parties deposit on asset's general account the following amount: 25 | party | asset | amount | 26 | party1 | DAI | 110000000000 | 27 | party2 | DAI | 110000000000 | 28 | party3 | DAI | 110000000000 | 29 30 And the parties submit the following liquidity provision: 31 | id | party | market id | commitment amount | fee | reference | lp type | 32 | lp1 | party1 | DAI/DEC22 | 20000000000 | 0.01 | lp-1 | submission | 33 | lp1 | party1 | DAI/DEC22 | 20000000000 | 0.01 | lp-1 | submission | 34 And the parties place the following pegged iceberg orders: 35 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 36 | party1 | DAI/DEC22 | 5 | 3 | buy | MID | 5 | 10 | 37 | party1 | DAI/DEC22 | 5 | 3 | sell | MID | 5 | 10 | 38 39 When the parties place the following orders: 40 | party | market id | side | volume | price | resulting trades | type | tif | reference | 41 | party2 | DAI/DEC22 | buy | 1 | 800000000 | 0 | TYPE_LIMIT | TIF_GTC | party2-1 | 42 | party2 | DAI/DEC22 | buy | 1 | 3500000000 | 0 | TYPE_LIMIT | TIF_GTC | party2-2 | 43 | party3 | DAI/DEC22 | sell | 1 | 3500000000 | 0 | TYPE_LIMIT | TIF_GTC | party3-1 | 44 | party3 | DAI/DEC22 | sell | 1 | 4499999999 | 0 | TYPE_LIMIT | TIF_GTC | party3-2 | 45 46 And the opening auction period ends for market "DAI/DEC22" 47 Then the following trades should be executed: 48 | buyer | price | size | seller | 49 | party2 | 3500000000 | 1 | party3 | 50 And the market data for the market "DAI/DEC22" should be: 51 | mark price | best static bid price | static mid price | best static offer price | 52 | 3500000000 | 800000000 | 2649999999 | 4499999999 | 53 And the order book should have the following volumes for market "DAI/DEC22": 54 | side | price | volume | 55 | sell | 4499999999 | 1 | 56 | sell | 2650000009 | 5 | 57 | buy | 2649999990 | 5 | 58 | buy | 800000000 | 1 | 59 # Ensure the price cap is enforced on all orders 60 When the parties place the following orders: 61 | party | market id | side | volume | price | resulting trades | type | tif | reference | error | 62 | party3 | DAI/DEC22 | sell | 1 | 8200000000 | 0 | TYPE_LIMIT | TIF_GTC | party3-3 | invalid order price | 63 64 # Now move mid price close to the max price 65 When the parties cancel the following orders: 66 | party | reference | 67 | party2 | party2-1 | 68 And the parties place the following orders: 69 | party | market id | side | volume | price | resulting trades | type | tif | reference | 70 | party2 | DAI/DEC22 | buy | 1 | 4499999998 | 0 | TYPE_LIMIT | TIF_GTC | party2-2 | 71 Then the market data for the market "DAI/DEC22" should be: 72 | mark price | best static bid price | static mid price | best static offer price | 73 | 3500000000 | 4499999998 | 4499999998 | 4499999999 | 74 # Now the sell order should be capped to max price, buy order is offset by 10 75 And the order book should have the following volumes for market "DAI/DEC22": 76 | side | price | volume | 77 | sell | 4499999999 | 6 | 78 | buy | 4499999998 | 1 | 79 | buy | 4499999989 | 5 |