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