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

     1  Feature: Test vAMM implied commitment is working as expected
     2  
     3    Background:
     4      Given the average block duration is "1"
     5      And the margin calculator named "margin-calculator-1":
     6        | search factor | initial factor | release factor |
     7        | 1.2           | 1.5            | 1.7            |
     8      And the log normal risk model named "log-normal-risk-model":
     9        | risk aversion | tau                   | mu | r   | sigma |
    10        | 0.001         | 0.0011407711613050422 | 0  | 0.9 | 3.0   |
    11      And the liquidity monitoring parameters:
    12        | name       | triggering ratio | time window | scaling factor |
    13        | lqm-params | 1.00             | 20s         | 1              |
    14  
    15      And the following network parameters are set:
    16        | name                                                | value |
    17        | market.value.windowLength                           | 60s   |
    18        | network.markPriceUpdateMaximumFrequency             | 0s    |
    19        | limits.markets.maxPeggedOrders                      | 6     |
    20        | market.auction.minimumDuration                      | 1     |
    21        | market.fee.factors.infrastructureFee                | 0.001 |
    22        | market.fee.factors.makerFee                         | 0.004 |
    23        | spam.protection.max.stopOrdersPerMarket             | 5     |
    24        | market.liquidity.equityLikeShareFeeFraction         | 1     |
    25        | market.amm.minCommitmentQuantum                     | 1     |
    26        | market.liquidity.bondPenaltyParameter               | 0.2   |
    27        | market.liquidity.stakeToCcyVolume                   | 1     |
    28        | market.liquidity.successorLaunchWindowLength        | 1h    |
    29        | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0     |
    30        | market.liquidity.sla.nonPerformanceBondPenaltyMax   | 0.6   |
    31        | validators.epoch.length                             | 10s   |
    32        | market.liquidity.earlyExitPenalty                   | 0.25  |
    33        | market.liquidity.maximumLiquidityFeeFactorLevel     | 0.25  |
    34      #risk factor short:3.5569036
    35      #risk factor long:0.801225765
    36      And the following assets are registered:
    37        | id  | decimal places |
    38        | USD | 0              |
    39      And the fees configuration named "fees-config-1":
    40        | maker fee | infrastructure fee |
    41        | 0.0004    | 0.001              |
    42  
    43      And the liquidity sla params named "SLA-22":
    44        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    45        | 0.05        | 0.6                          | 1                             | 1.0                    |
    46  
    47      And the markets:
    48        | 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 |
    49        | ETH/MAR22 | USD        | USD   | lqm-params           | log-normal-risk-model | margin-calculator-1 | 2                | fees-config-1 | default-none     | default-eth-for-future | 1e0                    | 0                         | SLA-22     |
    50  
    51      Given the parties deposit on asset's general account the following amount:
    52        | party  | asset | amount  |
    53        | lp1    | USD   | 1000000 |
    54        | lp2    | USD   | 1000000 |
    55        | lp3    | USD   | 1000000 |
    56        | party1 | USD   | 1000000 |
    57        | party2 | USD   | 1000000 |
    58        | party3 | USD   | 1000000 |
    59        | party4 | USD   | 1000000 |
    60        | party5 | USD   | 1000000 |
    61        | vamm1  | USD   | 1000000 |
    62        | vamm2  | USD   | 1000000 |
    63  
    64      When the parties submit the following liquidity provision:
    65        | id   | party | market id | commitment amount | fee  | lp type    |
    66        | lp_1 | lp1   | ETH/MAR22 | 100000            | 0.02 | submission |
    67        | lp_2 | lp2   | ETH/MAR22 | 100000            | 0.02 | submission |
    68  
    69      And the parties place the following orders:
    70        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    71        | lp1    | ETH/MAR22 | buy  | 20     | 40    | 0                | TYPE_LIMIT | TIF_GTC | lp1-b     |
    72        | party1 | ETH/MAR22 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    73        | party2 | ETH/MAR22 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    74        | lp1    | ETH/MAR22 | sell | 20     | 160   | 0                | TYPE_LIMIT | TIF_GTC | lp1-s     |
    75  
    76      When the opening auction period ends for market "ETH/MAR22"
    77      Then the following trades should be executed:
    78        | buyer  | price | size | seller |
    79        | party1 | 100   | 1    | party2 |
    80  
    81      Then the network moves ahead "1" blocks
    82      And the current epoch is "0"
    83  
    84    @VAMM
    85    Scenario: 0042-LIQF-107: a vAMM which was active on the market throughout the epoch but with an active range which never overlapped with the SLA range is counted with an implied commitment of `0`.
    86  
    87      # make a one sided AMM away from everything
    88      When the parties submit the following AMM:
    89        | party | market id | amount | slippage | base | upper bound | proposed fee | error |
    90        | vamm1 | ETH/MAR22 | 100000 | 0.5      | 120  | 121         | 0.03         |       |
    91      Then the AMM pool status should be:
    92        | party | market id | amount | status        | base | upper bound |
    93        | vamm1 | ETH/MAR22 | 100000 | STATUS_ACTIVE | 120  | 121         |
    94      Then the network moves ahead "1" blocks
    95  
    96      Then the network moves ahead "1" epochs
    97  
    98      # place some orders around 100
    99      And the parties place the following orders:
   100        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
   101        | party1 | ETH/MAR22 | buy  | 10     | 99    | 0                | TYPE_LIMIT | TIF_GTC | lp1-b     |
   102        | party1 | ETH/MAR22 | buy  | 10     | 100   | 0                | TYPE_LIMIT | TIF_GTC | lp1-b     |
   103        | party2 | ETH/MAR22 | sell | 10     | 100   | 1                | TYPE_LIMIT | TIF_GTC |           |
   104        | party2 | ETH/MAR22 | sell | 10     | 101   | 0                | TYPE_LIMIT | TIF_GTC |           |
   105  
   106      Then the network moves ahead "1" epochs
   107  
   108      And the following transfers should happen:
   109        | type                                    | from   | to     | from account                   | to account                     | market id | amount | asset |
   110        | TRANSFER_TYPE_LIQUIDITY_FEE_ALLOCATE    | market | lp1    | ACCOUNT_TYPE_FEES_LIQUIDITY    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 10     | USD   |
   111        | TRANSFER_TYPE_LIQUIDITY_FEE_ALLOCATE    | market | lp2    | ACCOUNT_TYPE_FEES_LIQUIDITY    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/MAR22 | 10     | USD   |
   112  
   113      # the ELS of the two LPs should be 0.5 implying that the AMM should have 0 share
   114      And the liquidity provider fee shares for the market "ETH/MAR22" should be:
   115      | party  | equity like share  | virtual stake           | average entry valuation |
   116      | lp1    | 0.5                | 100000.0000000000000000 | 100000                  |
   117      | lp2    | 0.5                | 100000.0000000000000000 | 200000                  |