code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/accounts_and_fees/0029-FEES-022.feature (about)

     1  Feature: Spot market fees distribution
     2  
     3    Scenario: 0029-FEES-022: Fees are collected during continuous trading and auction modes and distributed to the appropriate accounts when Position Decimal Places (PDP) is -2
     4  
     5    Background:
     6  
     7      Given the following network parameters are set:
     8        | name                                            | value |
     9        | network.markPriceUpdateMaximumFrequency         | 1s    |
    10        | market.value.windowLength                       | 1h    |
    11        | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4   |
    12        | validators.epoch.length                         | 4s    |
    13  
    14      Given the following assets are registered:
    15        | id  | decimal places |
    16        | ETH | 2              |
    17        | BTC | 2              |
    18  
    19      Given the fees configuration named "fees-config-1":
    20        | maker fee | infrastructure fee |
    21        | 0.01      | 0.03               |
    22      Given the log normal risk model named "lognormal-risk-model-1":
    23        | risk aversion | tau  | mu | r   | sigma |
    24        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    25      And the price monitoring named "price-monitoring-1":
    26        | horizon | probability | auction extension |
    27        | 36000   | 0.999       | 1                 |
    28        | 38000   | 0.999       | 2                 |
    29  
    30      And the spot markets:
    31        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | decimal places | position decimal places | sla params    |
    32        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | 2              | -2                      | default-basic |
    33  
    34      And the following network parameters are set:
    35        | name                                             | value |
    36        | limits.markets.maxPeggedOrders                   | 2     |
    37        | network.markPriceUpdateMaximumFrequency          | 0s    |
    38        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    39        | validators.epoch.length                          | 58s   |
    40        | market.liquidity.stakeToCcyVolume                | 1     |
    41  
    42      Given the parties deposit on asset's general account the following amount:
    43        | party  | asset | amount |
    44        | party1 | ETH   | 100000 |
    45        | party1 | BTC   | 100000 |
    46        | party2 | ETH   | 100000 |
    47        | party2 | BTC   | 100000 |
    48        | lp     | ETH   | 100000 |
    49        | lp     | BTC   | 100000 |
    50      And the average block duration is "1"
    51  
    52      Given the parties submit the following liquidity provision:
    53        | id  | party | market id | commitment amount | fee   | lp type    |
    54        | lp1 | lp    | BTC/ETH   | 500               | 0.025 | submission |
    55  
    56      And the parties place the following orders:
    57        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    58        | party1 | BTC/ETH   | buy  | 1      | 10    | 0                | TYPE_LIMIT | TIF_GTC |
    59        | party1 | BTC/ETH   | buy  | 1      | 20    | 0                | TYPE_LIMIT | TIF_GTC |
    60        | party2 | BTC/ETH   | sell | 1      | 20    | 0                | TYPE_LIMIT | TIF_GTC |
    61        | party2 | BTC/ETH   | sell | 1      | 30    | 0                | TYPE_LIMIT | TIF_GTC |
    62  
    63      Then the network moves ahead "2" blocks
    64  
    65      Then the market data for the market "BTC/ETH" should be:
    66        | mark price | trading mode            | auction trigger             | horizon | min bound | max bound | open interest |
    67        | 20         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 36000   | 18        | 22        | 0             |
    68        | 20         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 38000   | 18        | 22        | 0             |
    69  
    70      And the parties place the following orders:
    71        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   |
    72        | party1 | BTC/ETH   | buy  | 1      | 20    | 0                | TYPE_LIMIT | TIF_GTC |             |
    73        | party2 | BTC/ETH   | sell | 1      | 20    | 1                | TYPE_LIMIT | TIF_GTC |             |
    74        | party1 | BTC/ETH   | buy  | 1      | 18    | 0                | TYPE_LIMIT | TIF_GTC |             |
    75        | party2 | BTC/ETH   | sell | 1      | 22    | 0                | TYPE_LIMIT | TIF_GTC | sell-party2 |
    76  
    77      Then the network moves ahead "1" blocks
    78      #lp fee: 2000*100*0.025=50
    79      And the following transfers should happen:
    80        | from   | to     | from account                | to account                       | market id | amount | asset |
    81        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_MAKER          | BTC/ETH   | 20     | ETH   |
    82        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | BTC/ETH   | 60     | ETH   |
    83        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_LIQUIDITY      | BTC/ETH   | 50     | ETH   |
    84        | market | party1 | ACCOUNT_TYPE_FEES_MAKER     | ACCOUNT_TYPE_GENERAL             | BTC/ETH   | 20     | ETH   |
    85        | market | lp     | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES   | BTC/ETH   | 50     | ETH   |
    86  
    87      And the parties amend the following orders:
    88        | party  | reference   | price | size delta | tif     |
    89        | party2 | sell-party2 | 18    | 0          | TIF_GTC |
    90  
    91      Then the market data for the market "BTC/ETH" should be:
    92        | mark price | last traded price | trading mode            |
    93        | 20         | 18                | TRADING_MODE_CONTINUOUS |
    94      And the following trades should be executed:
    95        | buyer  | price | size | seller |
    96        | party1 | 18    | 1    | party2 |
    97  
    98      Then the network moves ahead "2" blocks
    99      And the following transfers should happen:
   100        | from   | to     | from account                | to account                       | market id | amount | asset |
   101        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_MAKER          | BTC/ETH   | 18     | ETH   |
   102        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | BTC/ETH   | 54     | ETH   |
   103        | party2 | market | ACCOUNT_TYPE_GENERAL        | ACCOUNT_TYPE_FEES_LIQUIDITY      | BTC/ETH   | 45     | ETH   |
   104        | market | party1 | ACCOUNT_TYPE_FEES_MAKER     | ACCOUNT_TYPE_GENERAL             | BTC/ETH   | 18     | ETH   |
   105        | market | lp     | ACCOUNT_TYPE_FEES_LIQUIDITY | ACCOUNT_TYPE_LP_LIQUIDITY_FEES   | BTC/ETH   | 45     | ETH   |
   106