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

     1  Feature: Test LP SLA Bond penalty;
     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 liquidity monitoring parameters:
    12        | name               | triggering ratio | time window | scaling factor |
    13        | lqm-params         | 1.0              | 20s         | 1              |  
    14      And the following network parameters are set:
    15        | name                                          | value |
    16        | market.value.windowLength                     | 60s   |
    17        | network.markPriceUpdateMaximumFrequency       | 0s    |
    18        | limits.markets.maxPeggedOrders                | 6     |
    19        | market.auction.minimumDuration                | 1     |
    20        | market.fee.factors.infrastructureFee          | 0.001 |
    21        | market.fee.factors.makerFee                   | 0.004 |
    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, 0044-LIME-014, 0044-LIME-015
    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  
    73      When the network moves ahead "4" blocks
    74      And the parties place the following pegged iceberg orders:
    75        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference |
    76        | lp1   | ETH/MAR22 | 12        | 1                    | buy  | BID              | 12     | 20     | lp-b-1    |
    77        | lp1   | ETH/MAR22 | 12        | 1                    | sell | ASK              | 12     | 20     | lp-s-1    |
    78  
    79      Then the parties place the following orders:
    80        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    81        | party1 | ETH/MAR22 | buy  | 10     | 900   | 0                | TYPE_LIMIT | TIF_GTC |
    82        | party1 | ETH/MAR22 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    83        | party2 | ETH/MAR22 | sell | 10     | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    84        | party2 | ETH/MAR22 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    85  
    86      Then the opening auction period ends for market "ETH/MAR22"
    87      And the following trades should be executed:
    88        | buyer  | price | size | seller |
    89        | party1 | 1000  | 1    | party2 |
    90  
    91      And the market data for the market "ETH/MAR22" should be:
    92        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    93        | 1000       | TRADING_MODE_CONTINUOUS | 3600    | 973       | 1027      | 3556         | 8000           | 1             |
    94      # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 1 x 1 x 3.5569036 =3556
    95      And the liquidity fee factor should be "0.015" for the market "ETH/MAR22"
    96  
    97      When the network moves ahead "3" blocks
    98      Then the parties cancel the following orders:
    99        | party | reference |
   100        | lp1   | lp-b-1    |
   101        | lp1   | lp-s-1    |
   102      When the network moves ahead "7" blocks
   103      #fraction_of_time_on_book=0.375
   104      #0.7 * (1 - 0.375 / 0.6) = 0.2625, so bond penalty for lp1 should be 0.2625*4000=1050; bond penalty for lp2 should be 0.6*4000=2400
   105      Then the following transfers should happen:
   106        | from | to     | from account      | to account             | market id | amount | asset |
   107        | lp1  | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 1050   | USD   |
   108        | lp2  | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 2400   | USD   |
   109  
   110      And the parties should have the following account balances:
   111        | party | asset | market id | margin | general | bond |
   112        | lp1   | USD   | ETH/MAR22 | 0      | 96000   | 2950 |
   113        | lp2   | USD   | ETH/MAR22 | 0      | 96000   | 1600 |
   114      And the market data for the market "ETH/MAR22" should be:
   115        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   116        | 1000       | TRADING_MODE_CONTINUOUS | 3600    | 973       | 1027      | 3556         | 4550           | 1             |
   117  
   118  #if commitment min time fraction is 0, then LP will not get SLA bond penalty for not supplying volume on the book, nor liquidity fee
   119      Given the liquidity sla params named "updated-sla-params":
   120        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   121        | 1           | 0                            | 2                             | 1                      |
   122      And the markets are updated:
   123        | id        | sla params         | linear slippage factor | quadratic slippage factor |
   124        | ETH/MAR22 | updated-sla-params | 1e-3                   | 0                         |
   125  
   126      And the network moves ahead "1" epochs
   127      And the market data for the market "ETH/MAR22" should be:
   128        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   129        | 1000       | TRADING_MODE_CONTINUOUS | 3600    | 973       | 1027      | 3556         | 1820           | 1             |
   130  
   131      Then the following transfers should happen:
   132        | from | to     | from account      | to account             | market id | amount | asset |
   133        | lp1  | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 1770   | USD   |
   134        | lp2  | market | ACCOUNT_TYPE_BOND | ACCOUNT_TYPE_INSURANCE | ETH/MAR22 | 960    | USD   |
   135  
   136      And the insurance pool balance should be "6180" for the market "ETH/MAR22"
   137  
   138  
   139  
   140