code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0032-PRIM-price_monitoring_lognormal.feature (about)

     1  Feature: Price monitoring test using forward risk model (bounds for the valid price moves around price of 100000 for the two horizons are: [99460,100541], [98999,101008])
     2  
     3    Background:
     4      Given time is updated to "2020-10-16T00:00:00Z"
     5      And the price monitoring named "my-price-monitoring":
     6        | horizon | probability | auction extension |
     7        | 60      | 0.95        | 240               |
     8        | 600     | 0.99        | 360               |
     9      And the log normal risk model named "my-log-normal-risk-model":
    10        | risk aversion | tau                    | mu | r     | sigma |
    11        | 0.000001      | 0.00011407711613050422 | 0  | 0.016 | 2.0   |
    12      And the markets:
    13        | id        | quote name | asset | risk model                    | margin calculator         | auction duration | fees         | price monitoring    | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
    14        | ETH/DEC20 | ETH        | ETH   | default-log-normal-risk-model | default-margin-calculator | 60               | default-none | my-price-monitoring | default-eth-for-future | 0.01                   | 0                         | default-futures |
    15      And the following network parameters are set:
    16        | name                                    | value |
    17        | market.auction.minimumDuration          | 60    |
    18        | network.markPriceUpdateMaximumFrequency | 0s    |
    19        | limits.markets.maxPeggedOrders          | 2     |
    20  
    21    @SupStake
    22    Scenario: Persistent order results in an auction (both triggers breached), no orders placed during auction, auction terminates with a trade from order that originally triggered the auction. (0032-PRIM-020, 0032-PRIM-005)
    23      Given the parties deposit on asset's general account the following amount:
    24        | party  | asset | amount       |
    25        | party1 | ETH   | 10000000000  |
    26        | party2 | ETH   | 10000000000  |
    27        | aux    | ETH   | 100000000000 |
    28        | aux2   | ETH   | 100000000000 |
    29        | lpprov | ETH   | 100000000000 |
    30  
    31      When the parties submit the following liquidity provision:
    32        | id  | party  | market id | commitment amount | fee | lp type    |
    33        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
    34        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
    35      And the parties place the following pegged iceberg orders:
    36        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    37        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50         | 100    |
    38        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50         | 100    |
    39  
    40      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
    41      When the parties place the following orders:
    42        | party | market id | side | volume | price  | resulting trades | type       | tif     |
    43        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
    44        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
    45        | aux2  | ETH/DEC20 | buy  | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
    46        | aux   | ETH/DEC20 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
    47      Then the opening auction period ends for market "ETH/DEC20"
    48      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    49      And the mark price should be "100000" for the market "ETH/DEC20"
    50  
    51      And the market data for the market "ETH/DEC20" should be:
    52        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    53        | 100000 | TRADING_MODE_CONTINUOUS | 60 | 99461 | 100541 | 74340 | 90000000 | 1 |
    54        | 100000     | TRADING_MODE_CONTINUOUS | 600     | 97776     | 102267    | 74340        | 0              | 1             |
    55  
    56      And the accumulated infrastructure fees should be "0" for the asset "ETH"
    57      And the accumulated liquidity fees should be "0" for the market "ETH/DEC20"
    58  
    59      #T1 = T0 + 10 min
    60      When time is updated to "2020-10-16T00:10:00Z"
    61  
    62      Then the parties place the following orders:
    63        | party  | market id | side | volume | price  | resulting trades | type       | tif     |
    64        | party1 | ETH/DEC20 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
    65        | party2 | ETH/DEC20 | buy  | 1      | 100000 | 1                | TYPE_LIMIT | TIF_GTC |
    66  
    67      And the accumulated infrastructure fees should be "0" for the asset "ETH"
    68      And the accumulated liquidity fees should be "10000" for the market "ETH/DEC20"
    69  
    70      And the market data for the market "ETH/DEC20" should be:
    71        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    72        | 100000 | TRADING_MODE_CONTINUOUS | 60  | 99461 | 100541 | 148680 | 90000000 | 2 |
    73        | 100000 | TRADING_MODE_CONTINUOUS | 600 | 97776 | 102267 | 148680 | 1        | 2 |
    74  
    75      And the order book should have the following volumes for market "ETH/DEC20":
    76        | side | price  | volume |
    77        | sell | 200000 | 1      |
    78        | buy  | 1      | 1      |
    79  
    80      And the mark price should be "100000" for the market "ETH/DEC20"
    81      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
    82  
    83      And the accumulated infrastructure fees should be "0" for the asset "ETH"
    84      And the accumulated liquidity fees should be "10000" for the market "ETH/DEC20"
    85  
    86      When the parties place the following orders:
    87        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
    88        | party1 | ETH/DEC20 | sell | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    89        | party2 | ETH/DEC20 | buy  | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
    90  
    91      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
    92  
    93      And the mark price should be "100000" for the market "ETH/DEC20"
    94  
    95      #T1 + 04min00s (last second of first trigger)
    96      When time is updated to "2020-10-16T00:14:00Z"
    97      Then the market data for the market "ETH/DEC20" should be:
    98        | trading mode                    | auction trigger       | extension trigger           | auction end | horizon | min bound | max bound |
    99        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | AUCTION_TRIGGER_UNSPECIFIED | 240         | 600     | 97776     | 102267    |
   100  
   101      #T1 + 04min01s (auction extended)
   102      When time is updated to "2020-10-16T00:14:01Z"
   103      Then the market data for the market "ETH/DEC20" should be:
   104        | trading mode                    | auction trigger       | extension trigger     | auction end |
   105        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | AUCTION_TRIGGER_PRICE | 600         |
   106  
   107      #T1 + 10min01s
   108      Then time is updated to "2020-10-16T00:20:01Z"
   109  
   110      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   111  
   112      And the mark price should be "111000" for the market "ETH/DEC20"
   113  
   114    Scenario: Persistent order results in an auction (both triggers breached), orders placed during auction result in a trade with indicative price within the price monitoring bounds, hence auction concludes. (0032-PRIM-021)
   115  
   116      Given the parties deposit on asset's general account the following amount:
   117        | party  | asset | amount       |
   118        | party1 | ETH   | 10000000000  |
   119        | party2 | ETH   | 10000000000  |
   120        | aux    | ETH   | 100000000000 |
   121        | aux2   | ETH   | 100000000000 |
   122        | lpprov | ETH   | 100000000000 |
   123  
   124      When the parties submit the following liquidity provision:
   125        | id  | party  | market id | commitment amount | fee | lp type    |
   126        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   127        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   128      And the parties place the following pegged iceberg orders:
   129        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   130        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   131        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   132  
   133      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
   134      When the parties place the following orders:
   135        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   136        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
   137        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
   138        | aux2  | ETH/DEC20 | buy  | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
   139        | aux   | ETH/DEC20 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
   140      Then the opening auction period ends for market "ETH/DEC20"
   141      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   142      And the mark price should be "100000" for the market "ETH/DEC20"
   143  
   144      #T1 = T0 + 10 min
   145      When time is updated to "2020-10-16T00:10:00Z"
   146  
   147      Then the parties place the following orders:
   148        | party  | market id | side | volume | price  | resulting trades | type       | tif     |
   149        | party1 | ETH/DEC20 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |
   150        | party2 | ETH/DEC20 | buy  | 1      | 100000 | 1                | TYPE_LIMIT | TIF_GTC |
   151  
   152      And the mark price should be "100000" for the market "ETH/DEC20"
   153      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   154  
   155      When the parties place the following orders:
   156        | party  | market id | side | volume | price  | resulting trades | type       | tif     |
   157        | party1 | ETH/DEC20 | sell | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC |
   158        | party2 | ETH/DEC20 | buy  | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC |
   159  
   160      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   161  
   162      And the mark price should be "100000" for the market "ETH/DEC20"
   163  
   164      #T1 + 04min00s (last second of initial duration)
   165      When time is updated to "2020-10-16T00:14:00Z"
   166      Then the market data for the market "ETH/DEC20" should be:
   167        | trading mode                    | auction trigger       | extension trigger           | auction end | horizon | min bound | max bound |
   168        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | AUCTION_TRIGGER_UNSPECIFIED | 240         | 600     | 97776     | 102267    |
   169      And the mark price should be "100000" for the market "ETH/DEC20"
   170  
   171      #T1 + 04min01s (auction extended)
   172      When time is updated to "2020-10-16T00:14:01Z"
   173      Then the market data for the market "ETH/DEC20" should be:
   174        | trading mode                    | auction trigger       | extension trigger     | auction end |
   175        | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | AUCTION_TRIGGER_PRICE | 600         |
   176  
   177      When the parties place the following orders:
   178        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   179        | aux   | ETH/DEC20 | buy  | 10     | 112000 | 0                | TYPE_LIMIT | TIF_GTC |
   180        | aux2  | ETH/DEC20 | sell | 10     | 112000 | 0                | TYPE_LIMIT | TIF_GTC |
   181      #T0 + 11min01s (opening period, min auction duration + 1 second, auction is over)
   182      And time is updated to "2020-10-16T00:20:01Z"
   183  
   184      Then the market data for the market "ETH/DEC20" should be:
   185        | trading mode            | auction trigger             | extension trigger           | auction end |
   186        | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | AUCTION_TRIGGER_UNSPECIFIED | 0           |
   187  
   188    Scenario: Persistent order results in an auction (one trigger breached), no orders placed during auction, auction terminates with a trade from order that originally triggered the auction. (0032-PRIM-006)
   189  
   190      Given the parties deposit on asset's general account the following amount:
   191        | party  | asset | amount       |
   192        | party1 | ETH   | 10000000000  |
   193        | party2 | ETH   | 10000000000  |
   194        | aux    | ETH   | 100000000000 |
   195        | aux2   | ETH   | 100000000000 |
   196        | lpprov | ETH   | 100000000000 |
   197  
   198      When the parties submit the following liquidity provision:
   199        | id  | party  | market id | commitment amount | fee | lp type    |
   200        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   201        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   202      And the parties place the following pegged iceberg orders:
   203        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   204        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   205        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   206  
   207      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
   208      When the parties place the following orders:
   209        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   210        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
   211        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
   212        | aux2  | ETH/DEC20 | buy  | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   213        | aux   | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   214      Then the opening auction period ends for market "ETH/DEC20"
   215      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   216      And the mark price should be "110000" for the market "ETH/DEC20"
   217  
   218      #T0 + 10 min
   219      When time is updated to "2020-10-16T00:10:00Z"
   220  
   221      Then the parties place the following orders:
   222        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   223        | party1 | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
   224        | party2 | ETH/DEC20 | buy  | 1      | 110000 | 1                | TYPE_LIMIT | TIF_GTC | ref-2     |
   225  
   226      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   227  
   228      And the mark price should be "110000" for the market "ETH/DEC20"
   229  
   230  #T1 = T0 + 02min10s (auction start)
   231      Then time is updated to "2020-10-16T00:12:10Z"
   232  
   233      When the parties place the following orders:
   234        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   235        | party1 | ETH/DEC20 | sell | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
   236        | party2 | ETH/DEC20 | buy  | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
   237  
   238      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   239  
   240      And the mark price should be "110000" for the market "ETH/DEC20"
   241  
   242      #T1 + 04min00s (last second of the auction)
   243      Then time is updated to "2020-10-16T00:13:10Z"
   244  
   245      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   246  
   247      #T1 + 04min01s (auction ended)
   248      Then time is updated to "2020-10-16T00:20:11Z"
   249  
   250      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   251  
   252      And the mark price should be "111000" for the market "ETH/DEC20"
   253  
   254    Scenario: Non-persistent order do not result in an auction (one trigger breached) (0032-PRIM-003)
   255  
   256      Given the parties deposit on asset's general account the following amount:
   257        | party  | asset | amount       |
   258        | party1 | ETH   | 10000000000  |
   259        | party2 | ETH   | 10000000000  |
   260        | aux    | ETH   | 100000000000 |
   261        | aux2   | ETH   | 100000000000 |
   262        | lpprov | ETH   | 100000000000 |
   263  
   264      When the parties submit the following liquidity provision:
   265        | id  | party  | market id | commitment amount | fee | lp type    |
   266        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   267        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   268      And the parties place the following pegged iceberg orders:
   269        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   270        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   271        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   272  
   273      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
   274      When the parties place the following orders:
   275        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   276        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
   277        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
   278        | aux2  | ETH/DEC20 | buy  | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   279        | aux   | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   280      Then the opening auction period ends for market "ETH/DEC20"
   281      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   282      And the mark price should be "110000" for the market "ETH/DEC20"
   283  
   284      #T0 + 10 min
   285      When time is updated to "2020-10-16T00:10:00Z"
   286  
   287      Then the parties place the following orders:
   288        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   289        | party1 | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
   290        | party2 | ETH/DEC20 | buy  | 1      | 110000 | 1                | TYPE_LIMIT | TIF_GTC | ref-2     |
   291  
   292      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   293      And the mark price should be "110000" for the market "ETH/DEC20"
   294  
   295      #T1 = T0 + 10s
   296      When time is updated to "2020-10-16T00:10:10Z"
   297  
   298      Then the parties place the following orders:
   299        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference | error                                                       |
   300        | party1 | ETH/DEC20 | sell | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |                                                             |
   301        | party2 | ETH/DEC20 | buy  | 1      | 111000 | 0                | TYPE_LIMIT | TIF_FOK | ref-2     | OrderError: non-persistent order trades out of price bounds |
   302  
   303      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   304      And the mark price should be "110000" for the market "ETH/DEC20"
   305  
   306    Scenario: Non-persistent order results in an auction (one trigger breached), orders placed during auction result in trade with indicative price outside the price monitoring bounds, hence auction get extended, additional orders resulting in more trades placed, auction concludes. (0032-PRIM-008)
   307  
   308      Given the parties deposit on asset's general account the following amount:
   309        | party  | asset | amount       |
   310        | party1 | ETH   | 10000000000  |
   311        | party2 | ETH   | 10000000000  |
   312        | aux    | ETH   | 100000000000 |
   313        | aux2   | ETH   | 100000000000 |
   314        | lpprov | ETH   | 100000000000 |
   315  
   316      When the parties submit the following liquidity provision:
   317        | id  | party  | market id | commitment amount | fee | lp type    |
   318        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   319        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   320      And the parties place the following pegged iceberg orders:
   321        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   322        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   323        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   324  
   325      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
   326      When the parties place the following orders:
   327        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   328        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
   329        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
   330        | aux2  | ETH/DEC20 | buy  | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   331        | aux   | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC |
   332      Then the opening auction period ends for market "ETH/DEC20"
   333      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   334      And the mark price should be "110000" for the market "ETH/DEC20"
   335  
   336      #T0 + 2 min (end of auction)
   337      When time is updated to "2020-10-16T00:02:00Z"
   338  
   339      Then the parties place the following orders:
   340        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   341        | party1 | ETH/DEC20 | sell | 1      | 110000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
   342        | party2 | ETH/DEC20 | buy  | 1      | 110000 | 1                | TYPE_LIMIT | TIF_GTC | ref-2     |
   343  
   344      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   345  
   346      And the mark price should be "110000" for the market "ETH/DEC20"
   347  
   348      #T1 = T0 + 10s
   349      When time is updated to "2020-10-16T00:02:10Z"
   350  
   351      Then the parties place the following orders:
   352        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   353        | party1 | ETH/DEC20 | sell | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
   354        | party2 | ETH/DEC20 | buy  | 1      | 111000 | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
   355  
   356      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   357  
   358      And the mark price should be "110000" for the market "ETH/DEC20"
   359  
   360      #T1 + 04min00s (last second of the auction)
   361      When time is updated to "2020-10-16T00:03:10Z"
   362  
   363      Then the parties place the following orders:
   364        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference |
   365        | party1 | ETH/DEC20 | sell | 2      | 133000 | 0                | TYPE_LIMIT | TIF_GFA | ref-1     |
   366        | party2 | ETH/DEC20 | buy  | 2      | 133000 | 0                | TYPE_LIMIT | TIF_GFA | ref-2     |
   367  
   368      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   369  
   370      #T1 + 04min01s (auction extended due to 2nd trigger)
   371      When time is updated to "2020-10-16T00:06:11Z"
   372  
   373      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   374  
   375      And the mark price should be "110000" for the market "ETH/DEC20"
   376  
   377      #T1 + 10min00s (last second of the extended auction)
   378      When time is updated to "2020-10-16T00:08:11Z"
   379      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   380  
   381      Then the parties place the following orders:
   382        | party  | market id | side | volume | price  | resulting trades | type       | tif     | reference  |
   383        | party1 | ETH/DEC20 | sell | 10     | 303000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1      |
   384        | party2 | ETH/DEC20 | buy  | 10     | 303000 | 0                | TYPE_LIMIT | TIF_GFA | ref-2-last |
   385  
   386      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC20"
   387  
   388      And the mark price should be "110000" for the market "ETH/DEC20"
   389  
   390      #T1 + 10min01s (extended auction finished) // this is not finished, not order left in the book.
   391      Then time is updated to "2020-10-16T00:12:11Z"
   392  
   393      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20"
   394  
   395      And the mark price should be "303000" for the market "ETH/DEC20"
   396  
   397    Scenario: Start with high first indicative uncrossing price and much lower final auction price
   398      Given the parties deposit on asset's general account the following amount:
   399        | party  | asset | amount       |
   400        | party1 | ETH   | 10000000000  |
   401        | party2 | ETH   | 10000000000  |
   402        | aux    | ETH   | 100000000000 |
   403        | aux2   | ETH   | 100000000000 |
   404        | lpprov | ETH   | 100000000000 |
   405  
   406      When the parties submit the following liquidity provision:
   407        | id  | party  | market id | commitment amount | fee | lp type    |
   408        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   409        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   410      And the parties place the following pegged iceberg orders:
   411        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   412        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   413        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   414  
   415      When the parties place the following orders:
   416        | party | market id | side | volume | price   | resulting trades | type       | tif     |
   417        | aux   | ETH/DEC20 | buy  | 1      | 1       | 0                | TYPE_LIMIT | TIF_GTC |
   418        | aux   | ETH/DEC20 | sell | 1      | 200000  | 0                | TYPE_LIMIT | TIF_GTC |
   419        | aux2  | ETH/DEC20 | buy  | 1      | 1000000 | 0                | TYPE_LIMIT | TIF_GTC |
   420        | aux   | ETH/DEC20 | sell | 1      | 1000000 | 0                | TYPE_LIMIT | TIF_GTC |
   421  
   422      Then the network moves ahead "59" blocks
   423      And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20"
   424  
   425      When the parties place the following orders:
   426        | party | market id | side | volume | price | resulting trades | type       | tif     |
   427        | aux2  | ETH/DEC20 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   428        | aux   | ETH/DEC20 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   429  
   430      Then the opening auction period ends for market "ETH/DEC20"
   431  
   432      And the market data for the market "ETH/DEC20" should be:
   433        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   434        | 1000       | TRADING_MODE_CONTINUOUS | 60      | 995       | 1005      | 7434         | 90000000       | 10            |
   435        | 1000       | TRADING_MODE_CONTINUOUS | 600     | 978       | 1022      | 7434         | 90000000       | 10            |
   436  
   437    Scenario: Start with low first indicative uncrossing price and much higher final auction price
   438      Given the parties deposit on asset's general account the following amount:
   439        | party  | asset | amount       |
   440        | party1 | ETH   | 10000000000  |
   441        | party2 | ETH   | 10000000000  |
   442        | aux    | ETH   | 100000000000 |
   443        | aux2   | ETH   | 100000000000 |
   444        | lpprov | ETH   | 100000000000 |
   445  
   446      When the parties submit the following liquidity provision:
   447        | id  | party  | market id | commitment amount | fee | lp type    |
   448        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   449        | lp1 | lpprov | ETH/DEC20 | 90000000          | 0.1 | submission |
   450      And the parties place the following pegged iceberg orders:
   451        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   452        | lpprov | ETH/DEC20 | 2         | 1                    | buy  | BID              | 50     | 100    |
   453        | lpprov | ETH/DEC20 | 2         | 1                    | sell | ASK              | 50     | 100    |
   454   
   455      When the parties place the following orders:
   456        | party | market id | side | volume | price  | resulting trades | type       | tif     |
   457        | aux   | ETH/DEC20 | buy  | 1      | 1      | 0                | TYPE_LIMIT | TIF_GTC |
   458        | aux   | ETH/DEC20 | sell | 1      | 200000 | 0                | TYPE_LIMIT | TIF_GTC |
   459        | aux2  | ETH/DEC20 | buy  | 1      | 1000   | 0                | TYPE_LIMIT | TIF_GTC |
   460        | aux   | ETH/DEC20 | sell | 1      | 1000   | 0                | TYPE_LIMIT | TIF_GTC |
   461  
   462      Then the network moves ahead "59" blocks
   463      And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20"
   464  
   465      When the parties place the following orders:
   466        | party | market id | side | volume | price   | resulting trades | type       | tif     |
   467        | aux2  | ETH/DEC20 | buy  | 10     | 1000000 | 0                | TYPE_LIMIT | TIF_GTC |
   468        | aux   | ETH/DEC20 | sell | 10     | 1000000 | 0                | TYPE_LIMIT | TIF_GTC |
   469  
   470      Then the opening auction period ends for market "ETH/DEC20"
   471  
   472      And the market data for the market "ETH/DEC20" should be:
   473        | mark price | trading mode            | horizon | ref price | min bound | max bound | target stake | supplied stake | open interest |
   474        | 1000000    | TRADING_MODE_CONTINUOUS | 60      | 1000000   | 994606    | 1005415   | 7434000      | 90000000       | 10            |
   475        | 1000000    | TRADING_MODE_CONTINUOUS | 600     | 1000000   | 977751    | 1022678   | 7434000      | 90000000       | 10            |