code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/0044-LIME-050.feature (about)

     1  Feature: Test LP, when market is in opening auction, in terms of the liquidity they are expected to supply: this only takes effect from the start of the next epoch
     2  
     3    Background:
     4  
     5      Given the margin calculator named "margin-calculator-1":
     6        | search factor | initial factor | release factor |
     7        | 1.2           | 1.5            | 1.7            |
     8      Given the log normal risk model named "log-normal-risk-model":
     9        | risk aversion | tau | mu | r | sigma |
    10        | 0.000001      | 0.1 | 0  | 0 | 1.0   |
    11      And the following network parameters are set:
    12        | name                                          | value |
    13        | market.value.windowLength                     | 60s   |
    14        | network.markPriceUpdateMaximumFrequency       | 0s    |
    15        | limits.markets.maxPeggedOrders                | 6     |
    16        | market.auction.minimumDuration                | 1     |
    17        | market.fee.factors.infrastructureFee          | 0.001 |
    18        | market.fee.factors.makerFee                   | 0.004 |
    19      And the liquidity monitoring parameters:
    20        | name               | triggering ratio | time window | scaling factor |
    21        | lqm-params         | 1.0              | 20s         | 1              |  
    22      #risk factor short:3.5569036
    23      #risk factor long:0.801225765
    24      And the following assets are registered:
    25        | id  | decimal places |
    26        | USD | 0              |
    27      And the fees configuration named "fees-config-1":
    28        | maker fee | infrastructure fee |
    29        | 0.0004    | 0.001              |
    30      And the price monitoring named "price-monitoring":
    31        | horizon | probability | auction extension |
    32        | 3600    | 0.99        | 3                 |
    33  
    34      And the liquidity sla params named "SLA-22":
    35        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    36        | 0.5         | 0.6                          | 1                             | 1.0                    |
    37      And the liquidity sla params named "SLA-23":
    38        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    39        | 0           | 0.6                          | 1                             | 1.0                    |
    40  
    41      And the markets:
    42        | id        | quote name | asset | liquidity monitoring | risk model            | margin calculator   | auction duration | fees          | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params |
    43        | ETH/MAR22 | USD        | USD   | lqm-params           | log-normal-risk-model | margin-calculator-1 | 2                | fees-config-1 | price-monitoring | default-eth-for-future | 1e0                    | 0                         | SLA-22     |
    44        | ETH/MAR23 | USD        | USD   | lqm-params           | log-normal-risk-model | margin-calculator-1 | 2                | fees-config-1 | price-monitoring | default-eth-for-future | 1e0                    | 0                         | SLA-23     |
    45  
    46      And the following network parameters are set:
    47        | name                                                | value |
    48        | market.liquidity.bondPenaltyParameter               | 0.2   |
    49        | validators.epoch.length                             | 5s    |
    50        | market.liquidity.stakeToCcyVolume                   | 1     |
    51        | market.liquidity.successorLaunchWindowLength        | 1h    |
    52        | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7   |
    53        | market.liquidity.sla.nonPerformanceBondPenaltyMax   | 0.6   |
    54        | validators.epoch.length                             | 10s   |
    55        | market.liquidity.earlyExitPenalty                   | 0.25  |
    56  
    57      Given the average block duration is "1"
    58    @Now
    59    Scenario: 001: lp1 and lp2 on the market ETH/MAR22 placed commitment during opening auction, 0044-LIME-050
    60      Given the parties deposit on asset's general account the following amount:
    61        | party  | asset | amount |
    62        | lp1    | USD   | 100000 |
    63        | lp2    | USD   | 100000 |
    64        | party1 | USD   | 100000 |
    65        | party2 | USD   | 100000 |
    66        | party3 | USD   | 100000 |
    67  
    68      And the parties submit the following liquidity provision:
    69        | id   | party | market id | commitment amount | fee   | lp type    |
    70        | lp_1 | lp1   | ETH/MAR22 | 4000              | 0.02  | submission |
    71        | lp_2 | lp2   | ETH/MAR22 | 4000              | 0.015 | submission |
    72      And the supplied stake should be "8000" for the market "ETH/MAR22"
    73      When the network moves ahead "4" blocks
    74      And the insurance pool balance should be "0" for the market "ETH/MAR22"
    75  
    76      And the parties submit the following liquidity provision:
    77        | id   | party | market id | commitment amount | fee   | lp type   |
    78        | lp_1 | lp1   | ETH/MAR22 | 6000              | 0.02  | amendment |
    79        | lp_2 | lp2   | ETH/MAR22 | 6000              | 0.015 | amendment |
    80      #When a LP increases their commitment then: It takes effect immediately for the purposes of LP stake supplied to the market
    81      And the supplied stake should be "12000" for the market "ETH/MAR22"
    82      When the network moves ahead "4" blocks
    83      And the insurance pool balance should be "0" for the market "ETH/MAR22"
    84      And the current epoch is "0"
    85  
    86      #lp place pegged order end of first epoch
    87      And the parties place the following pegged iceberg orders:
    88        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference |
    89        | lp1   | ETH/MAR22 | 12        | 1                    | buy  | BID              | 12     | 20     | lp-b-1    |
    90        | lp1   | ETH/MAR22 | 12        | 1                    | sell | ASK              | 12     | 20     | lp-s-1    |
    91      When the network moves ahead "5" blocks
    92      And the current epoch is "1"
    93  
    94      Then the parties place the following orders:
    95        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    96        | party1 | ETH/MAR22 | buy  | 10     | 900   | 0                | TYPE_LIMIT | TIF_GTC |
    97        | party1 | ETH/MAR22 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    98        | party2 | ETH/MAR22 | sell | 10     | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    99        | party2 | ETH/MAR22 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   100  
   101      Then the opening auction period ends for market "ETH/MAR22"
   102      And the insurance pool balance should be "0" for the market "ETH/MAR22"
   103      And the following trades should be executed:
   104        | buyer  | price | size | seller |
   105        | party1 | 1000  | 1    | party2 |
   106  
   107      When the network moves ahead "6" blocks
   108      And the current epoch is "1"
   109      And the insurance pool balance should be "0" for the market "ETH/MAR22"
   110      And the supplied stake should be "12000" for the market "ETH/MAR22"
   111  
   112      When the network moves ahead "6" blocks
   113      And the current epoch is "2"
   114      And the insurance pool balance should be "3600" for the market "ETH/MAR22"
   115      And the supplied stake should be "8400" for the market "ETH/MAR22"
   116  
   117      Then the following transfers should happen:
   118        | from | to     | from account      | to account             | market id | amount | asset |
   119        | lp2  | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 3600   | USD   |
   120  
   121  
   122