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

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