code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0042-LIQF-SLA_spot.feature (about)

     1  Feature: Calculating SLA Performance
     2  
     3    Background:
     4      Given the fees configuration named "fees-config-1":
     5        | maker fee | infrastructure fee |
     6        | 0.005     | 0.002              |
     7      And the simple risk model named "my-simple-risk-model":
     8        | long                   | short                  | max move up | min move down | probability of trading |
     9        | 0.08628781058136630000 | 0.09370922348428490000 | -1          | -1            | 0.2                    |
    10      And the fees configuration named "my-fees-config":
    11        | maker fee | infrastructure fee |
    12        | 0.004     | 0.001              |
    13      And the spot markets:
    14        | id      | name    | base asset | quote asset | risk model                    | auction duration | fees         | price monitoring | sla params    |
    15        | BTC/ETH | BTC/ETH | BTC        | ETH         | default-log-normal-risk-model | 1                | default-none | default-none     | default-basic |
    16      And the following network parameters are set:
    17        | name                                             | value |
    18        | limits.markets.maxPeggedOrders                   | 2     |
    19        | network.markPriceUpdateMaximumFrequency          | 0s    |
    20        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    21        | validators.epoch.length                          | 58s   |
    22        | market.liquidity.stakeToCcyVolume                | 1     |
    23  
    24      And the average block duration is "1"
    25  
    26      Given the parties deposit on asset's general account the following amount:
    27        | party  | asset | amount              |
    28        | lp1    | BTC   | 1000000000000000000 |
    29        | lp2    | BTC   | 1000000000000000000 |
    30        | lp3    | BTC   | 1000000000000000000 |
    31        | lp4    | BTC   | 1000000000000000000 |
    32        | aux1   | BTC   | 1000000000000000000 |
    33        | aux2   | BTC   | 1000000000000000000 |
    34        | party1 | BTC   | 1000000000000000000 |
    35        | party2 | BTC   | 1000000000000000000 |
    36        | lp1    | ETH   | 1000000000000000000 |
    37        | lp2    | ETH   | 1000000000000000000 |
    38        | lp3    | ETH   | 1000000000000000000 |
    39        | lp4    | ETH   | 1000000000000000000 |
    40        | aux1   | ETH   | 1000000000000000000 |
    41        | aux2   | ETH   | 1000000000000000000 |
    42        | party1 | ETH   | 1000000000000000000 |
    43        | party2 | ETH   | 1000000000000000000 |
    44  
    45    Scenario: LP fulfills the mininum time fraction but is not always on the book when the sla competition factor is non-zero. (0042-LIQF-085)(0042-LIQF-101)
    46      # Initialise the market with the required parameters
    47      Given the liquidity sla params named "scenario-sla-params":
    48        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    49        | 1           | 0.5                          | 0                             | 0.5                    |
    50      And the spot markets are updated:
    51        | id      | sla params          | linear slippage factor | quadratic slippage factor |
    52        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
    53  
    54      # Setup the market with 1 LP who is initially meeting their commitment
    55      Given the parties submit the following liquidity provision:
    56        | id  | party | market id | commitment amount | fee | lp type    |
    57        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
    58      And the parties place the following pegged iceberg orders:
    59        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
    60        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
    61        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
    62      When the parties place the following orders:
    63        | party | market id | side | volume | price | resulting trades | type       | tif     |
    64        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    65        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    66        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    67        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
    68      And the opening auction period ends for market "BTC/ETH"
    69      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    70  
    71      # Generate liquidity fees to be allocated to the LP
    72      Given the parties place the following orders:
    73        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    74        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    75        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    76      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
    77  
    78      # Ensure LPs timeBookFraction ~=0.75, then check ~0.25 fees are penalised (then returned as a bonus as they are the only LP)
    79      Given the network moves ahead "45" blocks
    80      And the parties cancel the following orders:
    81        | party | reference      |
    82        | lp1   | lp1-ice-buy-1  |
    83        | lp1   | lp1-ice-sell-1 |
    84      When the network moves ahead "1" epochs
    85      Then the following transfers should happen:
    86        | from | to  | from account                                   | to account                                     | market id | amount | asset |
    87        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
    88        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 75     | ETH   |
    89        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 25     | ETH   |
    90        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 25     | ETH   |
    91  
    92    Scenario: LP fulfills the mininum time fraction and provides liquidity throughout the epoch when performance hysteresis epochs is 1. (0042-LIQF-086)(0042-LIQF-101)
    93      # Initialise the market with the required parameters
    94      Given the liquidity sla params named "scenario-sla-params":
    95        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    96        | 1           | 1                            | 1                             | 1                      |
    97      And the spot markets are updated:
    98        | id      | sla params          | linear slippage factor | quadratic slippage factor |
    99        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   100  
   101      # Setup the market with 1 LP who is initially meeting their commitment
   102      Given the parties submit the following liquidity provision:
   103        | id  | party | market id | commitment amount | fee | lp type    |
   104        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   105      And the parties place the following pegged iceberg orders:
   106        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   107        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   108        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   109      When the parties place the following orders:
   110        | party | market id | side | volume | price | resulting trades | type       | tif     |
   111        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   112        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   113        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   114        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   115      And the opening auction period ends for market "BTC/ETH"
   116      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   117  
   118      # Generate liquidity fees to be allocated to the LP
   119      Given the parties place the following orders:
   120        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   121        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   122        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   123      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   124  
   125      # Ensure LPs timeBookFraction ~=1.00, then check ~0.0 fees are penalised
   126      When the network moves ahead "1" epochs
   127      Then the following transfers should happen:
   128        | from | to  | from account                   | to account           | market id | amount | asset |
   129        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL | BTC/ETH   | 100    | ETH   |
   130  
   131    Scenario: LPs previous failures to meet the minimum time fraction if the markets performance hysteresis epochs is increased. (0042-LIQF-101)(0042-LIQF-088)
   132      # Initialise the market with the required parameters
   133      Given the liquidity sla params named "scenario-sla-params":
   134        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   135        | 1           | 1.0                          | 0                             | 1                      |
   136      And the spot markets are updated:
   137        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   138        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   139  
   140      # Setup the market with 1 LP who is initially meeting their commitment
   141      Given the parties submit the following liquidity provision:
   142        | id  | party | market id | commitment amount | fee | lp type    |
   143        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   144      And the parties place the following pegged iceberg orders:
   145        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   146        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   147        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   148      When the parties place the following orders:
   149        | party | market id | side | volume | price | resulting trades | type       | tif     |
   150        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   151        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   152        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   153        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   154  
   155      # Ensure LPs average timeBookFraction ~0.75 over the last 2 epochs, and will be ~1.0 in the next epoch
   156      Given the network moves ahead "45" blocks
   157      And the parties cancel the following orders:
   158        | party | reference      |
   159        | lp1   | lp1-ice-buy-1  |
   160        | lp1   | lp1-ice-sell-1 |
   161      And the network moves ahead "1" epochs
   162      And the parties place the following pegged iceberg orders:
   163        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   164        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-2  |
   165        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-2 |
   166      And the network moves ahead "45" blocks
   167      And the parties cancel the following orders:
   168        | party | reference      |
   169        | lp1   | lp1-ice-buy-2  |
   170        | lp1   | lp1-ice-sell-2 |
   171  
   172      # Update the market by increasing 'performance hysteresis epochs'. This will take effect for next epoch and
   173      # no penalty should be applied.
   174      Given the liquidity sla params named "updated-sla-params":
   175        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   176        | 1           | 0.5                          | 2                             | 1                      |
   177      And the spot markets are updated:
   178        | id      | sla params         | linear slippage factor | quadratic slippage factor |
   179        | BTC/ETH | updated-sla-params | 1e-3                   | 0                         |
   180  
   181      And the network moves ahead "1" epochs
   182      And the parties place the following pegged iceberg orders:
   183        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   184        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-3  |
   185        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-3 |
   186  
   187      # Generate liquidity fees to be allocated to the LP
   188      Given the parties place the following orders:
   189        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   190        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   191        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   192      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   193  
   194      When the network moves ahead "1" epochs
   195      Then the following transfers should happen:
   196        | from | to  | from account                   | to account                     | market id | amount | asset |
   197        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 100    | ETH   |
   198        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 100    | ETH   |
   199  
   200    Scenario: LP does not fulfill the mininum time fraction when performance hysteresis epochs is 1. (0042-LIQF-101)(0042-LIQF-087)
   201      # Initialise the market with the required parameters
   202      Given the liquidity sla params named "scenario-sla-params":
   203        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   204        | 1           | 1                            | 1                             | 1                      |
   205      And the spot markets are updated:
   206        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   207        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   208  
   209      # Setup the market with 1 LP who is initially meeting their commitment
   210      Given the parties submit the following liquidity provision:
   211        | id  | party | market id | commitment amount | fee | lp type    |
   212        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   213      And the parties place the following pegged iceberg orders:
   214        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   215        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   216        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   217      When the parties place the following orders:
   218        | party | market id | side | volume | price | resulting trades | type       | tif     |
   219        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   220        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   221        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   222        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   223      And the opening auction period ends for market "BTC/ETH"
   224      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   225  
   226      # Generate liquidity fees to be allocated to the LP
   227      Given the parties place the following orders:
   228        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   229        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   230        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   231      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   232  
   233      # Ensure LPs timeBookFraction <1.00, then check ~1.0 fees are penalised
   234      Given the network moves ahead "1" blocks
   235      And the parties cancel the following orders:
   236        | party | reference      |
   237        | lp1   | lp1-ice-buy-1  |
   238        | lp1   | lp1-ice-sell-1 |
   239      When the network moves ahead "1" epochs
   240      Then the following transfers should happen:
   241        | from | to  | from account                | to account                     | market id | amount | asset |
   242        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 100    | ETH   |
   243  
   244    Scenario: LPs average penalty over the last N epochs is worse then their current performance when performance hysteresis epochs is > 1. (0042-LIQF-101)(0042-LIQF-089)
   245  
   246      # Initialise the market with the required parameters
   247      Given the liquidity sla params named "scenario-sla-params":
   248        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   249        | 1           | 0.0                          | 3                             | 1                      |
   250      And the spot markets are updated:
   251        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   252        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   253  
   254      # Setup the market with 1 LP who is initially meeting their commitment
   255      Given the parties submit the following liquidity provision:
   256        | id  | party | market id | commitment amount | fee | lp type    |
   257        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   258      And the parties place the following pegged iceberg orders:
   259        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   260        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   261        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   262      When the parties place the following orders:
   263        | party | market id | side | volume | price | resulting trades | type       | tif     |
   264        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   265        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   266        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   267        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   268      And the opening auction period ends for market "BTC/ETH"
   269      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   270  
   271      # Ensure LPs average timeBookFraction ~0.75 over the last 2 epochs, and will be ~1.0 in the next epoch
   272      Given the network moves ahead "45" blocks
   273      And the parties cancel the following orders:
   274        | party | reference      |
   275        | lp1   | lp1-ice-buy-1  |
   276        | lp1   | lp1-ice-sell-1 |
   277      And the network moves ahead "1" epochs
   278      And the parties place the following pegged iceberg orders:
   279        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   280        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-2  |
   281        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-2 |
   282      And the network moves ahead "45" blocks
   283      And the parties cancel the following orders:
   284        | party | reference      |
   285        | lp1   | lp1-ice-buy-2  |
   286        | lp1   | lp1-ice-sell-2 |
   287      And the network moves ahead "1" epochs
   288      And the parties place the following pegged iceberg orders:
   289        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   290        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-3  |
   291        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-3 |
   292  
   293      # Generate liquidity fees to be allocated to the LP
   294      Given the parties place the following orders:
   295        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   296        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   297        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   298      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   299  
   300      When the network moves ahead "1" epochs
   301      Then the following transfers should happen:
   302        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   303        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   304        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 75     | ETH   |
   305        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 25     | ETH   |
   306        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 25     | ETH   |
   307  
   308    Scenario: LPs average penalty over the last N epochs is worse then their current performance when performance hysteresis epochs is > 1. (0042-LIQF-090)(0042-LIQF-101)(0042-LIQF-104)(0042-LIQF-091)
   309      # Initialise the market with the required parameters
   310      Given the liquidity sla params named "scenario-sla-params":
   311        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   312        | 1           | 0.0                          | 3                             | 1                      |
   313      And the spot markets are updated:
   314        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   315        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   316  
   317      # Setup the market with 1 LP who is initially meeting their commitment
   318      Given the parties submit the following liquidity provision:
   319        | id  | party | market id | commitment amount | fee | lp type    |
   320        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   321      And the parties place the following pegged iceberg orders:
   322        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   323        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   324        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   325      When the parties place the following orders:
   326        | party | market id | side | volume | price | resulting trades | type       | tif     |
   327        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   328        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   329        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   330        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   331      And the opening auction period ends for market "BTC/ETH"
   332      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   333  
   334      # Ensure LPs average timeBookFraction ~0.50 over the last 2 epochs, and will be ~1.0 in the next epoch
   335      Given the network moves ahead "30" blocks
   336      And the parties cancel the following orders:
   337        | party | reference      |
   338        | lp1   | lp1-ice-buy-1  |
   339        | lp1   | lp1-ice-sell-1 |
   340      And the network moves ahead "1" epochs
   341      And the parties place the following pegged iceberg orders:
   342        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   343        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-2  |
   344        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-2 |
   345      And the network moves ahead "30" blocks
   346      And the parties cancel the following orders:
   347        | party | reference      |
   348        | lp1   | lp1-ice-buy-2  |
   349        | lp1   | lp1-ice-sell-2 |
   350      And the network moves ahead "1" epochs
   351      And the parties place the following pegged iceberg orders:
   352        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   353        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-3  |
   354        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-3 |
   355  
   356      # Generate liquidity fees to be allocated to the LP
   357      Given the parties place the following orders:
   358        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   359        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   360        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   361      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   362  
   363      When the network moves ahead "1" epochs
   364      Then the following transfers should happen:
   365        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   366        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   367        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   368        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 50     | ETH   |
   369        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   370  
   371    Scenario: 2 LPs fulfill the mininum time fraction but have different SLA performance when the sla competition factor is non-zero.(0042-LIQF-101)(0042-LIQF-102)
   372      # Initialise the market with the required parameters
   373      Given the liquidity sla params named "scenario-sla-params":
   374        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   375        | 1           | 0.5                          | 3                             | 1                      |
   376      And the following network parameters are set:
   377        | name                    | value |
   378        | validators.epoch.length | 1m58s |
   379      And the spot markets are updated:
   380        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   381        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   382  
   383      # Setup the market with 2 LPs who are initially meeting their commitment
   384      Given the parties submit the following liquidity provision:
   385        | id  | party | market id | commitment amount | fee | lp type    |
   386        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   387        | lp2 | lp2   | BTC/ETH   | 10000             | 0.1 | submission |
   388      And the parties place the following pegged iceberg orders:
   389        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   390        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   391        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   392        | lp2   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp2-ice-buy-1  |
   393        | lp2   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp2-ice-sell-1 |
   394      When the parties place the following orders:
   395        | party | market id | side | volume | price | resulting trades | type       | tif     |
   396        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   397        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   398        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   399        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   400      And the opening auction period ends for market "BTC/ETH"
   401      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   402  
   403      # Generate liquidity fees to be allocated to the LP
   404      Given the parties place the following orders:
   405        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   406        | party1 | BTC/ETH   | buy  | 2      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   407        | party2 | BTC/ETH   | sell | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   408      Then the accumulated liquidity fees should be "200" for the market "BTC/ETH"
   409  
   410      # Ensure LP1s average timeBookFraction ~0.75 and penalties will be ~0.5 in the next epoch
   411      Given the network moves ahead "90" blocks
   412      And the parties cancel the following orders:
   413        | party | reference      |
   414        | lp1   | lp1-ice-buy-1  |
   415        | lp1   | lp1-ice-sell-1 |
   416      # Ensure LP2s average timeBookFraction ~0.875 and penalties will be ~0.75 in the next epoch
   417      Given the network moves ahead "15" blocks
   418      And the parties cancel the following orders:
   419        | party | reference      |
   420        | lp2   | lp2-ice-buy-1  |
   421        | lp2   | lp2-ice-sell-1 |
   422      And the network moves ahead "1" epochs
   423      Then the following transfers should happen:
   424        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   425        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   426        |      | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   427        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   428        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 50     | ETH   |
   429        | lp2  | lp2 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 75     | ETH   |
   430        | lp2  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 25     | ETH   |
   431        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 30     | ETH   |
   432        |      | lp2 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 45     | ETH   |
   433  
   434    Scenario: 2 LPs fulfill the mininum time fraction but have different SLA performance when the sla competition factor is non-zero. (0042-LIQF-101)(0042-LIQF-103)
   435  
   436      # Initialise the market with the required parameters
   437      Given the liquidity sla params named "scenario-sla-params":
   438        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   439        | 1           | 0.5                          | 3                             | 1                      |
   440      And the spot markets are updated:
   441        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   442        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   443  
   444      And the following network parameters are set:
   445        | name                    | value |
   446        | validators.epoch.length | 1m58s |
   447  
   448      # Setup the market with 1 LP who is initially meeting their commitment and 1 LP who isn't
   449      Given the parties submit the following liquidity provision:
   450        | id  | party | market id | commitment amount | fee | lp type    |
   451        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   452        | lp2 | lp2   | BTC/ETH   | 10000             | 0.1 | submission |
   453      And the parties place the following pegged iceberg orders:
   454        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   455        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   456        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   457        | lp2   | BTC/ETH   | 9         | 9                    | buy  | BID              | 1      | 1      | lp1-ice-buy-1  |
   458        | lp2   | BTC/ETH   | 9         | 9                    | sell | ASK              | 1      | 1      | lp1-ice-sell-1 |
   459      When the parties place the following orders:
   460        | party | market id | side | volume | price | resulting trades | type       | tif     |
   461        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   462        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   463        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   464        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   465      And the opening auction period ends for market "BTC/ETH"
   466      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   467  
   468      # Generate liquidity fees to be allocated to the LP
   469      Given the parties place the following orders:
   470        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   471        | party1 | BTC/ETH   | buy  | 2      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   472        | party2 | BTC/ETH   | sell | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   473      Then the accumulated liquidity fees should be "200" for the market "BTC/ETH"
   474  
   475      # Ensure LP1s average timeBookFraction ~0.75 and penalties will be ~0.5 in the next epoch
   476      Given the network moves ahead "90" blocks
   477      And the parties cancel the following orders:
   478        | party | reference      |
   479        | lp1   | lp1-ice-buy-1  |
   480        | lp1   | lp1-ice-sell-1 |
   481      And the network moves ahead "1" epochs
   482      Then the following transfers should happen:
   483        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   484        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   485        |      | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   486        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   487        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 50     | ETH   |
   488        | lp2  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 100    | ETH   |
   489        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 150    | ETH   |
   490  
   491  
   492    Scenario: 4 LPs acheive various penalty fractions, unpaid liquidity fees distributed correctly as a bonus (0042-LIQF-105)
   493      # Initialise the market with the required parameters
   494      Given the liquidity sla params named "scenario-sla-params":
   495        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   496        | 1           | 0                            | 1                             | 1                      |
   497      And the spot markets are updated:
   498        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   499        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   500  
   501      And the following network parameters are set:
   502        | name                    | value |
   503        | validators.epoch.length | 98s   |
   504        | market.liquidity.equityLikeShareFeeFraction | 1   |
   505  
   506  
   507      # Setup the market with 4 LPs who initially meet their commitment
   508      Given the parties submit the following liquidity provision:
   509        | id  | party | market id | commitment amount | fee | lp type    |
   510        | lp1 | lp1   | BTC/ETH   | 10000000          | 0.1 | submission |
   511        | lp2 | lp2   | BTC/ETH   | 1000000           | 0.1 | submission |
   512        | lp3 | lp3   | BTC/ETH   | 70000000          | 0.1 | submission |
   513        | lp4 | lp4   | BTC/ETH   | 919000000         | 0.1 | submission |
   514      When the parties place the following orders:
   515        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
   516        | lp1   | BTC/ETH   | buy  | 10000  | 999   | 0                | TYPE_LIMIT | TIF_GTC | lp1-bid   |
   517        | lp1   | BTC/ETH   | sell | 10000  | 1001  | 0                | TYPE_LIMIT | TIF_GTC | lp1-ask   |
   518        | lp2   | BTC/ETH   | buy  | 1000   | 999   | 0                | TYPE_LIMIT | TIF_GTC | lp2-bid   |
   519        | lp2   | BTC/ETH   | sell | 1000   | 1001  | 0                | TYPE_LIMIT | TIF_GTC | lp2-ask   |
   520        | lp3   | BTC/ETH   | buy  | 70000  | 999   | 0                | TYPE_LIMIT | TIF_GTC | lp3-bid   |
   521        | lp3   | BTC/ETH   | sell | 70000  | 1001  | 0                | TYPE_LIMIT | TIF_GTC | lp3-ask   |
   522        | lp4   | BTC/ETH   | buy  | 919000 | 999   | 0                | TYPE_LIMIT | TIF_GTC | lp4-bid   |
   523        | lp4   | BTC/ETH   | sell | 919000 | 1001  | 0                | TYPE_LIMIT | TIF_GTC | lp4-ask   |
   524      When the parties place the following orders:
   525        | party | market id | side | volume | price | resulting trades | type       | tif     |
   526        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   527        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   528        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   529        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   530      And the opening auction period ends for market "BTC/ETH"
   531      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   532  
   533      # Generate liquidity fees to be allocated to the LP
   534      Given the network moves ahead "1" epochs
   535      When the parties place the following orders:
   536        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   537        | party1 | BTC/ETH   | buy  | 1000   | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   538        | party2 | BTC/ETH   | sell | 1000   | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   539      Then the accumulated liquidity fees should be "100000" for the market "BTC/ETH"
   540  
   541      # Ensure LPs have the correct penalty fractions whilst having approx. equal average liquidity scores
   542      Given the parties amend the following orders:
   543        | party | reference | price | size delta | tif     |
   544        | lp4   | lp4-bid   | 999   | -1         | TIF_GTC |
   545        | lp4   | lp4-ask   | 1001  | -1         | TIF_GTC |
   546      And the network moves ahead "40" blocks
   547      And the parties amend the following orders:
   548        | party | reference | price | size delta | tif     |
   549        | lp3   | lp3-bid   | 999   | -1         | TIF_GTC |
   550        | lp3   | lp3-ask   | 1001  | -1         | TIF_GTC |
   551      And the network moves ahead "55" blocks
   552      And the parties amend the following orders:
   553        | party | reference | price | size delta | tif     |
   554        | lp2   | lp2-bid   | 999   | -1         | TIF_GTC |
   555        | lp2   | lp2-ask   | 1001  | -1         | TIF_GTC |
   556      When the network moves ahead "1" epochs
   557      Then the following transfers should happen:
   558        | from | to  | from account                                   | to account                     | market id | amount | asset |
   559        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 1000   | ETH   |
   560        |      | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 100    | ETH   |
   561        |      | lp3 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 7000   | ETH   |
   562        |      | lp4 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | BTC/ETH   | 91900  | ETH   |
   563        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 1000   | ETH   |
   564        | lp2  | lp2 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 95     | ETH   |
   565        | lp3  | lp3 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 2800   | ETH   |
   566        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 24673  | ETH   |
   567        |      | lp2 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 2344   | ETH   |
   568        |      | lp3 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL           | BTC/ETH   | 69087  | ETH   |
   569  
   570    Scenario: LP fulfills the mininum time fraction but only provides liquidity scattered throughout the epoch (0042-LIQF-083)
   571  
   572      # Initialise the market with the required parameters
   573      Given the liquidity sla params named "scenario-sla-params":
   574        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   575        | 1           | 0.5                          | 0                             | 1.0                    |
   576      And the spot markets are updated:
   577        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   578        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   579  
   580      # Setup the market with 1 LP who is initially meeting their commitment
   581      Given the parties submit the following liquidity provision:
   582        | id  | party | market id | commitment amount | fee | lp type    |
   583        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   584      And the parties place the following pegged iceberg orders:
   585        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   586        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   587        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   588      When the parties place the following orders:
   589        | party | market id | side | volume | price | resulting trades | type       | tif     |
   590        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   591        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   592        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   593        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   594      And the opening auction period ends for market "BTC/ETH"
   595      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   596  
   597      # Generate liquidity fees to be allocated to the LP
   598      Given the parties place the following orders:
   599        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   600        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   601        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   602      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   603  
   604      # Ensure LPs timeBookFraction ~=0.75, then check ~0.5 fees are penalised (then returned as a bonus as they are the only LP)
   605      Given the network moves ahead "10" blocks
   606      And the parties cancel the following orders:
   607        | party | reference      |
   608        | lp1   | lp1-ice-buy-1  |
   609        | lp1   | lp1-ice-sell-1 |
   610      And the network moves ahead "5" blocks
   611      And the parties place the following pegged iceberg orders:
   612        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   613        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-2  |
   614        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-2 |
   615      And the network moves ahead "10" blocks
   616      And the parties cancel the following orders:
   617        | party | reference      |
   618        | lp1   | lp1-ice-buy-2  |
   619        | lp1   | lp1-ice-sell-2 |
   620      And the network moves ahead "5" blocks
   621      And the parties place the following pegged iceberg orders:
   622        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   623        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-3  |
   624        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-3 |
   625      And the network moves ahead "10" blocks
   626      And the parties cancel the following orders:
   627        | party | reference      |
   628        | lp1   | lp1-ice-buy-3  |
   629        | lp1   | lp1-ice-sell-3 |
   630      And the network moves ahead "5" blocks
   631      And the parties place the following pegged iceberg orders:
   632        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   633        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-4  |
   634        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-4 |
   635      When the network moves ahead "1" epochs
   636      Then the following transfers should happen:
   637        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   638        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   639        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   640        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 50     | ETH   |
   641        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   642  
   643    Scenario: LP fulfills the mininum time fraction but only provides liquidity at the start of the epoch (0042-LIQF-082)
   644  
   645      # Initialise the market with the required parameters
   646      Given the liquidity sla params named "scenario-sla-params":
   647        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   648        | 1           | 0.5                          | 0                             | 1.0                    |
   649      And the spot markets are updated:
   650        | id      | sla params          | linear slippage factor | quadratic slippage factor |
   651        | BTC/ETH | scenario-sla-params | 1e-3                   | 0                         |
   652  
   653      # Setup the market with 1 LP who is initially meeting their commitment
   654      Given the parties submit the following liquidity provision:
   655        | id  | party | market id | commitment amount | fee | lp type    |
   656        | lp1 | lp1   | BTC/ETH   | 10000             | 0.1 | submission |
   657      And the parties place the following pegged iceberg orders:
   658        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference      |
   659        | lp1   | BTC/ETH   | 200       | 120                  | buy  | BID              | 1000   | 1      | lp1-ice-buy-1  |
   660        | lp1   | BTC/ETH   | 200       | 120                  | sell | ASK              | 1000   | 1      | lp1-ice-sell-1 |
   661      When the parties place the following orders:
   662        | party | market id | side | volume | price | resulting trades | type       | tif     |
   663        | aux1  | BTC/ETH   | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
   664        | aux2  | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   665        | aux1  | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   666        | aux2  | BTC/ETH   | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC |
   667      And the opening auction period ends for market "BTC/ETH"
   668      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
   669  
   670      # Generate liquidity fees to be allocated to the LP
   671      Given the parties place the following orders:
   672        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   673        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   674        | party2 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   675      Then the accumulated liquidity fees should be "100" for the market "BTC/ETH"
   676  
   677      # Ensure LPs timeBookFraction ~=0.75, then check ~0.5 fees are penalised (then returned as a bonus as they are the only LP)
   678      Given the network moves ahead "45" blocks
   679      And the parties cancel the following orders:
   680        | party | reference      |
   681        | lp1   | lp1-ice-buy-1  |
   682        | lp1   | lp1-ice-sell-1 |
   683      When the network moves ahead "1" epochs
   684      Then the following transfers should happen:
   685        | from | to  | from account                                   | to account                                     | market id | amount | asset |
   686        |      | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY                    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | BTC/ETH   | 100    | ETH   |
   687        | lp1  | lp1 | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |
   688        | lp1  |     | ACCOUNT_TYPE_LP_LIQUIDITY_FEES                 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | BTC/ETH   | 50     | ETH   |
   689        |      | lp1 | ACCOUNT_TYPE_LIQUIDITY_FEES_BONUS_DISTRIBUTION | ACCOUNT_TYPE_GENERAL                           | BTC/ETH   | 50     | ETH   |