code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/liquidity_provision/0044-LIME_spot.feature (about)

     1  Feature: Spot market
     2  
     3    @SLABug
     4    Scenario: party submit liquidity, and amend/cancel it
     5      Given the fees configuration named "fees-config-1":
     6        | maker fee | infrastructure fee |
     7        | 0         | 0                  |
     8      Given the log normal risk model named "lognormal-risk-model-1":
     9        | risk aversion | tau  | mu | r   | sigma |
    10        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    11  
    12      And the price monitoring named "price-monitoring-1":
    13        | horizon | probability | auction extension |
    14        | 360000  | 0.999       | 300               |
    15  
    16      And the liquidity sla params named "SLA-1":
    17        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    18        | 0.99        | 0.1                          | 2                             | 0.2                    |
    19  
    20      Given the following assets are registered:
    21        | id  | decimal places |
    22        | ETH | 1              |
    23        | BTC | 1              |
    24  
    25      And the following network parameters are set:
    26        | name                                                  | value |
    27        | network.markPriceUpdateMaximumFrequency               | 0s    |
    28        | market.liquidity.earlyExitPenalty                     | 0.02  |
    29        | market.liquidity.earlyExitPenalty                     | 0.5   |
    30        | market.liquidity.bondPenaltyParameter                 | 0     |
    31        | market.liquidity.sla.nonPerformanceBondPenaltySlope   | 0.5   |
    32        | market.liquidity.sla.nonPerformanceBondPenaltyMax     | 0.2   |
    33        | market.liquidity.maximumLiquidityFeeFactorLevel       | 0.4   |
    34        | validators.epoch.length                               | 2s    |
    35  
    36      Given time is updated to "2023-07-20T00:00:00Z"
    37  
    38      And the spot markets:
    39        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | sla params |
    40        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | SLA-1      |
    41      And the following network parameters are set:
    42        | name                                               | value |
    43        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    44  
    45      Given the parties deposit on asset's general account the following amount:
    46        | party  | asset | amount |
    47        | party1 | ETH   | 10000  |
    48        | party2 | BTC   | 50     |
    49        | lpprov | ETH   | 4000   |
    50        | lpprov | BTC   | 60     |
    51  
    52      And the average block duration is "1"
    53  
    54      Given the liquidity monitoring parameters:
    55        | name               | triggering ratio | time window | scaling factor |
    56        | updated-lqm-params | 0.2              | 20s         | 0.01           |
    57  
    58      When the spot markets are updated:
    59        | id      | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    60        | BTC/ETH | updated-lqm-params   | 0.5                    | 0.5                       |
    61  
    62      # Attempt to submit a liquidity request we do not have enough funds to cover (0080-SPOT-006)
    63      When the parties submit the following liquidity provision:
    64        | id  | party  | market id | commitment amount | fee | lp type    | error                                    |
    65        | lp1 | lpprov | BTC/ETH   | 5000              | 0.1 | submission | not enough collateral in general account |
    66  
    67      When the parties submit the following liquidity provision:
    68        | id  | party  | market id | commitment amount | fee | lp type    |
    69        | lp1 | lpprov | BTC/ETH   | 1000              | 0.1 | submission |
    70  
    71      Then the network moves ahead "1" blocks
    72      And the network treasury balance should be "0" for the asset "ETH"
    73      And the global insurance pool balance should be "0" for the asset "ETH"
    74      And the global insurance pool balance should be "0" for the asset "BTC"
    75      And the party "lpprov" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
    76  
    77      Then "lpprov" should have general account balance of "3000" for asset "ETH"
    78      Then "lpprov" should have general account balance of "60" for asset "BTC"
    79      Then the party "lpprov" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    80  
    81      Then the market data for the market "BTC/ETH" should be:
    82        | mark price | trading mode                 | auction trigger         | target stake | supplied stake | open interest |
    83        | 0          | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 10           | 1000           | 0             |
    84  
    85      # place orders and generate trades
    86      And the parties place the following orders:
    87        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference    | only |
    88        | party1 | BTC/ETH   | buy  | 1      | 12    | 0                | TYPE_LIMIT | TIF_GTC | party-order1 |      |
    89        | party2 | BTC/ETH   | sell | 1      | 19    | 0                | TYPE_LIMIT | TIF_GTC | party-order2 |      |
    90        | party1 | BTC/ETH   | buy  | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order3 |      |
    91        | party2 | BTC/ETH   | sell | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order4 |      |
    92        | lpprov | BTC/ETH   | buy  | 12     | 10    | 0                | TYPE_LIMIT | TIF_GTC | lp-order1    |      |
    93        | lpprov | BTC/ETH   | sell | 6      | 20    | 0                | TYPE_LIMIT | TIF_GTC | lp-order2    |      |
    94  
    95      When the network moves ahead "3" blocks
    96  
    97      Then the market data for the market "BTC/ETH" should be:
    98        | mark price | trading mode            | auction trigger             | horizon | min bound | max bound | target stake | supplied stake | open interest |
    99        | 15         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 360000  | 10        | 22        | 10           | 1000            | 0             |
   100  
   101      When the parties submit the following liquidity provision:
   102        | id  | party  | market id | commitment amount | fee | lp type   |
   103        | lp1 | lpprov | BTC/ETH   | 2000              | 0.1 | amendment |
   104  
   105      Then the network moves ahead "2" blocks
   106      And the network treasury balance should be "0" for the asset "ETH"
   107      And the global insurance pool balance should be "0" for the asset "ETH"
   108      And the global insurance pool balance should be "0" for the asset "BTC"
   109      And the party "lpprov" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
   110      Then "lpprov" should have holding account balance of "1200" for asset "ETH"
   111      Then "lpprov" should have general account balance of "800" for asset "ETH"
   112      Then "lpprov" should have holding account balance of "60" for asset "BTC"
   113      Then "lpprov" should have general account balance of "0" for asset "BTC"
   114      Then the party "lpprov" lp liquidity bond account balance should be "2000" for the market "BTC/ETH"
   115  
   116      Then the market data for the market "BTC/ETH" should be:
   117        | mark price | trading mode            | auction trigger             | target stake | supplied stake |
   118        | 15         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 20           | 2000           |
   119  
   120      And the order book should have the following volumes for market "BTC/ETH":
   121        | side | price | volume |
   122        | buy  | 10    | 12     |
   123        | buy  | 12    | 1      |
   124        | sell | 19    | 1      |
   125        | sell | 20    | 6      |
   126  
   127      Then the network moves ahead "7" blocks
   128      When the parties submit the following liquidity provision:
   129        | id  | party  | market id | commitment amount | fee | lp type   |
   130        | lp1 | lpprov | BTC/ETH   | 20                | 0.1 | amendment |
   131  
   132      Then the network moves ahead "7" blocks
   133      Then the market data for the market "BTC/ETH" should be:
   134        | mark price | trading mode            | auction trigger             | target stake | supplied stake |
   135        | 15         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 20           | 20             |
   136  
   137      And the order book should have the following volumes for market "BTC/ETH":
   138        | side | price | volume |
   139        | buy  | 10    | 12     |
   140        | buy  | 12    | 1      |
   141        | sell | 19    | 1      |
   142        | sell | 20    | 6      |
   143  
   144      # place orders and generate trades to trigger liquidity fee
   145      And the parties place the following orders:
   146        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | only |
   147        | party1 | BTC/ETH   | buy  | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC |           |      |
   148        | party2 | BTC/ETH   | sell | 1      | 15    | 1                | TYPE_LIMIT | TIF_GTC |           |      |
   149  
   150      Then the network moves ahead "2" blocks
   151      And the network treasury balance should be "0" for the asset "ETH"
   152      And the global insurance pool balance should be "0" for the asset "ETH"
   153      And the global insurance pool balance should be "0" for the asset "BTC"
   154      And the party "lpprov" lp liquidity fee account balance should be "15" for the market "BTC/ETH"
   155      Then "lpprov" should have holding account balance of "1200" for asset "ETH"
   156      Then "lpprov" should have general account balance of "2780" for asset "ETH"
   157      Then "lpprov" should have holding account balance of "60" for asset "BTC"
   158      Then "lpprov" should have general account balance of "0" for asset "BTC"
   159      Then the party "lpprov" lp liquidity bond account balance should be "20" for the market "BTC/ETH"
   160  
   161      Then the market data for the market "BTC/ETH" should be:
   162        | mark price | trading mode            | auction trigger             | target stake | supplied stake |
   163        | 15         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 20           | 20             |
   164  
   165      When the parties submit the following liquidity provision:
   166        | id  | party  | market id | commitment amount | fee | lp type   |
   167        | lp1 | lpprov | BTC/ETH   | 1                 | 0.1 | amendment |
   168  
   169      Then the network moves ahead "7" blocks
   170      Then the market data for the market "BTC/ETH" should be:
   171        | mark price | trading mode            | auction trigger             | target stake | supplied stake |
   172        | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 20 | 2 |
   173  
   174      And the network treasury balance should be "9" for the asset "ETH"
   175      And the global insurance pool balance should be "0" for the asset "ETH"
   176      And the global insurance pool balance should be "0" for the asset "BTC"
   177      And the party "lpprov" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
   178      Then "lpprov" should have holding account balance of "1200" for asset "ETH"
   179      Then "lpprov" should have general account balance of "2804" for asset "ETH"
   180  
   181      Then "lpprov" should have holding account balance of "60" for asset "BTC"
   182      Then "lpprov" should have general account balance of "0" for asset "BTC"
   183      Then the party "lpprov" lp liquidity bond account balance should be "2" for the market "BTC/ETH"
   184