code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0041-TSK-target_stake.feature (about)

     1  Feature: Target stake
     2    Background:
     3      Given the simple risk model named "simple-risk-model-1":
     4        | long | short | max move up | min move down | probability of trading |
     5        | 0.1  | 0.1   | 10          | -10           | 0.1                    |
     6      And the following network parameters are set:
     7        | name                                    | value |
     8        | network.markPriceUpdateMaximumFrequency | 0s    |
     9        | limits.markets.maxPeggedOrders          | 16    |
    10      # Market risk parameters and assets don't really matter.
    11      # We need to track open interest i.e. sum of all long positions across the parties and how they change over time
    12      And the log normal risk model named "log-normal-risk-model-1":
    13        | risk aversion | tau                    | mu | r  | sigma |
    14        | 0.000001      | 0.00011407711613050422 | -1 | -1 | -1    |
    15      And the fees configuration named "fees-config-1":
    16        | maker fee | infrastructure fee |
    17        | 0.00025   | 0.0005             |
    18      And the margin calculator named "margin-calculator-1":
    19        | search factor | initial factor | release factor |
    20        | 1.1           | 1.2            | 1.4            |
    21      And the markets:
    22        | id        | quote name | asset | risk model          | margin calculator         | auction duration | fees          | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
    23        | ETH/DEC21 | BTC        | BTC   | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | default-none     | default-eth-for-future | 0.25                   | 0                         | default-futures |
    24      And the average block duration is "1"
    25  
    26      # T0
    27      And time is updated to "2021-03-08T00:00:00Z"
    28  
    29      # setup accounts
    30      Given the parties deposit on asset's general account the following amount:
    31        | party | asset | amount    |
    32        | lp_1  | BTC   | 100000000 |
    33        | lp_2  | BTC   | 100000000 |
    34        | lp_3  | BTC   | 100000000 |
    35        | lp_4  | BTC   | 100000000 |
    36        | lp_5  | BTC   | 100000000 |
    37        | lp_6  | BTC   | 100000000 |
    38        | lp_7  | BTC   | 100000000 |
    39        | lp_8  | BTC   | 100000000 |
    40        | tt_1  | BTC   | 100000000 |
    41        | tt_2  | BTC   | 100000000 |
    42        | tt_3  | BTC   | 100000000 |
    43        | tt_4  | BTC   | 100000000 |
    44  
    45    Scenario: Max open interest changes over time (0041-TSTK-002, 0041-TSTK-003, 0042-LIQF-007)
    46  
    47      Given the liquidity monitoring parameters:
    48        | name               | triggering ratio | time window | scaling factor |
    49        | updated-lqm-params | 0.0              | 10s         | 1.5            |
    50      When the markets are updated:
    51        | id        | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    52        | ETH/DEC21 | updated-lqm-params   | 0.25                   | 0                         |
    53  
    54      # put some volume on the book so that others can increase their
    55      # positions and close out if needed too
    56      When the parties place the following orders:
    57        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
    58        | lp_1  | ETH/DEC21 | buy  | 1000   | 90    | 0                | TYPE_LIMIT | TIF_GTC | lp_1_0    |
    59        | lp_1  | ETH/DEC21 | sell | 1000   | 110   | 0                | TYPE_LIMIT | TIF_GTC | lp_1_1    |
    60  
    61      # nothing should have traded yet
    62      Then the mark price should be "0" for the market "ETH/DEC21"
    63  
    64      # Traders 1, 2, 3 go long
    65      When the parties place the following orders:
    66        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
    67        | tt_1  | ETH/DEC21 | buy  | 10     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_1_0    |
    68        | tt_2  | ETH/DEC21 | buy  | 20     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
    69        | tt_3  | ETH/DEC21 | buy  | 30     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
    70  
    71      Then the parties submit the following liquidity provision:
    72        | id  | party | market id | commitment amount | fee   | lp type    |
    73        | lp1 | lp_1  | ETH/DEC21 | 135               | 0.001 | submission |
    74        | lp1 | lp_1  | ETH/DEC21 | 135               | 0.001 | amendment  |
    75        | lp2 | lp_2  | ETH/DEC21 | 165               | 0.002 | submission |
    76        | lp2 | lp_2  | ETH/DEC21 | 165               | 0.002 | amendment  |
    77        | lp3 | lp_3  | ETH/DEC21 | 300               | 0.003 | submission |
    78        | lp3 | lp_3  | ETH/DEC21 | 300               | 0.003 | amendment  |
    79        | lp4 | lp_4  | ETH/DEC21 | 300               | 0.004 | submission |
    80        | lp4 | lp_4  | ETH/DEC21 | 300               | 0.004 | amendment  |
    81        | lp5 | lp_5  | ETH/DEC21 | 500               | 0.005 | submission |
    82        | lp5 | lp_5  | ETH/DEC21 | 500               | 0.005 | amendment  |
    83        | lp6 | lp_6  | ETH/DEC21 | 300               | 0.006 | submission |
    84        | lp6 | lp_6  | ETH/DEC21 | 300               | 0.006 | amendment  |
    85        | lp7 | lp_7  | ETH/DEC21 | 200               | 0.007 | submission |
    86        | lp7 | lp_7  | ETH/DEC21 | 200               | 0.007 | amendment  |
    87        | lp8 | lp_8  | ETH/DEC21 | 100               | 0.008 | submission |
    88        | lp8 | lp_8  | ETH/DEC21 | 100               | 0.008 | amendment  |
    89      And the parties place the following pegged iceberg orders:
    90        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    91        | lp_1   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
    92        | lp_1   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
    93        | lp_2   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
    94        | lp_2   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
    95        | lp_3   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
    96        | lp_3   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
    97        | lp_4   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
    98        | lp_4   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
    99        | lp_5   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   100        | lp_5   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   101        | lp_6   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   102        | lp_6   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   103        | lp_7   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   104        | lp_7   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   105        | lp_8   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   106        | lp_8   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   107   
   108      Then the opening auction period ends for market "ETH/DEC21"
   109  
   110      # Now parties 1,2,3 are long so open intereset = 10+20+30 = 60.
   111      # Target stake is mark_price x max_oi x target_stake_scaling_factor x rf_short
   112      # rf_short should have been set above to 0.1
   113      # target_stake = 110 x 60 x 1.5 x 0.1
   114      Then the market data for the market "ETH/DEC21" should be:
   115        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   116        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 990          | 2000           | 60            |
   117      And the liquidity fee factor should be "0.005" for the market "ETH/DEC21"
   118      # T0 + 1s
   119      Then the network moves ahead "1" blocks
   120  
   121      # Trader 3 closes out 20
   122      When the parties place the following orders with ticks:
   123        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   124        | tt_3  | ETH/DEC21 | sell | 20     | 90    | 1                | TYPE_LIMIT | TIF_GTC | tt_2_1    |
   125  
   126      # the maximum oi over the last 10s is still unchanged
   127      # target_stake = 90 x 60 x 1.5 x 0.1 = 810
   128      Then the market data for the market "ETH/DEC21" should be:
   129        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   130        | 90         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 810          | 2000           | 40            |
   131      And the liquidity fee factor should be "0.004" for the market "ETH/DEC21"
   132  
   133      # T0 + 10s
   134      Then the network moves ahead "10" blocks
   135      # now the peak of 60 should have passed from window
   136      # target_stake = 90 x 40 x 1.5 x 0.1 = 540
   137      And the target stake should be "540" for the market "ETH/DEC21"
   138  
   139      When the parties place the following orders with ticks:
   140        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   141        | tt_3  | ETH/DEC21 | sell | 10     | 90    | 1                | TYPE_LIMIT | TIF_GTC | tt_2_1    |
   142  
   143      # target stake should be: 90 x 40 x 1.5 x 0.1 = 540
   144      Then the market data for the market "ETH/DEC21" should be:
   145        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   146        | 90         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 540          | 2000           | 30            |
   147      And the liquidity fee factor should be "0.003" for the market "ETH/DEC21"
   148  
   149      # target stake should be: 90 x 40 x 1.5 x 0.1 = 540
   150      And the target stake should be "540" for the market "ETH/DEC21"
   151      And the liquidity fee factor should be "0.003" for the market "ETH/DEC21"
   152  
   153      Then the network moves ahead "1" blocks
   154      # target stake should be: 90 x 30 x 1.5 x 0.1 = 405
   155      And the target stake should be "405" for the market "ETH/DEC21"
   156      And the liquidity fee factor should be "0.003" for the market "ETH/DEC21"
   157  
   158      # Move time 4x the window, the target stake remain unchanged as we rely on last value even if it drops outside the window (that's still what OI is)
   159      Then the network moves ahead "40" blocks
   160      And the target stake should be "405" for the market "ETH/DEC21"
   161      And the liquidity fee factor should be "0.003" for the market "ETH/DEC21"
   162  
   163      When the parties place the following orders with ticks:
   164        | party | market id | side | volume | price | resulting trades | type       | tif     |
   165        | tt_1  | ETH/DEC21 | sell | 10     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   166      # target stake is: 90 x 20 x 1.5 x 0.1 = 270 as now the max OI within the window is 20
   167      Then the market data for the market "ETH/DEC21" should be:
   168        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   169        | 90         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 270          | 2000           | 20            |
   170      And the liquidity fee factor should be "0.002" for the market "ETH/DEC21"
   171  
   172      When the parties place the following orders with ticks:
   173        | party | market id | side | volume | price | resulting trades | type       | tif     |
   174        | tt_2  | ETH/DEC21 | sell | 20     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   175      # OI is now 0, but target stake remains unchanged as max OI of 20 is still within the window
   176      Then the market data for the market "ETH/DEC21" should be:
   177        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   178        | 90         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 270          | 2000           | 0             |
   179      And the liquidity fee factor should be "0.002" for the market "ETH/DEC21"
   180  
   181      # target stake remain unchanged as open interest of 20 and 0 where both recorded with the same timestamp
   182      Then the network moves ahead "10" blocks
   183      And the target stake should be "270" for the market "ETH/DEC21"
   184      And the liquidity fee factor should be "0.002" for the market "ETH/DEC21"
   185  
   186      When the parties place the following orders:
   187        | party | market id | side | volume | price | resulting trades | type        | tif     |
   188        | tt_2  | ETH/DEC21 | sell | 5      | 0     | 1                | TYPE_MARKET | TIF_FOK |
   189        | tt_2  | ETH/DEC21 | sell | 5      | 0     | 1                | TYPE_MARKET | TIF_FOK |
   190  
   191      Then the network moves ahead "1" blocks
   192      And the market data for the market "ETH/DEC21" should be:
   193        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   194        | 90         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 135          | 2000           | 10            |
   195      And the liquidity fee factor should be "0.001" for the market "ETH/DEC21"
   196  
   197      When the parties place the following orders with ticks:
   198        | party | market id | side | volume | price | resulting trades | type        | tif     |
   199        | tt_2  | ETH/DEC21 | buy  | 10     | 0     | 1                | TYPE_MARKET | TIF_FOK |
   200  
   201      Then the market data for the market "ETH/DEC21" should be:
   202        | mark price | last traded price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   203        | 110        | 110               | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 165          | 2000           | 0             |
   204      And the liquidity fee factor should be "0.002" for the market "ETH/DEC21"
   205  
   206      # O is now the last recorded open interest so target stake should drop to 0
   207      Then the network moves ahead "10" blocks
   208      And the market data for the market "ETH/DEC21" should be:
   209        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   210        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 0            | 2000           | 0             |
   211      And the liquidity fee factor should be "0.001" for the market "ETH/DEC21"
   212  
   213    Scenario: Max open interest changes over time, testing change of timewindow (0041-TSTK-001; 0041-TSTK-004; 0041-TSTK-005)
   214  
   215      Given the liquidity monitoring parameters:
   216        | name               | triggering ratio | time window | scaling factor |
   217        | updated-lqm-params | 0.0              | 20s         | 1.5            |
   218      When the markets are updated:
   219        | id        | liquidity monitoring | linear slippage factor | quadratic slippage factor |
   220        | ETH/DEC21 | updated-lqm-params   | 0.25                   | 0                         |
   221  
   222      # put some volume on the book so that others can increase their
   223      # positions and close out if needed too
   224      When the parties place the following orders:
   225        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   226        | lp_1  | ETH/DEC21 | buy  | 1000   | 90    | 0                | TYPE_LIMIT | TIF_GTC | lp_1_0    |
   227        | lp_1  | ETH/DEC21 | sell | 1000   | 110   | 0                | TYPE_LIMIT | TIF_GTC | lp_1_1    |
   228  
   229      And the parties submit the following liquidity provision:
   230        | id  | party | market id | commitment amount | fee   | lp type    |
   231        | lp1 | lp_1  | ETH/DEC21 | 2000              | 0.001 | submission |
   232        | lp1 | lp_1  | ETH/DEC21 | 2000              | 0.001 | submission |
   233      And the parties place the following pegged iceberg orders:
   234        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   235        | lp_1   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 20     |
   236        | lp_1   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | -20    |
   237      # nothing should have traded, we have mark price set apriori or
   238      # due to auction closing.
   239      Then the mark price should be "0" for the market "ETH/DEC21"
   240  
   241      # Traders 1, 2, 3 go long
   242      When the parties place the following orders:
   243        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   244        | tt_1  | ETH/DEC21 | buy  | 10     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_1_0    |
   245        | tt_2  | ETH/DEC21 | buy  | 20     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   246        | tt_3  | ETH/DEC21 | buy  | 30     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   247  
   248      Then the opening auction period ends for market "ETH/DEC21"
   249  
   250      # So now parties 1,2,3 are long 10+20+30 = 60 open interest.
   251      # Target stake is mark_price x max_oi x target_stake_scaling_factor x rf_short
   252      # rf_short should have been set above to 0.1
   253      # target_stake = 110 x 60 x 1.5 x 0.1
   254      And the market data for the market "ETH/DEC21" should be:
   255        | mark price | trading mode            | target stake | supplied stake | open interest |
   256        | 110        | TRADING_MODE_CONTINUOUS | 990          | 2000           | 60            |
   257  
   258      # T0 + 1s
   259      Then the network moves ahead "1" blocks
   260  
   261      # Trader 3 closes out 20
   262      When the parties place the following orders with ticks:
   263        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   264        | tt_3  | ETH/DEC21 | sell | 20     | 90    | 1                | TYPE_LIMIT | TIF_GTC | tt_2_1    |
   265  
   266      # the maximum oi over the last 20s is still unchanged
   267      # target_stake = 90 x 60 x 1.5 x 0.1 = 810
   268      Then the market data for the market "ETH/DEC21" should be:
   269        | mark price | last traded price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   270        | 90         | 90                | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 810          | 2000           | 40            |
   271  
   272      # T0 + 10s
   273      Then the network moves ahead "10" blocks
   274      # the max_io stays the same as previous timestep as the timeWindow is bigger in this scenario (20s days instead of 10s)
   275      # target_stake = 90 x 60 x 1.5 x 0.1 = 810
   276      And the target stake should be "810" for the market "ETH/DEC21"
   277  
   278      Then the network moves ahead "10" blocks
   279      # target_stake = 90 x 40 x 1.5 x 0.1 = 540
   280      And the target stake should be "540" for the market "ETH/DEC21"
   281  
   282      When the parties place the following orders with ticks:
   283        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   284        | tt_1  | ETH/DEC21 | buy  | 100    | 110   | 1                | TYPE_LIMIT | TIF_GTC | lp_1_0    |
   285      Then the mark price should be "110" for the market "ETH/DEC21"
   286  
   287      # max_io=10+20+30-20+100=140
   288      # target_stake = 110 x 140 x 1.5 x 0.1=2310
   289      And the target stake should be "2310" for the market "ETH/DEC21"
   290  
   291      Given the liquidity monitoring parameters:
   292        | name               | triggering ratio | time window | scaling factor |
   293        | updated-lqm-params | 0.0              | 10s         | 1              |
   294      When the markets are updated:
   295        | id        | liquidity monitoring | linear slippage factor | quadratic slippage factor |
   296        | ETH/DEC21 | updated-lqm-params   | 0.25                   | 0                         |
   297  
   298      # target_stake = 110 x 140 x 1 x 0.1 =1540
   299      And the target stake should be "1540" for the market "ETH/DEC21"
   300  
   301      When the parties place the following orders with ticks:
   302        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   303        | tt_1  | ETH/DEC21 | buy  | 30     | 110   | 1                | TYPE_LIMIT | TIF_GTC | tt_1_0    |
   304  
   305      # target_stake = 110 x (140+30) x 170 x 1 x 0.1=1870
   306      And the target stake should be "1870" for the market "ETH/DEC21"
   307  
   308    Scenario: Target stake is calculate correctly during auction in presence of wash trades
   309  
   310      Given the liquidity monitoring parameters:
   311        | name               | triggering ratio | time window | scaling factor |
   312        | updated-lqm-params | 0.0              | 10s         | 1              |
   313      When the markets are updated:
   314        | id        | liquidity monitoring | linear slippage factor | quadratic slippage factor |
   315        | ETH/DEC21 | updated-lqm-params   | 0.25                   | 0                         |
   316  
   317      When the parties place the following orders:
   318        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   319        | lp_1  | ETH/DEC21 | buy  | 1000   | 90    | 0                | TYPE_LIMIT | TIF_GTC | lp_1_0    |
   320        | lp_1  | ETH/DEC21 | sell | 1000   | 200   | 0                | TYPE_LIMIT | TIF_GTC | lp_1_1    |
   321  
   322      Then the mark price should be "0" for the market "ETH/DEC21"
   323  
   324      When the parties place the following orders:
   325        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   326        | tt_1  | ETH/DEC21 | sell | 50     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_1_0    |
   327        | tt_2  | ETH/DEC21 | buy  | 20     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   328        | tt_3  | ETH/DEC21 | buy  | 30     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   329  
   330      And the market data for the market "ETH/DEC21" should be:
   331        | trading mode                 | auction trigger         | target stake | supplied stake | open interest |
   332        | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 550          | 0              | 0             |
   333  
   334      Then the parties submit the following liquidity provision:
   335        | id  | party | market id | commitment amount | fee   | lp type    |
   336        | lp1 | lp_1  | ETH/DEC21 | 2000              | 0.001 | submission |
   337        | lp1 | lp_1  | ETH/DEC21 | 2000              | 0.001 | amendment  |
   338      And the parties place the following pegged iceberg orders:
   339        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   340        | lp_1   | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   341        | lp_1   | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   342      # Add wash trades
   343      When the parties place the following orders:
   344        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   345        | tt_4  | ETH/DEC21 | sell | 40     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_4_0    |
   346        | tt_4  | ETH/DEC21 | buy  | 40     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_4_1    |
   347  
   348      # Check that target stake is unchanged
   349      Then the market data for the market "ETH/DEC21" should be:
   350        | mark price | trading mode                 | auction trigger         | target stake | supplied stake | open interest |
   351        | 0          | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 550          | 2000           | 0             |
   352  
   353      Then the opening auction period ends for market "ETH/DEC21"
   354  
   355      Then the market data for the market "ETH/DEC21" should be:
   356        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   357        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 550          | 2000           | 50            |
   358  
   359    Scenario: Target stake can drop during auction
   360  
   361      Given the liquidity monitoring parameters:
   362        | name               | triggering ratio | time window | scaling factor |
   363        | updated-lqm-params | 1.0              | 10s         | 1              |
   364      When the markets are updated:
   365        | id        | liquidity monitoring | linear slippage factor | quadratic slippage factor |
   366        | ETH/DEC21 | updated-lqm-params   | 0.25                   | 0                         |
   367      And the parties place the following orders:
   368        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   369        | lp_1  | ETH/DEC21 | buy  | 1000   | 90    | 0                | TYPE_LIMIT | TIF_GTC | lp_1_0    |
   370        | lp_1  | ETH/DEC21 | sell | 1000   | 200   | 0                | TYPE_LIMIT | TIF_GTC | lp_1_1    |
   371      Then the mark price should be "0" for the market "ETH/DEC21"
   372  
   373      When the parties place the following orders:
   374        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   375        | tt_1  | ETH/DEC21 | sell | 50     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_1_0    |
   376        | tt_2  | ETH/DEC21 | buy  | 20     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   377        | tt_3  | ETH/DEC21 | buy  | 30     | 110   | 0                | TYPE_LIMIT | TIF_GTC | tt_2_0    |
   378      And the market data for the market "ETH/DEC21" should be:
   379        | trading mode                 | auction trigger         | target stake | supplied stake | open interest |
   380        | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 550          | 0              | 0             |
   381      And the parties submit the following liquidity provision:
   382        | id  | party | market id | commitment amount | fee   | lp type    |
   383        | lp1 | lp_1  | ETH/DEC21 | 1000              | 0.001 | submission |
   384        | lp1 | lp_1  | ETH/DEC21 | 1000              | 0.001 | amendment  |
   385      And the parties place the following pegged iceberg orders:
   386        | party | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   387        | lp_1  | ETH/DEC21 | 2         | 1                    | buy  | BID              | 1          | 10     |
   388        | lp_1  | ETH/DEC21 | 2         | 1                    | sell | ASK              | 1          | 10     |
   389      And the opening auction period ends for market "ETH/DEC21"
   390      Then the market data for the market "ETH/DEC21" should be:
   391        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   392        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 550          | 1000           | 50            |
   393  
   394      When the network moves ahead "5" blocks
   395      And the parties place the following orders:
   396        | party | market id | side | volume | price | resulting trades | type       | tif     |
   397        | tt_1  | ETH/DEC21 | sell | 50     | 110   | 0                | TYPE_LIMIT | TIF_GTC |
   398        | tt_2  | ETH/DEC21 | buy  | 50     | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   399      And the market data for the market "ETH/DEC21" should be:
   400        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   401        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 1100         | 1000           | 100           |
   402  
   403      When the network moves ahead "1" blocks
   404      Then the parties place the following orders:
   405        | party | market id | side | volume | price | resulting trades | type       | tif     |
   406        | tt_1  | ETH/DEC21 | buy  | 50     | 110   | 0                | TYPE_LIMIT | TIF_GTC |
   407        | tt_2  | ETH/DEC21 | sell | 50     | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   408  
   409      When the network moves ahead "1" blocks
   410      Then the market data for the market "ETH/DEC21" should be:
   411        | mark price | trading mode            | auction trigger             | target stake | supplied stake | open interest |
   412        | 110        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 1100         | 1000           | 50            |