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

     1  Feature: Spot market
     2  
     3    Scenario: 0044-LIME-078,parked pegged order in spot market
     4  
     5      Given time is updated to "2023-07-20T00:00:00Z"
     6  
     7      Given the fees configuration named "fees-config-1":
     8        | maker fee | infrastructure fee |
     9        | 0         | 0                  |
    10      Given the log normal risk model named "lognormal-risk-model-1":
    11        | risk aversion | tau  | mu | r   | sigma |
    12        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    13  
    14      And the price monitoring named "price-monitoring-1":
    15        | horizon | probability | auction extension |
    16        | 36000   | 0.999       | 300               |
    17  
    18      And the liquidity sla params named "SLA-1":
    19        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    20        | 1           | 0.6                          | 2                             | 0.2                    |
    21  
    22      Given the following assets are registered:
    23        | id  | decimal places |
    24        | ETH | 1              |
    25        | BTC | 1              |
    26  
    27      And the following network parameters are set:
    28        | name                                                | value |
    29        | network.markPriceUpdateMaximumFrequency             | 2s    |
    30        | market.liquidity.earlyExitPenalty                   | 0.25  |
    31        | market.liquidity.bondPenaltyParameter               | 0.2   |
    32        | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7   |
    33        | market.liquidity.sla.nonPerformanceBondPenaltyMax   | 0.6   |
    34        | market.liquidity.maximumLiquidityFeeFactorLevel     | 0.4   |
    35        | validators.epoch.length                             | 10s   |
    36  
    37      And the spot markets:
    38        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | sla params |
    39        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | SLA-1      |
    40      And the following network parameters are set:
    41        | name                                             | value |
    42        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    43        | market.liquidity.stakeToCcyVolume                | 1     |
    44        | limits.markets.maxPeggedOrders                   | 10    |
    45  
    46      Given the parties deposit on asset's general account the following amount:
    47        | party  | asset | amount |
    48        | party1 | ETH   | 10000  |
    49        | party2 | BTC   | 500    |
    50        | lp1    | ETH   | 40000  |
    51        | lp1    | BTC   | 2000   |
    52        | lp2    | ETH   | 4000   |
    53        | lp2    | BTC   | 60     |
    54  
    55      And the average block duration is "1"
    56  
    57      Given the liquidity monitoring parameters:
    58        | name               | triggering ratio | time window | scaling factor |
    59        | updated-lqm-params | 0.2              | 20s         | 0.8            |
    60  
    61      When the spot markets are updated:
    62        | id      | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    63        | BTC/ETH | updated-lqm-params   | 0.5                    | 0.5                       |
    64  
    65      When the parties submit the following liquidity provision:
    66        | id  | party | market id | commitment amount | fee | lp type    |
    67        | lp1 | lp1   | BTC/ETH   | 1000              | 0.1 | submission |
    68  
    69      Then the network moves ahead "4" blocks
    70      And the network treasury balance should be "0" for the asset "ETH"
    71      And the global insurance pool balance should be "0" for the asset "ETH"
    72      And the global insurance pool balance should be "0" for the asset "BTC"
    73      And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
    74      Then the party "lp1" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    75  
    76      And the parties place the following orders:
    77        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference    | only |
    78        | party1 | BTC/ETH   | buy  | 6      | 8     | 0                | TYPE_LIMIT | TIF_GTC | party-order5 |      |
    79        | party1 | BTC/ETH   | buy  | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order3 |      |
    80        | party2 | BTC/ETH   | sell | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order4 |      |
    81        | party2 | BTC/ETH   | sell | 6      | 24    | 0                | TYPE_LIMIT | TIF_GTC | party-order6 |      |
    82  
    83      Then the network moves ahead "1" blocks
    84  
    85      Then the following trades should be executed:
    86        | buyer  | price | size | seller |
    87        | party1 | 15    | 1    | party2 |
    88  
    89      Then "lp1" should have general account balance of "39000" for asset "ETH"
    90      Then the party "lp1" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    91      Then "lp1" should have general account balance of "2000" for asset "BTC"
    92  
    93      And the parties place the following pegged orders:
    94        | party | market id | side | volume | pegged reference | offset | reference |
    95        | lp1   | BTC/ETH   | buy  | 600    | BID              | 3      | lp1-b     |
    96        | lp1   | BTC/ETH   | sell | 120    | ASK              | 96     | lp1-s     |
    97  
    98      #0011-MARA-031,In Spot market, holding in holding account is correctly calculated for all order types in  auction mode pegged GTT (parked in auction * )
    99      Then "lp1" should have holding account balance of "30000" for asset "ETH"
   100      Then "lp1" should have general account balance of "9000" for asset "ETH"
   101      Then "lp1" should have holding account balance of "1200" for asset "BTC"
   102      Then "lp1" should have general account balance of "800" for asset "BTC"
   103  
   104      Then the market data for the market "BTC/ETH" should be:
   105        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake |
   106        | 15         | TRADING_MODE_CONTINUOUS | 36000   | 14        | 17        | 800          | 1000           |
   107  
   108      And the parties place the following orders:
   109        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   110        | party1 | BTC/ETH   | buy  | 1      | 13    | 0                | TYPE_LIMIT | TIF_GTC |
   111        | party2 | BTC/ETH   | sell | 1      | 13    | 0                | TYPE_LIMIT | TIF_GTC |
   112  
   113      Then the market data for the market "BTC/ETH" should be:
   114        | mark price | trading mode                    |
   115        | 15         | TRADING_MODE_MONITORING_AUCTION |
   116  
   117      Then the orders should have the following status:
   118        | party | reference | status         |
   119        | lp1   | lp1-b     | STATUS_STOPPED |
   120        | lp1   | lp1-s     | STATUS_PARKED  |
   121  
   122      # 0068-MATC-091:An update to an order that is not [ACTIVE or PARKED](Stopped, Cancelled, Expired, Filled) will be rejected
   123      When the parties amend the following orders:
   124        | party | reference | price | size delta | tif     | error                        |
   125        | lp1   | lp1-b     | 5     | 3          | TIF_GTC | OrderError: Invalid Order ID |
   126        | lp1   | lp1-s     | 25    | 3          | TIF_GTC | invalid OrderError           |
   127  
   128      Then "lp1" should have holding account balance of "0" for asset "ETH"
   129      Then "lp1" should have general account balance of "39000" for asset "ETH"
   130      Then "lp1" should have holding account balance of "0" for asset "BTC"
   131      Then "lp1" should have general account balance of "2000" for asset "BTC"
   132  
   133      Then the network moves ahead "12" blocks
   134      Then the market data for the market "BTC/ETH" should be:
   135        | mark price | trading mode                    |
   136        | 15         | TRADING_MODE_MONITORING_AUCTION |
   137  
   138      And the network treasury balance should be "600" for the asset "ETH"
   139  
   140      And the parties place the following orders:
   141        | party | market id | side | volume | price | resulting trades | type       | tif     | reference | only |
   142        | lp1   | BTC/ETH   | buy  | 600    | 5     | 0                | TYPE_LIMIT | TIF_GFA | lp1-b     |      |
   143        | lp1   | BTC/ETH   | sell | 120    | 25    | 0                | TYPE_LIMIT | TIF_GFA | lp1-s     |      |
   144  
   145      Then the network moves ahead "12" blocks
   146      Then the market data for the market "BTC/ETH" should be:
   147        | mark price | trading mode                    |
   148        | 15         | TRADING_MODE_MONITORING_AUCTION |
   149  
   150      And the network treasury balance should be "600" for the asset "ETH"
   151  
   152  
   153