code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/verify-CcySiska.feature (about)

     1  Feature: check the impact from change of market parameter: market.liquidity.stakeToCcyVolume
     2    Background:
     3      Given time is updated to "2020-11-30T00:00:00Z"
     4  
     5      And the log normal risk model named "log-normal-risk-model-1":
     6        | risk aversion | tau | mu | r | sigma |
     7        | 0.000001      | 0.1 | 0  | 0 | 1.0   |
     8      And the oracle spec for settlement data filtering data from "0xCAFECAFE1" named "ethDec21Oracle":
     9        | property         | type         | binding         |
    10        | prices.ETH.value | TYPE_INTEGER | settlement data |
    11      And the oracle spec for trading termination filtering data from "0xCAFECAFE1" named "ethDec21Oracle":
    12        | property           | type         | binding             |
    13        | trading.terminated | TYPE_BOOLEAN | trading termination |
    14  
    15      And the fees configuration named "fees-config-1":
    16        | maker fee | infrastructure fee |
    17        | 0         | 0                  |
    18      And the price monitoring named "price-monitoring-1":
    19        | horizon | probability | auction extension |
    20        | 1000    | 0.99        | 300               |
    21      And the following network parameters are set:
    22        | name                                          | value |
    23        | market.liquidity.bondPenaltyParameter       | 0.2   |
    24        | network.markPriceUpdateMaximumFrequency       | 0s    |
    25        | limits.markets.maxPeggedOrders                | 6     |
    26       And the liquidity monitoring parameters:
    27        | name               | triggering ratio | time window | scaling factor |
    28        | lqm-params         | 0.10             | 24h         | 1              |  
    29       And the liquidity sla params named "SLA":
    30        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    31        | 0.014       | 0.5                          | 1                             | 1.0                    |
    32      And the markets:
    33        | 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 |
    34        | ETH/MAR22 | ETH        | USD   | lqm-params           | log-normal-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | ethDec21Oracle     | 0.25                   | 0                         | SLA        |
    35      And the parties deposit on asset's general account the following amount:
    36        | party  | asset | amount    |
    37        | party0 | USD   | 500000000 |
    38        | party1 | USD   | 100000000 |
    39        | party2 | USD   | 100000000 |
    40        | party3 | USD   | 100000000 |
    41      And the average block duration is "1"
    42      And the parties place the following orders with ticks:
    43        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference  |
    44        | party1 | ETH/MAR22 | buy  | 1      | 900   | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-1  |
    45        | party1 | ETH/MAR22 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-1  |
    46        | party1 | ETH/MAR22 | buy  | 50     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-2  |
    47        | party2 | ETH/MAR22 | sell | 50     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-3 |
    48        | party2 | ETH/MAR22 | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-1 |
    49        | party2 | ETH/MAR22 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-2 |
    50  
    51    Scenario: 001, market.liquidity.stakeToCcyVolume=2, 0007-POSN-010, 0013-ACCT-020
    52      Given the following network parameters are set:
    53        | name                                | value |
    54        | market.liquidity.stakeToCcyVolume | 2     |
    55      And the parties submit the following liquidity provision:
    56        | id  | party  | market id | commitment amount | fee | lp type    |
    57        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | submission |
    58        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | amendment  |
    59      And the parties place the following pegged iceberg orders:
    60        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    61        | party0 | ETH/MAR22 | 9862      | 1                    | sell | ASK              | 9862   | 4      |
    62        | party0 | ETH/MAR22 | 10142     | 1                    | buy  | BID              | 10142  | 4      |
    63   
    64      # party1 :=  buy order volume * vwap * rf_long  = (900  + 990  + 50 * 1000) * 0.8007282079844139 =  41549.786712311237271
    65      # party2 := sell order volume * vwap * rf_short = (1100 + 1010 + 50 * 1000) * 3.556903591579342  = 185350.246157199511620
    66      Then the parties should have the following margin levels:
    67        | party  | market id | maintenance | initial  |
    68        | party1 | ETH/MAR22 | 41550       | 49860    |
    69        | party2 | ETH/MAR22 | 185351      | 222421   |
    70  
    71      When the opening auction period ends for market "ETH/MAR22"
    72      Then the auction ends with a traded volume of "50" at a price of "1000"
    73      And the insurance pool balance should be "0" for the market "ETH/MAR22"
    74      And the market data for the market "ETH/MAR22" should be:
    75        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest | best static bid price | best static offer price |
    76        | 1000       | TRADING_MODE_CONTINUOUS | 1000    | 986       | 1014      | 177845       | 5000000        | 50            | 990                   | 1010                    |
    77  
    78      #check the volume on the order book
    79      Then the order book should have the following volumes for market "ETH/MAR22":
    80        | side | price | volume |
    81        | sell | 1100  | 1      |
    82        | sell | 1014  | 9862   |
    83        | sell | 1010  | 1      |
    84        | sell | 1000  | 0      |
    85        | buy  | 1000  | 0      |
    86        | buy  | 990   | 1      |
    87        | buy  | 986   | 10142  |
    88        | buy  | 900   | 1      |
    89  
    90      #check position (party0 has no position)
    91      Then the parties should have the following profit and loss:
    92        | party  | volume | unrealised pnl | realised pnl |
    93        | party1 | 50     | 0              | 0            |
    94        | party2 | -50    | 0              | 0            |
    95  
    96      Then the parties should have the following margin levels:
    97        | party  | market id | maintenance |
    98        | party0 | ETH/MAR22 | 35078184    |
    99        | party1 | ETH/MAR22 | 54138       |
   100        | party2 | ETH/MAR22 | 197459      |
   101  
   102      Then the parties should have the following account balances:
   103        | party  | asset | market id | margin   | general   |
   104        | party0 | USD   | ETH/MAR22 | 42093820 | 452906180 |
   105        | party1 | USD   | ETH/MAR22 | 64965    | 99935035  |
   106        | party2 | USD   | ETH/MAR22 | 222421   | 99777579  |
   107  
   108      When the parties place the following orders with ticks:
   109        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
   110        | party1 | ETH/MAR22 | buy  | 2      | 1014  | 2                | TYPE_LIMIT | TIF_GTC | buy-p1-2  |
   111  
   112      Then the parties should have the following profit and loss:
   113        | party  | volume | unrealised pnl | realised pnl |
   114        | party0 | -1     | 0              | 0            |
   115        | party1 | 52     | 704            | 0            |
   116        | party2 | -51    | -704           | 0            |
   117  
   118    Scenario: 002, market.liquidity.stakeToCcyVolume=0.5,
   119      Given the following network parameters are set:
   120        | name                                | value |
   121        | market.liquidity.stakeToCcyVolume | 0.5   |
   122      And the parties submit the following liquidity provision:
   123        | id  | party  | market id | commitment amount | fee | lp type    |
   124        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | submission |
   125        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | amendment  |
   126      And the parties place the following pegged iceberg orders:
   127        | party  | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
   128        | party0 | ETH/MAR22 | 2466      | 1                    | sell | ASK              | 2466   | 4      |
   129        | party0 | ETH/MAR22 | 2536      | 1                    | buy  | BID              | 2536   | 4      |
   130  
   131      When the opening auction period ends for market "ETH/MAR22"
   132      Then the auction ends with a traded volume of "50" at a price of "1000"
   133      # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 10 x 1 x 0.1
   134      And the insurance pool balance should be "0" for the market "ETH/MAR22"
   135      And the market data for the market "ETH/MAR22" should be:
   136        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   137        | 1000       | TRADING_MODE_CONTINUOUS | 1000    | 986       | 1014      | 177845       | 5000000        | 50            |
   138  
   139      #check the volume on the order book
   140      Then the order book should have the following volumes for market "ETH/MAR22":
   141        | side | price | volume |
   142        | sell | 1100  | 1      |
   143        | sell | 1014  | 2466   |
   144        | sell | 1010  | 1      |
   145        | sell | 1000  | 0      | 
   146        | buy  | 1000  | 0      |
   147        | buy  | 990   | 1      |
   148        | buy  | 986   | 2536   |
   149        | buy  | 900   | 1      |
   150  
   151      #check position (party0 has no position)
   152      Then the parties should have the following profit and loss:
   153        | party  | volume | unrealised pnl | realised pnl |
   154        | party1 | 50     | 0              | 0            |
   155        | party2 | -50    | 0              | 0            |
   156  
   157      Then the parties should have the following margin levels:
   158        | party  | market id | maintenance |
   159        | party0 | ETH/MAR22 | 8771325     |
   160        | party1 | ETH/MAR22 | 54138       |
   161        | party2 | ETH/MAR22 | 197459      |
   162  
   163      Then the parties should have the following account balances:
   164        | party  | asset | market id | margin   | general   |
   165        | party0 | USD   | ETH/MAR22 | 10525590 | 484474410 |
   166        | party1 | USD   | ETH/MAR22 | 64965    | 99935035  |
   167        | party2 | USD   | ETH/MAR22 | 222421   | 99777579  |
   168  
   169      When the parties place the following orders with ticks:
   170        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
   171        | party1 | ETH/MAR22 | buy  | 2      | 1014  | 2                | TYPE_LIMIT | TIF_GTC | buy-p1-2  |
   172  
   173      Then the parties should have the following profit and loss:
   174        | party  | volume | unrealised pnl | realised pnl |
   175        | party0 | -1     | 0              | 0            |
   176        | party1 | 52     | 704            | 0            |
   177        | party2 | -51    | -704           | 0            |
   178  
   179    Scenario: 003, market.liquidity.stakeToCcyVolume=0
   180      Given the following network parameters are set:
   181        | name                                | value |
   182        | market.liquidity.stakeToCcyVolume | 0     |
   183      And the parties place the following orders with ticks:
   184        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   185        | party1 | ETH/MAR22 | buy  | 10000  | 900   | 0                | TYPE_LIMIT | TIF_GTC |
   186        | party2 | ETH/MAR22 | sell | 10000  | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
   187      And the parties submit the following liquidity provision:
   188        | id  | party  | market id | commitment amount | fee | lp type    |
   189        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | submission |
   190        | lp1 | party0 | ETH/MAR22 | 5000000           | 0   | amendment  |
   191      And the parties place the following pegged iceberg orders:
   192        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   193        | party0 | ETH/MAR22 | 2         | 1                    | sell | ASK              | 500        | 20     |
   194        | party0 | ETH/MAR22 | 2         | 1                    | buy  | BID              | 500        | 20     |
   195  
   196      When the opening auction period ends for market "ETH/MAR22"
   197      Then the auction ends with a traded volume of "50" at a price of "1000"
   198      # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 10 x 1 x 0.1
   199      And the insurance pool balance should be "0" for the market "ETH/MAR22"
   200      And the market data for the market "ETH/MAR22" should be:
   201        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   202        | 1000       | TRADING_MODE_CONTINUOUS | 1000    | 986       | 1014      | 177845       | 5000000        | 50            |
   203  
   204      #check the volume on the order book
   205      Then the order book should have the following volumes for market "ETH/MAR22":
   206        | side | price | volume |
   207        | sell | 1100  | 10001  |
   208        | sell | 1014  | 0      |
   209        | sell | 1010  | 1      |
   210        | sell | 1000  | 0      |
   211        | buy  | 1000  | 0      |
   212        | buy  | 990   | 1      |
   213        | buy  | 986   | 0      |
   214        | buy  | 900   | 10001  |
   215  
   216  
   217    Scenario: 004, market.liquidity.stakeToCcyVolume=0, 3 LPs make commitment, 0044-LIME-012
   218      Given the parties deposit on asset's general account the following amount:
   219        | party   | asset | amount    |
   220        | party00 | USD   | 500000000 |
   221        | party01 | USD   | 500000000 |
   222        | party02 | USD   | 500000000 |
   223      And the following network parameters are set:
   224        | name                                | value |
   225        | market.liquidity.stakeToCcyVolume | 0     |
   226       And the parties place the following orders with ticks:
   227        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   228        | party1 | ETH/MAR22 | buy  | 10000  | 900   | 0                | TYPE_LIMIT | TIF_GTC |
   229        | party2 | ETH/MAR22 | sell | 10000  | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
   230      And the parties submit the following liquidity provision:
   231        | id  | party   | market id | commitment amount | fee  | lp type    |
   232        | lp1 | party00 | ETH/MAR22 | 17784             | 0.01 | submission |
   233        | lp1 | party00 | ETH/MAR22 | 17784             | 0.01 | amendment  |
   234        | lp2 | party01 | ETH/MAR22 | 177845            | 0.02 | submission |
   235        | lp2 | party01 | ETH/MAR22 | 177845            | 0.02 | amendment  |
   236        | lp3 | party02 | ETH/MAR22 | 27784             | 0.03 | submission |
   237        | lp3 | party02 | ETH/MAR22 | 27784             | 0.03 | amendment  |
   238  
   239      And the parties place the following pegged iceberg orders:
   240        | party   | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   241        | party00 | ETH/MAR22 | 2         | 1                    | sell | ASK              | 500        | 20     |
   242        | party00 | ETH/MAR22 | 2         | 1                    | buy  | BID              | 500        | 20     |
   243        | party01 | ETH/MAR22 | 2         | 1                    | sell | ASK              | 500        | 20     |
   244        | party01 | ETH/MAR22 | 2         | 1                    | buy  | BID              | 500        | 20     |
   245        | party02 | ETH/MAR22 | 2         | 1                    | sell | ASK              | 500        | 20     |
   246        | party02 | ETH/MAR22 | 2         | 1                    | buy  | BID              | 500        | 20     |
   247  
   248      When the opening auction period ends for market "ETH/MAR22"
   249      Then the auction ends with a traded volume of "50" at a price of "1000"
   250      # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1000 x 10 x 1 x 0.1
   251      And the insurance pool balance should be "0" for the market "ETH/MAR22"
   252      And the market data for the market "ETH/MAR22" should be:
   253        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   254        | 1000       | TRADING_MODE_CONTINUOUS | 1000    | 986       | 1014      | 177845       | 223413         | 50            |
   255  
   256      #check the volume on the order book
   257      Then the order book should have the following volumes for market "ETH/MAR22":
   258        | side | price | volume |
   259        | sell | 1100  | 10001  |
   260        | sell | 1014  | 0      |
   261        | sell | 1010  | 1      |
   262        | sell | 1000  | 0      |
   263        | buy  | 1000  | 0      |
   264        | buy  | 990   | 1      |
   265        | buy  | 986   | 0      |
   266        | buy  | 900   | 10001  |    
   267      And the liquidity fee factor should be "0.02" for the market "ETH/MAR22"