code.vegaprotocol.io/vega@v0.79.0/core/integration/features/auctions/3528-indefinite-auction-extension.feature (about) 1 Feature: Replicate issue 3528, where price monitoring continuously extended liquidity auction 2 3 Background: 4 Given the following network parameters are set: 5 | name | value | 6 | limits.markets.maxPeggedOrders | 4 | 7 And the liquidity monitoring parameters: 8 | name | triggering ratio | time window | scaling factor | 9 | lqm-params | 0.9 | 24h | 1 | 10 11 And the average block duration is "1" 12 And the simple risk model named "simple-risk-model-1": 13 | long | short | max move up | min move down | probability of trading | 14 | 0.1 | 0.1 | 10 | 10 | 0.1 | 15 And the log normal risk model named "log-normal-risk-model-1": 16 | risk aversion | tau | mu | r | sigma | 17 | 0.000001 | 0.1 | 0 | 1.4 | -1 | 18 And the fees configuration named "fees-config-1": 19 | maker fee | infrastructure fee | 20 | 0.004 | 0.001 | 21 And the price monitoring named "price-monitoring-1": 22 | horizon | probability | auction extension | 23 | 100 | 0.99 | 300 | 24 And the markets: 25 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 26 | ETH/DEC21 | ETH | ETH | lqm-params | simple-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.01 | 0 | default-futures | 27 And the parties deposit on asset's general account the following amount: 28 | party | asset | amount | 29 | party0 | ETH | 1000000000 | 30 | party1 | ETH | 100000000 | 31 | party2 | ETH | 100000000 | 32 | party3 | ETH | 100000000 | 33 | party4 | ETH | 100000000 | 34 | party5 | ETH | 100000000 | 35 | party6 | ETH | 100000000 | 36 | party7 | ETH | 100000000 | 37 38 Scenario: Enter liquidity auction, extended by trades at liq. auction end, single trade -> single extension 39 40 Given the parties submit the following liquidity provision: 41 | id | party | market id | commitment amount | fee | lp type | 42 | lp1 | party0 | ETH/DEC21 | 700 | 0.001 | submission | 43 And the parties place the following pegged iceberg orders: 44 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 45 | party0 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 2 | 46 | party0 | ETH/DEC21 | 2 | 1 | buy | MID | 2 | 1 | 47 | party0 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 2 | 48 | party0 | ETH/DEC21 | 2 | 1 | sell | MID | 2 | 1 | 49 50 And the parties place the following orders: 51 | party | market id | side | volume | price | resulting trades | type | tif | 52 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 53 | party1 | ETH/DEC21 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 54 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 55 | party2 | ETH/DEC21 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 56 57 When the opening auction period ends for market "ETH/DEC21" 58 59 Then the parties submit the following liquidity provision: 60 | id | party | market id | commitment amount | fee | lp type | 61 | lp1 | party0 | ETH/DEC21 | 800 | 0.001 | amendment | 62 63 When the network moves ahead "1" blocks 64 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 65 # liquidity auction is extended by 1 second this block (duration accrues) 66 67 And the parties submit the following liquidity provision: 68 | id | party | market id | commitment amount | fee | lp type | 69 | lp1 | party0 | ETH/DEC21 | 801 | 0.001 | amendment | 70 71 And the parties place the following orders: 72 | party | market id | side | volume | price | resulting trades | type | tif | 73 | party1 | ETH/DEC21 | buy | 20 | 1020 | 1 | TYPE_LIMIT | TIF_GTC | 74 | party2 | ETH/DEC21 | sell | 10 | 1020 | 0 | TYPE_LIMIT | TIF_GTC | 75 76 And the parties submit the following liquidity provision: 77 | id | party | market id | commitment amount | fee | lp type | 78 | lp1 | party0 | ETH/DEC21 | 10000 | 0.001 | amendment | 79 80 When the network moves ahead "1" blocks 81 82 ## Price auction kicked off 83 Then the market data for the market "ETH/DEC21" should be: 84 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 85 | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 2244 | 10000 | 12 | 300 | 86 ## End of price auction -> trade goes through and the mark price is updated 87 When the network moves ahead "301" blocks 88 Then the market data for the market "ETH/DEC21" should be: 89 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | 90 | 1020 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 2244 | 10000 | 22 | 0 | 91 92 93 Scenario: Enter liquidity auction, extended by trades at liq. auction end, multiple trades -> still a single extension 94 95 Given the parties submit the following liquidity provision: 96 | id | party | market id | commitment amount | fee | lp type | 97 | lp1 | party0 | ETH/DEC21 | 700 | 0.001 | submission | 98 And the parties place the following pegged iceberg orders: 99 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 100 | party0 | ETH/DEC21 | 2 | 1 | buy | BID | 1 | 2 | 101 | party0 | ETH/DEC21 | 2 | 1 | buy | MID | 2 | 1 | 102 | party0 | ETH/DEC21 | 2 | 1 | sell | ASK | 1 | 2 | 103 | party0 | ETH/DEC21 | 2 | 1 | sell | MID | 2 | 1 | 104 And the parties place the following orders: 105 | party | market id | side | volume | price | resulting trades | type | tif | 106 | party1 | ETH/DEC21 | buy | 1 | 900 | 0 | TYPE_LIMIT | TIF_GTC | 107 | party1 | ETH/DEC21 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 108 | party2 | ETH/DEC21 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 109 | party2 | ETH/DEC21 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 110 111 When the opening auction period ends for market "ETH/DEC21" 112 # opening auction (extended by liquidity auction() should have an end time at T+2s 113 And the parties submit the following liquidity provision: 114 | id | party | market id | commitment amount | fee | lp type | 115 | lp1 | party0 | ETH/DEC21 | 800 | 0.001 | amendment | 116 117 When the network moves ahead "1" blocks 118 119 And the parties submit the following liquidity provision: 120 | id | party | market id | commitment amount | fee | lp type | 121 | lp1 | party0 | ETH/DEC21 | 801 | 0.001 | amendment | 122 And the parties place the following orders: 123 | party | market id | side | volume | price | resulting trades | type | tif | 124 | party1 | ETH/DEC21 | buy | 10 | 1020 | 1 | TYPE_LIMIT | TIF_GTC | 125 | party2 | ETH/DEC21 | sell | 20 | 1020 | 0 | TYPE_LIMIT | TIF_GTC | 126 127 And the parties submit the following liquidity provision: 128 | id | party | market id | commitment amount | fee | lp type | 129 | lp1 | party0 | ETH/DEC21 | 1010 | 0.001 | amendment | 130 131 When the network moves ahead "1" blocks 132 133 # liquidity requirements met -> opening auction finishes (price monitoring extension not possible in opening auction) 134 Then the market data for the market "ETH/DEC21" should be: 135 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | auction end | min bound | max bound | 136 | 1000 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 2040 | 1010 | 12 | 300 | 1001 | 1019 | 137 138 When the parties place the following orders: 139 | party | market id | side | volume | price | resulting trades | type | tif | 140 | party1 | ETH/DEC21 | buy | 10 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | 141 | party2 | ETH/DEC21 | sell | 10 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | 142 And the network moves ahead "1" blocks 143 144 145 # Place order outwith price monitoring bounds 146 And the parties place the following orders: 147 | party | market id | side | volume | price | resulting trades | type | tif | 148 | party1 | ETH/DEC21 | buy | 5 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 149 | party3 | ETH/DEC21 | buy | 3 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 150 | party5 | ETH/DEC21 | buy | 2 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 151 | party2 | ETH/DEC21 | sell | 10 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 152 | party4 | ETH/DEC21 | sell | 6 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 153 | party6 | ETH/DEC21 | sell | 4 | 1040 | 0 | TYPE_LIMIT | TIF_GTC | 154 155 When the network moves ahead "10" blocks 156 157 And the parties submit the following liquidity provision: 158 | id | party | market id | commitment amount | fee | lp type | 159 | lp1 | party0 | ETH/DEC21 | 10000 | 0.001 | amendment | 160 161 # Auction end is now 290 blocks away 162 163 When the network moves ahead "290" blocks 164 165 # price auction ends as expected event though uncrossing price is outwith the previous bounds (price extension can be called at most once per trigger) 166 # Now the open interest is 30 (previously was 20) -> because the initial trade at 1010 went through. The target stake is increased because of the time + leaving auction 167 # The price bounds have also changed from 1016-1034, and the mark price is now 1030 (the 1010 orders are gone, so the uncrossing price is different) 168 Then the market data for the market "ETH/DEC21" should be: 169 | mark price | trading mode | auction trigger | extension trigger | horizon | min bound | max bound | target stake | supplied stake | open interest | auction end | 170 | 1020 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | AUCTION_TRIGGER_UNSPECIFIED | 100 | 1010 | 1030 | 3060 | 10000 | 30 | 0 |