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

     1  Feature: Check we must supply both sides of the book to cover our commitment
     2  
     3  # When LP is committed they are obliged to provide liquidity equal to their
     4  # commitment size on both sides of the order book (0044-LIME-027)
     5  
     6    Background:
     7      Given the following network parameters are set:
     8        | name                                                  | value |
     9        | market.liquidity.bondPenaltyParameter                 | 1     |
    10        | network.markPriceUpdateMaximumFrequency               | 0s    |
    11        | limits.markets.maxPeggedOrders                        | 2     |
    12        | validators.epoch.length                               | 5s    |
    13        | market.liquidity.earlyExitPenalty                     | 0.25  |
    14        | market.liquidity.stakeToCcyVolume                     | 1.0   |
    15        | market.liquidity.sla.nonPerformanceBondPenaltySlope   | 0.19  |
    16        | market.liquidity.sla.nonPerformanceBondPenaltyMax     | 1     |
    17      And the liquidity monitoring parameters:
    18        | name               | triggering ratio | time window | scaling factor |
    19        | lqm-params         | 0.1              | 24h         | 1              |  
    20      And the average block duration is "1"
    21      And the simple risk model named "simple-risk-model-1":
    22        | long | short | max move up | min move down | probability of trading |
    23        | 0.1  | 0.1   | 60          | 50            | 0.2                    |
    24      And the fees configuration named "fees-config-1":
    25        | maker fee | infrastructure fee |
    26        | 0.004     | 0.001              |
    27      And the price monitoring named "price-monitoring-1":
    28        | horizon | probability | auction extension |
    29        | 1       | 0.99        | 5                 |
    30      And the liquidity sla params named "SLA":
    31        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    32        | 0.01        | 0.5                          | 1                             | 1.0                    |
    33      And the markets:
    34        | 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 |
    35        | ETH/DEC21 | ETH        | ETH   | lqm-params           | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.5                    | 0                         | SLA        |
    36      And the parties deposit on asset's general account the following amount:
    37        | party  | asset | amount     |
    38        | party1 | ETH   | 100000000  |
    39        | party3 | ETH   | 100000000  |
    40        | party4 | ETH   | 100000000  |
    41      And the parties submit the following liquidity provision:
    42        | id  | party  | market id | commitment amount | fee   | lp type     |
    43        | lp1 | party1 | ETH/DEC21 | 10000             | 0.001 | submission  |
    44      And the parties place the following orders:
    45        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    46        | party3 | ETH/DEC21 | buy  | 1000   | 900   | 0                | TYPE_LIMIT | TIF_GTC | p3b1      |
    47        | party3 | ETH/DEC21 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | p3b2      |
    48        | party4 | ETH/DEC21 | sell | 1000   | 1100  | 0                | TYPE_LIMIT | TIF_GTC | p4s1      |
    49        | party4 | ETH/DEC21 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | p4s2      |
    50  
    51    Scenario: 001, LP is covered fully with LIMIT orders on both sides (total of 20 volume)
    52     When the opening auction period ends for market "ETH/DEC21"
    53     And the auction ends with a traded volume of "10" at a price of "1000"
    54     Then the market data for the market "ETH/DEC21" should be:
    55       | mark price | trading mode            | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price |
    56       | 1000       | TRADING_MODE_CONTINUOUS | 1000         | 10000          | 10            | 900                   | 1000             | 1100                    |
    57     # Place LIMIT orders to cover our commitment
    58     And the parties place the following orders:
    59       | party  | market id | side | volume | price | resulting trades | type       | tif     | reference     |
    60       | party1 | ETH/DEC21 | buy  | 10     | 999   | 0                | TYPE_LIMIT | TIF_GTC | party1-order1 |
    61       | party1 | ETH/DEC21 | sell | 10     | 1001  | 0                | TYPE_LIMIT | TIF_GTC | party1-order2 |
    62     # Move forward an epoch and make sure the accounts do not change as we have the full epoch covered with LIMIT orders
    63     When the network moves ahead "7" blocks
    64     Then the liquidity provisions should have the following states:
    65       | id  | party  | market    | commitment amount | status           |
    66       | lp1 | party1 | ETH/DEC21 | 10000             | STATUS_ACTIVE    |
    67     And the parties should have the following account balances:
    68       | party  | asset | market id | margin  | general  | bond  |
    69       | party1 | ETH   | ETH/DEC21 | 1200    | 99988800 | 10000 |    
    70     And the insurance pool balance should be "0" for the market "ETH/DEC21"
    71  
    72  
    73    Scenario: 002, LP is not covered fully as the buy side is too small (total of 20 volume)
    74     When the opening auction period ends for market "ETH/DEC21"
    75     And the auction ends with a traded volume of "10" at a price of "1000"
    76     Then the market data for the market "ETH/DEC21" should be:
    77       | mark price | trading mode            | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price |
    78       | 1000       | TRADING_MODE_CONTINUOUS | 1000         | 10000          | 10            | 900                   | 1000             | 1100                    |
    79     # Place LIMIT orders to cover our commitment
    80     And the parties place the following orders:
    81       | party  | market id | side | volume | price | resulting trades | type       | tif     | reference     |
    82       | party1 | ETH/DEC21 | buy  | 18     | 999   | 0                | TYPE_LIMIT | TIF_GTC | party1-order1 |
    83       | party1 | ETH/DEC21 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | party1-order2 |
    84     # Move forward an epoch and make sure the accounts do not change as we have the full epoch covered with LIMIT orders
    85     When the network moves ahead "7" blocks
    86     Then the liquidity provisions should have the following states:
    87       | id  | party  | market    | commitment amount | status           |
    88       | lp1 | party1 | ETH/DEC21 | 10000             | STATUS_ACTIVE    |
    89     And the parties should have the following account balances:
    90       | party  | asset | market id | margin  | general  | bond |
    91       | party1 | ETH   | ETH/DEC21 | 2160    | 99987840 | 8100 |    
    92     And the insurance pool balance should be "1900" for the market "ETH/DEC21"
    93  
    94  
    95    Scenario: 003, LP is not covered fully as the sell side is too small (total of 20 volume)
    96     When the opening auction period ends for market "ETH/DEC21"
    97     And the auction ends with a traded volume of "10" at a price of "1000"
    98     Then the market data for the market "ETH/DEC21" should be:
    99       | mark price | trading mode            | target stake | supplied stake | open interest | best static bid price | static mid price | best static offer price |
   100       | 1000       | TRADING_MODE_CONTINUOUS | 1000         | 10000          | 10            | 900                   | 1000             | 1100                    |
   101     # Place LIMIT orders to cover our commitment
   102     And the parties place the following orders:
   103       | party  | market id | side | volume | price | resulting trades | type       | tif     | reference     |
   104       | party1 | ETH/DEC21 | buy  | 2     | 999   | 0                | TYPE_LIMIT | TIF_GTC | party1-order1 |
   105       | party1 | ETH/DEC21 | sell | 18      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | party1-order2 |
   106     # Move forward an epoch and make sure the accounts do not change as we have the full epoch covered with LIMIT orders
   107     When the network moves ahead "7" blocks
   108     Then the liquidity provisions should have the following states:
   109       | id  | party  | market    | commitment amount | status           |
   110       | lp1 | party1 | ETH/DEC21 | 10000             | STATUS_ACTIVE    |
   111     And the parties should have the following account balances:
   112       | party  | asset | market id | margin  | general  | bond |
   113       | party1 | ETH   | ETH/DEC21 | 2160    | 99987840 | 8100 |    
   114     And the insurance pool balance should be "1900" for the market "ETH/DEC21"