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

     1  Feature: Spot market
     2  
     3    Scenario: 0044-LIME-080, 0044-LIME-082, GFA 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  
    45      Given the parties deposit on asset's general account the following amount:
    46        | party  | asset | amount |
    47        | party1 | ETH   | 10000  |
    48        | party2 | BTC   | 500    |
    49        | lp1    | ETH   | 40000  |
    50        | lp1    | BTC   | 2000   |
    51        | lp2    | ETH   | 4000   |
    52        | lp2    | BTC   | 60     |
    53  
    54      And the average block duration is "1"
    55  
    56      Given the liquidity monitoring parameters:
    57        | name               | triggering ratio | time window | scaling factor |
    58        | updated-lqm-params | 0.2              | 20s         | 0.8            |
    59  
    60      When the spot markets are updated:
    61        | id      | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    62        | BTC/ETH | updated-lqm-params   | 0.5                    | 0.5                       |
    63  
    64      When the parties submit the following liquidity provision:
    65        | id  | party | market id | commitment amount | fee | lp type    |
    66        | lp1 | lp1   | BTC/ETH   | 1000              | 0.1 | submission |
    67  
    68      Then the network moves ahead "4" blocks
    69      And the network treasury balance should be "0" for the asset "ETH"
    70      And the global insurance pool balance should be "0" for the asset "ETH"
    71      And the global insurance pool balance should be "0" for the asset "BTC"
    72      And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
    73      Then the party "lp1" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    74  
    75      And the parties place the following orders:
    76        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference    | only |
    77        | lp1    | BTC/ETH   | buy  | 600    | 5     | 0                | TYPE_LIMIT | TIF_GFA | lp1-b        |      |
    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        | lp1    | BTC/ETH   | sell | 120    | 25    | 0                | TYPE_LIMIT | TIF_GFA | lp1-s        |      |
    83  
    84      Then the network moves ahead "1" blocks
    85      # Then the opening auction period ends for market "BTC/ETH"
    86  
    87      Then the following trades should be executed:
    88        | buyer  | price | size | seller |
    89        | party1 | 15    | 1    | party2 |
    90  
    91      Then the orders should have the following status:
    92        | party | reference | status           |
    93        | lp1   | lp1-b     | STATUS_CANCELLED |
    94        | lp1   | lp1-s     | STATUS_CANCELLED |
    95  
    96      Then "lp1" should have holding account balance of "0" for asset "ETH"
    97      Then "lp1" should have general account balance of "39000" for asset "ETH"
    98      Then the party "lp1" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    99      Then "lp1" should have holding account balance of "0" for asset "BTC"
   100      Then "lp1" should have general account balance of "2000" for asset "BTC"
   101  
   102        | party | market id | side | volume | price | resulting trades | type       | tif     | reference | only |
   103        | lp1   | BTC/ETH   | buy  | 600    | 5     | 0                | TYPE_LIMIT | TIF_GFA | lp1-b     |      |
   104        | lp1   | BTC/ETH   | sell | 120    | 25    | 0                | TYPE_LIMIT | TIF_GFA | lp1-s     |      |
   105      Then the network moves ahead "11" blocks
   106      And the network treasury balance should be "600" for the asset "ETH"
   107      Then the orders should have the following status:
   108        | party | reference | status           |
   109        | lp1   | lp1-b     | STATUS_CANCELLED |
   110        | lp1   | lp1-s     | STATUS_CANCELLED |
   111  
   112      Then the market data for the market "BTC/ETH" should be:
   113        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake |
   114        | 15         | TRADING_MODE_CONTINUOUS | 36000   | 14        | 17        | 800          | 400            |
   115  
   116      And the parties place the following orders:
   117        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   118        | party1 | BTC/ETH   | buy  | 1      | 13    | 0                | TYPE_LIMIT | TIF_GTC |
   119        | party2 | BTC/ETH   | sell | 1      | 13    | 0                | TYPE_LIMIT | TIF_GTC |
   120  
   121      Then the market data for the market "BTC/ETH" should be:
   122        | mark price | trading mode                    |
   123        | 15         | TRADING_MODE_MONITORING_AUCTION |
   124  
   125      And the parties place the following orders:
   126        | party | market id | side | volume | price | resulting trades | type       | tif     | reference | only |
   127        | lp1   | BTC/ETH   | buy  | 600    | 5     | 0                | TYPE_LIMIT | TIF_GFA | lp1-b     |      |
   128        | lp1   | BTC/ETH   | sell | 120    | 25    | 0                | TYPE_LIMIT | TIF_GFA | lp1-s     |      |
   129  
   130      Then the network moves ahead "12" blocks
   131      Then the market data for the market "BTC/ETH" should be:
   132        | mark price | trading mode                    |
   133        | 15         | TRADING_MODE_MONITORING_AUCTION |
   134  
   135      #0044-LIME-080, GFA order in spot market during auction counts toward LP commitment
   136      And the network treasury balance should be "600" for the asset "ETH"
   137  
   138  
   139