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

     1  Feature: All liquidity providers with `average fraction of liquidity provided by committed LP > 0` in the market receive a greater than zero amount of liquidity fee. The only exception is if a non-zero amount is rounded to zero due to integer representation.
     2  
     3    Scenario: 001: 0042-LIQF-015
     4      Given the following network parameters are set:
     5        | name                                             | value |
     6        | market.value.windowLength                        | 1h    |
     7        | network.markPriceUpdateMaximumFrequency          | 0s    |
     8        | limits.markets.maxPeggedOrders                   | 4     |
     9        | market.liquidity.providersFeeCalculationTimeStep | 600s  |
    10        | market.liquidity.equityLikeShareFeeFraction      | 1     |
    11      Given the liquidity monitoring parameters:
    12        | name               | triggering ratio | time window | scaling factor |
    13        | lqm-params         | 0.0              | 24h         | 1.0            |
    14      
    15      And the following assets are registered:
    16        | id  | decimal places |
    17        | ETH | 5              |
    18        | USD | 5              |
    19      And the average block duration is "2"
    20  
    21      And the log normal risk model named "log-normal-risk-model-1":
    22        | risk aversion | tau | mu | r | sigma |
    23        | 0.000001      | 0.1 | 0  | 0 | 1.0   |
    24      And the fees configuration named "fees-config-1":
    25        | maker fee | infrastructure fee |
    26        | 0.0004    | 0.001              |
    27      And the price monitoring named "price-monitoring-1":
    28        | horizon | probability | auction extension |
    29        | 100000  | 0.99        | 3                 |
    30      And the liquidity sla params named "SLA":
    31        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    32        | 1.0         | 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     | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params |
    35        | ETH/MAR22 | ETH        | USD   | lqm-params           | log-normal-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0              | 0                       | 0.5                    | 0                         | SLA        |
    36  
    37      Given the parties deposit on asset's general account the following amount:
    38        | party  | asset | amount          |
    39        | lp1    | USD   | 100000000000000 |
    40        | lp2    | USD   | 100000000000000 |
    41        | lp3    | USD   | 100000000000000 |
    42        | party1 | USD   | 10000000000000  |
    43        | party2 | USD   | 10000000000000  |
    44  
    45      And the parties submit the following liquidity provision:
    46        | id  | party | market id | commitment amount | fee   | lp type    |
    47        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
    48        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
    49        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
    50        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
    51      And the parties place the following pegged iceberg orders:
    52        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    53        | lp1   | ETH/MAR22 | 2         | 1                    | buy  | BID              | 1      | 2      |
    54        | lp1   | ETH/MAR22 | 2         | 1                    | buy  | MID              | 2      | 1      |
    55        | lp1   | ETH/MAR22 | 2         | 1                    | sell | ASK              | 1      | 2      |
    56        | lp1   | ETH/MAR22 | 2         | 1                    | sell | MID              | 2      | 1      |
    57      And the parties submit the following liquidity provision:
    58        | id  | party | market id | commitment amount | fee   | lp type    |
    59        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
    60        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
    61        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
    62        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
    63      And the parties place the following pegged iceberg orders:
    64        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    65        | lp2   | ETH/MAR22 | 2         | 1                    | buy  | BID              | 1      | 2      |
    66        | lp2   | ETH/MAR22 | 2         | 1                    | buy  | MID              | 2      | 1      |
    67        | lp2   | ETH/MAR22 | 2         | 1                    | sell | ASK              | 1      | 2      |
    68        | lp2   | ETH/MAR22 | 2         | 1                    | sell | MID              | 2      | 1      |
    69  
    70      Then the parties place the following orders with ticks:
    71        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    72        | party1 | ETH/MAR22 | buy  | 1      | 900   | 0                | TYPE_LIMIT | TIF_GTC |
    73        | party1 | ETH/MAR22 | buy  | 60     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    74        | party2 | ETH/MAR22 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    75        | party2 | ETH/MAR22 | sell | 60     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    76  
    77      Then the opening auction period ends for market "ETH/MAR22"
    78  
    79      And the following trades should be executed:
    80        | buyer  | price | size | seller |
    81        | party1 | 1000  | 60   | party2 |
    82  
    83      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22"
    84      And the mark price should be "1000" for the market "ETH/MAR22"
    85      And the open interest should be "60" for the market "ETH/MAR22"
    86      And the target stake should be "21341400000" for the market "ETH/MAR22"
    87      And the supplied stake should be "800000100000" for the market "ETH/MAR22"
    88  
    89      And the liquidity provider fee shares for the market "ETH/MAR22" should be:
    90        | party | equity like share  | average entry valuation |
    91        | lp1   | 0.9999998750000156 | 800000000000            |
    92        | lp2   | 0.0000001249999844 | 800000100000            |
    93  
    94      And the liquidity fee factor should be "0.001" for the market "ETH/MAR22"
    95  
    96      # no fees in auction
    97      And the accumulated liquidity fees should be "0" for the market "ETH/MAR22"
    98  
    99      Then the parties place the following orders with ticks:
   100        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   |
   101        | party1 | ETH/MAR22 | sell | 20     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | party1-sell |
   102        | party2 | ETH/MAR22 | buy  | 20     | 1000  | 3                | TYPE_LIMIT | TIF_GTC | party2-buy  |
   103      And the liquidity fee factor should be "0.001" for the market "ETH/MAR22"
   104  
   105      And the accumulated liquidity fees should be "1980400" for the market "ETH/MAR22"
   106  
   107      # check lp fee distribution
   108      Then time is updated to "2019-11-30T00:10:05Z"
   109  
   110      Then the following transfers should happen:
   111        | from   | to  | from account                | to account                     | market id | amount  | asset |
   112        | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1980399 | USD   |
   113        | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 0       | USD   |
   114  
   115    Scenario: 001b: 0042-LIQF-015 + equityLikeShareFeeFraction set to 0.5
   116      Given the following network parameters are set:
   117        | name                                             | value |
   118        | market.value.windowLength                        | 1h    |
   119        | network.markPriceUpdateMaximumFrequency          | 0s    |
   120        | limits.markets.maxPeggedOrders                   | 4     |
   121        | market.liquidity.providersFeeCalculationTimeStep | 600s  |
   122        | market.liquidity.equityLikeShareFeeFraction      | 0.5   |
   123      Given the liquidity monitoring parameters:
   124        | name               | triggering ratio | time window | scaling factor |
   125        | lqm-params         | 0.0              | 24h         | 1.0            |
   126      
   127      And the following assets are registered:
   128        | id  | decimal places |
   129        | ETH | 5              |
   130        | USD | 5              |
   131      And the average block duration is "2"
   132  
   133      And the log normal risk model named "log-normal-risk-model-1":
   134        | risk aversion | tau | mu | r | sigma |
   135        | 0.000001      | 0.1 | 0  | 0 | 1.0   |
   136      And the fees configuration named "fees-config-1":
   137        | maker fee | infrastructure fee |
   138        | 0.0004    | 0.001              |
   139      And the price monitoring named "price-monitoring-1":
   140        | horizon | probability | auction extension |
   141        | 100000  | 0.99        | 3                 |
   142      And the liquidity sla params named "SLA":
   143        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
   144        | 1.0         | 0.5                          | 1                             | 1.0                    |
   145      And the markets:
   146        | id        | quote name | asset | liquidity monitoring | risk model              | margin calculator         | auction duration | fees          | price monitoring   | data source config     | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params |
   147        | ETH/MAR22 | ETH        | USD   | lqm-params           | log-normal-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0              | 0                       | 0.5                    | 0                         | SLA        |
   148  
   149      Given the parties deposit on asset's general account the following amount:
   150        | party  | asset | amount          |
   151        | lp1    | USD   | 100000000000000 |
   152        | lp2    | USD   | 100000000000000 |
   153        | lp3    | USD   | 100000000000000 |
   154        | party1 | USD   | 10000000000000  |
   155        | party2 | USD   | 10000000000000  |
   156  
   157      And the parties submit the following liquidity provision:
   158        | id  | party | market id | commitment amount | fee   | lp type    |
   159        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
   160        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
   161        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
   162        | lp1 | lp1   | ETH/MAR22 | 800000000000      | 0.001 | submission |
   163      And the parties place the following pegged iceberg orders:
   164        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   165        | lp1   | ETH/MAR22 | 2         | 1                    | buy  | BID              | 1      | 2      |
   166        | lp1   | ETH/MAR22 | 2         | 1                    | buy  | MID              | 2      | 1      |
   167        | lp1   | ETH/MAR22 | 2         | 1                    | sell | ASK              | 1      | 2      |
   168        | lp1   | ETH/MAR22 | 2         | 1                    | sell | MID              | 2      | 1      |
   169      And the parties submit the following liquidity provision:
   170        | id  | party | market id | commitment amount | fee   | lp type    |
   171        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
   172        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
   173        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
   174        | lp2 | lp2   | ETH/MAR22 | 100000            | 0.002 | submission |
   175      And the parties place the following pegged iceberg orders:
   176        | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   177        | lp2   | ETH/MAR22 | 2         | 1                    | buy  | BID              | 1      | 2      |
   178        | lp2   | ETH/MAR22 | 2         | 1                    | buy  | MID              | 2      | 1      |
   179        | lp2   | ETH/MAR22 | 2         | 1                    | sell | ASK              | 1      | 2      |
   180        | lp2   | ETH/MAR22 | 2         | 1                    | sell | MID              | 2      | 1      |
   181  
   182      Then the parties place the following orders with ticks:
   183        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   184        | party1 | ETH/MAR22 | buy  | 1      | 900   | 0                | TYPE_LIMIT | TIF_GTC |
   185        | party1 | ETH/MAR22 | buy  | 60     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   186        | party2 | ETH/MAR22 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
   187        | party2 | ETH/MAR22 | sell | 60     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   188  
   189      Then the opening auction period ends for market "ETH/MAR22"
   190  
   191      And the following trades should be executed:
   192        | buyer  | price | size | seller |
   193        | party1 | 1000  | 60   | party2 |
   194  
   195      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22"
   196      And the mark price should be "1000" for the market "ETH/MAR22"
   197      And the open interest should be "60" for the market "ETH/MAR22"
   198      And the target stake should be "21341400000" for the market "ETH/MAR22"
   199      And the supplied stake should be "800000100000" for the market "ETH/MAR22"
   200  
   201      And the liquidity provider fee shares for the market "ETH/MAR22" should be:
   202        | party | equity like share  | average entry valuation |
   203        | lp1   | 0.9999998750000156 | 800000000000            |
   204        | lp2   | 0.0000001249999844 | 800000100000            |
   205  
   206      And the liquidity fee factor should be "0.001" for the market "ETH/MAR22"
   207  
   208      # no fees in auction
   209      And the accumulated liquidity fees should be "0" for the market "ETH/MAR22"
   210  
   211      Then the parties place the following orders with ticks:
   212        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   |
   213        | party1 | ETH/MAR22 | sell | 20     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | party1-sell |
   214        | party2 | ETH/MAR22 | buy  | 20     | 1000  | 3                | TYPE_LIMIT | TIF_GTC | party2-buy  |
   215      And the liquidity fee factor should be "0.001" for the market "ETH/MAR22"
   216  
   217      And the accumulated liquidity fees should be "1980400" for the market "ETH/MAR22"
   218  
   219      # check lp fee distribution
   220      Then time is updated to "2019-11-30T00:10:05Z"
   221  
   222      Then the following transfers should happen:
   223        | from   | to  | from account                | to account                     | market id | amount  | asset |
   224        | market | lp1 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 1485299 | USD   |
   225        | market | lp2 | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 495100  | USD   |