code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/mid-price-issue.feature (about) 1 Feature: Replicate unexpected margin issues - no mid price pegs 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 | 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 | 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 23 Scenario: Mid price works as expected 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 | 8200000000 | 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 | 4500000000 | 8200000000 | 53 And the order book should have the following volumes for market "DAI/DEC22": 54 | side | price | volume | 55 | sell | 8200000000 | 1 | 56 | sell | 4500000010 | 5 | 57 | buy | 4499999990 | 5 | 58 | buy | 800000000 | 1 |