code.vegaprotocol.io/vega@v0.79.0/core/integration/features/amm/0090-VAMM-028.feature (about)

     1  Feature: Ensure the vAMM positions follow the market correctly
     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.1   |
    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.5         | 0.6                          | 1                             | 1.0                    |
    46  
    47      # Create 2 identical markets, one will be used to test moving the mid price in steps of one, the other will do the same in a single trade.
    48      And the markets:
    49        | 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 |
    50        | 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     |
    51        | ETH/MAR23 | 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     |
    52  
    53      # Setting up the accounts and vAMM submission now is part of the background, because we'll be running scenarios 0090-VAMM-006 through 0090-VAMM-014 on this setup
    54      Given the parties deposit on asset's general account the following amount:
    55        | party  | asset | amount  |
    56        | lp1    | USD   | 1000000 |
    57        | lp2    | USD   | 1000000 |
    58        | lp3    | USD   | 1000000 |
    59        | lp4    | USD   | 1000000 |
    60        | party1 | USD   | 1000000 |
    61        | party2 | USD   | 1000000 |
    62        | party3 | USD   | 1000000 |
    63        | party4 | USD   | 1000000 |
    64        | party5 | USD   | 1000000 |
    65        | party6 | USD   | 1000000 |
    66        | vamm1  | USD   | 1000000 |
    67        | vamm2  | USD   | 1000000 |
    68  
    69      When the parties submit the following liquidity provision:
    70        | id   | party | market id | commitment amount | fee   | lp type    |
    71        | lp_1 | lp1   | ETH/MAR22 | 600               | 0.02  | submission |
    72        | lp_2 | lp2   | ETH/MAR22 | 400               | 0.015 | submission |
    73        | lp_3 | lp3   | ETH/MAR23 | 600               | 0.02  | submission |
    74        | lp_4 | lp4   | ETH/MAR23 | 400               | 0.015 | submission |
    75      Then the network moves ahead "4" blocks
    76      And the current epoch is "0"
    77  
    78      And the parties place the following orders:
    79        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    80        | lp1    | ETH/MAR22 | buy  | 20     | 40    | 0                | TYPE_LIMIT | TIF_GTC | lp1-b     |
    81        | lp3    | ETH/MAR23 | buy  | 20     | 40    | 0                | TYPE_LIMIT | TIF_GTC | lp3-b     |
    82        | party1 | ETH/MAR22 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    83        | party3 | ETH/MAR23 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    84        | party2 | ETH/MAR22 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    85        | party4 | ETH/MAR23 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |           |
    86        | lp1    | ETH/MAR22 | sell | 10     | 160   | 0                | TYPE_LIMIT | TIF_GTC | lp1-s     |
    87        | lp3    | ETH/MAR23 | sell | 10     | 160   | 0                | TYPE_LIMIT | TIF_GTC | lp3-s     |
    88      When the opening auction period ends for market "ETH/MAR22"
    89      Then the following trades should be executed:
    90        | buyer  | price | size | seller |
    91        | party1 | 100   | 1    | party2 |
    92        | party3 | 100   | 1    | party4 |
    93      And the market data for the market "ETH/MAR22" should be:
    94        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price |
    95        | 100        | TRADING_MODE_CONTINUOUS | 39           | 1000           | 1             | 100       | 100       | 100              |
    96      And the market data for the market "ETH/MAR23" should be:
    97        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price |
    98        | 100        | TRADING_MODE_CONTINUOUS | 39           | 1000           | 1             | 100       | 100       | 100              |
    99  
   100      When the parties submit the following AMM:
   101        | party | market id | amount | slippage | base | lower bound | upper bound | lower leverage | upper leverage | proposed fee |
   102        | vamm1 | ETH/MAR22 | 100000 | 0.1      | 100  | 85          | 150         | 4              | 4              | 0.01         |
   103        | vamm2 | ETH/MAR23 | 100000 | 0.1      | 100  | 85          | 150         | 4              | 4              | 0.01         |
   104      Then the AMM pool status should be:
   105        | party | market id | amount | status        | base | lower bound | upper bound | lower leverage | upper leverage |
   106        | vamm1 | ETH/MAR22 | 100000 | STATUS_ACTIVE | 100  | 85          | 150         | 4              | 4              |
   107        | vamm2 | ETH/MAR23 | 100000 | STATUS_ACTIVE | 100  | 85          | 150         | 4              | 4              |
   108  
   109      And set the following AMM sub account aliases:
   110        | party | market id | alias    |
   111        | vamm1 | ETH/MAR22 | vamm1-id |
   112        | vamm2 | ETH/MAR23 | vamm2-id |
   113      And the following transfers should happen:
   114        | from  | from account         | to       | to account           | market id | amount | asset | is amm | type                  |
   115        | vamm1 | ACCOUNT_TYPE_GENERAL | vamm1-id | ACCOUNT_TYPE_GENERAL |           | 100000 | USD   | true   | TRANSFER_TYPE_AMM_LOW |
   116        | vamm2 | ACCOUNT_TYPE_GENERAL | vamm2-id | ACCOUNT_TYPE_GENERAL |           | 100000 | USD   | true   | TRANSFER_TYPE_AMM_LOW |
   117  
   118    @VAMM
   119    Scenario: 0090-VAMM-028: The volume quoted to move from price 100 to price 110 in one step is the same as the sum of the volumes to move in 10 steps of 1.
   120      # Move mid price to 110 in one go. A volume of 74 is the minimum required, with 73 we only get to 109
   121      When the parties place the following orders:
   122        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   123        | party5 | ETH/MAR22 | buy  | 74     | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   124      Then the market data for the market "ETH/MAR22" should be:
   125        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   126        | 100        | TRADING_MODE_CONTINUOUS | 2999         | 1000           | 75            | 100       | 110       | 110              | 111              | 109            |
   127      And the following trades should be executed:
   128        | buyer  | price | size | seller   | is amm |
   129        | party5 | 104   | 74   | vamm1-id | true   |
   130      # Check vAMM position
   131      When the network moves ahead "1" blocks
   132  	Then the parties should have the following profit and loss:
   133        | party    | volume | unrealised pnl | realised pnl | is amm |
   134        | party1   | 1      | 4              | 0            |        |
   135        | party2   | -1     | -4             | 0            |        |
   136        | party5   | 74     | 0              | 0            |        |
   137        | vamm1-id | -74    | 0              | 0            | true   |
   138  
   139      # Now do the same thing as above, only for ETH/MAR23
   140      # Move mid price to 101
   141      When the parties place the following orders:
   142        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   143        | party6 | ETH/MAR23 | buy  | 1      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   144      Then the market data for the market "ETH/MAR23" should be:
   145        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   146        | 100        | TRADING_MODE_CONTINUOUS | 79           | 1000           | 2             | 100       | 101       | 101              | 102              | 100            |
   147      And the following trades should be executed:
   148        | buyer  | price | size | seller   | is amm |
   149        | party6 | 100   | 1    | vamm2-id | true   |
   150  
   151      # Move mid price to 102
   152      When the parties place the following orders:
   153        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   154        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   155      Then the market data for the market "ETH/MAR23" should be:
   156        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   157        | 100        | TRADING_MODE_CONTINUOUS | 399          | 1000           | 10            | 100       | 102       | 102              | 103              | 101            |
   158      And the following trades should be executed:
   159        | buyer  | price | size | seller   | is amm |
   160        | party6 | 101   | 8    | vamm2-id | true   |
   161  
   162      # Move mid price to 103
   163      When the parties place the following orders:
   164        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   165        | party6 | ETH/MAR23 | buy  | 9      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   166      Then the market data for the market "ETH/MAR23" should be:
   167        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   168        | 100        | TRADING_MODE_CONTINUOUS | 759          | 1000           | 19            | 100       | 103       | 103              | 104              | 102            |
   169      And the following trades should be executed:
   170        | buyer  | price | size | seller   | is amm |
   171        | party6 | 102   | 9    | vamm2-id | true   |
   172  
   173      # Move mid price to 104
   174      When the parties place the following orders:
   175        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   176        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   177      Then the market data for the market "ETH/MAR23" should be:
   178        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   179        | 100        | TRADING_MODE_CONTINUOUS | 1079         | 1000           | 27            | 100       | 104       | 104              | 105              | 103            |
   180      And the following trades should be executed:
   181        | buyer  | price | size | seller   | is amm |
   182        | party6 | 103   | 8    | vamm2-id | true   |
   183  
   184      # Move mid price to 105
   185      When the parties place the following orders:
   186        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   187        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   188      Then the market data for the market "ETH/MAR23" should be:
   189        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   190        | 100        | TRADING_MODE_CONTINUOUS | 1399         | 1000           | 35            | 100       | 105       | 105              | 106              | 104            |
   191      And the following trades should be executed:
   192        | buyer  | price | size | seller   | is amm |
   193        | party6 | 104   | 8    | vamm2-id | true   |
   194  
   195      # Move mid price to 106
   196      When the parties place the following orders:
   197        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   198        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   199      Then the market data for the market "ETH/MAR23" should be:
   200        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   201        | 100        | TRADING_MODE_CONTINUOUS | 1719         | 1000           | 43            | 100       | 106       | 106              | 107              | 105            |
   202      And the following trades should be executed:
   203        | buyer  | price | size | seller   | is amm |
   204        | party6 | 105   | 8    | vamm2-id | true   |
   205  
   206      # Move mid price to 107
   207      When the parties place the following orders:
   208        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   209        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   210      Then the market data for the market "ETH/MAR23" should be:
   211        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   212        | 100        | TRADING_MODE_CONTINUOUS | 2039         | 1000           | 51            | 100       | 107       | 107              | 108              | 106            |
   213      And the following trades should be executed:
   214        | buyer  | price | size | seller   | is amm |
   215        | party6 | 106   | 8    | vamm2-id | true   |
   216  
   217      # Move mid price to 108
   218      When the parties place the following orders:
   219        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   220        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   221      Then the market data for the market "ETH/MAR23" should be:
   222        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   223        | 100        | TRADING_MODE_CONTINUOUS | 2359         | 1000           | 59            | 100       | 108       | 108              | 109              | 107            |
   224      And the following trades should be executed:
   225        | buyer  | price | size | seller   | is amm |
   226        | party6 | 107   | 8    | vamm2-id | true   |
   227  
   228      # Move mid price to 109
   229      When the parties place the following orders:
   230        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   231        | party6 | ETH/MAR23 | buy  | 8      | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   232      Then the market data for the market "ETH/MAR23" should be:
   233        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   234        | 100        | TRADING_MODE_CONTINUOUS | 2679         | 1000           | 67            | 100       | 109       | 109              | 110              | 108            |
   235      And the following trades should be executed:
   236        | buyer  | price | size | seller   | is amm |
   237        | party6 | 108   | 8    | vamm2-id | true   |
   238  
   239      # Finally, move to 110, the volume should be the same, so open interest should be 75 -> + 8
   240      When the parties place the following orders:
   241        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   242        | party6 | ETH/MAR23 | buy  | 8      | 111   | 1                | TYPE_LIMIT | TIF_GTC |
   243      Then the market data for the market "ETH/MAR23" should be:
   244        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   245        | 100        | TRADING_MODE_CONTINUOUS | 2999         | 1000           | 75            | 100       | 110       | 110              | 111              | 109            |
   246      And the following trades should be executed:
   247        | buyer  | price | size | seller   | is amm |
   248        | party6 | 109   | 8    | vamm2-id | true   |
   249      
   250      # Confirm the volume matches what we expect, but note the PnL can differ as we have multiple trades at different price-points.
   251      When the network moves ahead "1" blocks
   252  	Then the parties should have the following profit and loss:
   253        | party    | volume | unrealised pnl | realised pnl | is amm |
   254        | party3   | 1      | 9              | 0            |        |
   255        | party4   | -1     | -9             | 0            |        |
   256        | party6   | 74     | 304            | 0            |        |
   257        | vamm2-id | -74    | -304           | 0            | true   |
   258        | vamm1-id | -74    | 0              | 0            | true   |
   259  
   260    @VAMM
   261    Scenario: 0090-VAMM-029: The volume quoted to move from price 100 to price 90 in one step is the same as the sum of the volumes to move in 10 steps of 1.
   262      # Move mid price to 90 in one go. A volume of 347 is the minimum required, 346 only gets us to 91
   263      When the parties place the following orders:
   264        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   265        | party5 | ETH/MAR22 | sell | 347    | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   266      Then the market data for the market "ETH/MAR22" should be:
   267        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   268        | 100        | TRADING_MODE_CONTINUOUS | 13915        | 1000           | 348           | 100       | 90        | 90               | 91               | 89             |
   269      And the following trades should be executed:
   270        | buyer    | price | size | seller | is amm |
   271        | vamm1-id | 95    | 347  | party5 | true   |
   272      # Check vAMM position
   273      When the network moves ahead "1" blocks
   274  	Then the parties should have the following profit and loss:
   275        | party    | volume | unrealised pnl | realised pnl | is amm |
   276        | party1   | 1      | -5             | 0            |        |
   277        | party2   | -1     | 5              | 0            |        |
   278        | party5   | -347   | 0              | 0            |        |
   279        | vamm1-id | 347    | 0              | 0            | true   |
   280  
   281      # Now do the same thing as above, only for ETH/MAR23
   282      # Move mid price to 99
   283      When the parties place the following orders:
   284        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   285        | party6 | ETH/MAR23 | sell | 1      | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   286      Then the market data for the market "ETH/MAR23" should be:
   287        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   288        | 100        | TRADING_MODE_CONTINUOUS | 79           | 1000           | 2             | 100       | 99        | 99               | 100              | 98             |
   289      And the following trades should be executed:
   290        | buyer    | price | size | seller | is amm |
   291        | vamm2-id | 99    | 1    | party6 | true   |
   292  
   293      # Move mid price to 98
   294      When the parties place the following orders:
   295        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   296        | party6 | ETH/MAR23 | sell | 36     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   297      Then the market data for the market "ETH/MAR23" should be:
   298        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   299        | 100        | TRADING_MODE_CONTINUOUS | 1519         | 1000           | 38            | 100       | 98        | 98               | 99               | 97             |
   300      And the following trades should be executed:
   301        | buyer    | price | size | seller | is amm |
   302        | vamm2-id | 98    | 36   | party6 | true   |
   303  
   304      # Move mid price to 97
   305      When the parties place the following orders:
   306        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   307        | party6 | ETH/MAR23 | sell | 36     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   308      Then the market data for the market "ETH/MAR23" should be:
   309        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   310        | 100        | TRADING_MODE_CONTINUOUS | 2959         | 1000           | 74            | 100       | 97        | 97               | 98               | 96             |
   311      And the following trades should be executed:
   312        | buyer    | price | size | seller | is amm |
   313        | vamm2-id | 97    | 36   | party6 | true   |
   314  
   315      # Move mid price to 96
   316      When the parties place the following orders:
   317        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   318        | party6 | ETH/MAR23 | sell | 38     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   319      Then the market data for the market "ETH/MAR23" should be:
   320        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   321        | 100        | TRADING_MODE_CONTINUOUS | 4478         | 1000           | 112           | 100       | 96        | 96               | 97               | 95             |
   322      And the following trades should be executed:
   323        | buyer    | price | size | seller | is amm |
   324        | vamm2-id | 96    | 38   | party6 | true   |
   325  
   326      # Move mid price to 95
   327      When the parties place the following orders:
   328        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   329        | party6 | ETH/MAR23 | sell | 37     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   330      Then the market data for the market "ETH/MAR23" should be:
   331        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   332        | 100        | TRADING_MODE_CONTINUOUS | 5958         | 1000           | 149           | 100       | 95        | 95               | 96               | 94             |
   333      And debug trades
   334      And the following trades should be executed:
   335        | buyer    | price | size | seller | is amm |
   336        | vamm2-id | 95    | 37   | party6 | true   |
   337  
   338      # Move mid price to 94
   339      When the parties place the following orders:
   340        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   341        | party6 | ETH/MAR23 | sell | 39     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   342      Then the market data for the market "ETH/MAR23" should be:
   343        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   344        | 100        | TRADING_MODE_CONTINUOUS | 7517         | 1000           | 188           | 100       | 94        | 94               | 95               | 93             |
   345      And the following trades should be executed:
   346        | buyer    | price | size | seller | is amm |
   347        | vamm2-id | 94    | 39   | party6 | true   |
   348  
   349      # Move mid price to 93
   350      When the parties place the following orders:
   351        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   352        | party6 | ETH/MAR23 | sell | 39     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   353      Then the market data for the market "ETH/MAR23" should be:
   354        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   355        | 100        | TRADING_MODE_CONTINUOUS | 9077         | 1000           | 227           | 100       | 93        | 93               | 94               | 92             |
   356      And the following trades should be executed:
   357        | buyer    | price | size | seller | is amm |
   358        | vamm2-id | 93    | 39   | party6 | true   |
   359  
   360      # Move mid price to 92
   361      When the parties place the following orders:
   362        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   363        | party6 | ETH/MAR23 | sell | 39     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   364      Then the market data for the market "ETH/MAR23" should be:
   365        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   366        | 100        | TRADING_MODE_CONTINUOUS | 10636        | 1000           | 266           | 100       | 92        | 92               | 93               | 91             |
   367      And the following trades should be executed:
   368        | buyer    | price | size | seller | is amm |
   369        | vamm2-id | 92    | 39   | party6 | true   |
   370  
   371      # Move mid price to 91
   372      When the parties place the following orders:
   373        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   374        | party6 | ETH/MAR23 | sell | 41     | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   375      Then the market data for the market "ETH/MAR23" should be:
   376        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   377        | 100        | TRADING_MODE_CONTINUOUS | 12276        | 1000           | 307           | 100       | 91        | 91               | 92               | 90             |
   378      And the following trades should be executed:
   379        | buyer    | price | size | seller | is amm |
   380        | vamm2-id | 91    | 41   | party6 | true   |
   381  
   382      # Move mid price to 90
   383      When the parties place the following orders:
   384        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   385        | party6 | ETH/MAR23 | sell | 41     | 89    | 1                | TYPE_LIMIT | TIF_GTC |
   386      Then the market data for the market "ETH/MAR23" should be:
   387        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   388        | 100        | TRADING_MODE_CONTINUOUS | 13915        | 1000           | 348           | 100       | 90        | 90               | 91               | 89             |
   389      And the following trades should be executed:
   390        | buyer    | price | size | seller | is amm |
   391        | vamm2-id | 90    | 41   | party6 | true   |
   392  
   393      # Make sure the volumes match, PnL is expected to be different
   394      When the network moves ahead "1" blocks
   395  	Then the parties should have the following profit and loss:
   396        | party    | volume | unrealised pnl | realised pnl | is amm |
   397        | party3   | 1      | -10            | 0            |        |
   398        | party4   | -1     | 10             | 0            |        |
   399        | party6   | -347   | 1354           | 0            |        |
   400        | vamm2-id | 347    | -1354          | 0            | true   |
   401        | vamm1-id | 347    | 0              | 0            | true   |
   402  
   403    @VAMM
   404    Scenario: 0090-VAMM-030: The volume quoted to move from price 110 to 90 is the same as the volume to move from 100 to 110 + 100 to 90.
   405      # start out by moving mid prices to 90 and 110 respectively, these are the volumes required to move the price accordingly
   406      # We don't need to do this as part of this test, but it serves to show where we get the volumes from
   407      When the parties place the following orders:
   408        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   409        | party5 | ETH/MAR22 | sell | 347    | 90    | 1                | TYPE_LIMIT | TIF_GTC |
   410        | party6 | ETH/MAR23 | buy  | 74     | 110   | 1                | TYPE_LIMIT | TIF_GTC |
   411      Then the market data for the market "ETH/MAR23" should be:
   412        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   413        | 100        | TRADING_MODE_CONTINUOUS | 2999         | 1000           | 75            | 100       | 110       | 110              | 111              | 109            |
   414      And the market data for the market "ETH/MAR22" should be:
   415        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   416        | 100        | TRADING_MODE_CONTINUOUS | 13915        | 1000           | 348           | 100       | 90        | 90               | 91               | 89             |
   417  
   418      # Now to move from 110 down to 90, the volume ought to be 421 (=347+74)
   419      When the parties place the following orders:
   420        | party  | market id | side | volume | price | resulting trades | type       | tif     |
   421        | party6 | ETH/MAR23 | sell | 421    | 90    | 2                | TYPE_LIMIT | TIF_GTC |
   422      Then the market data for the market "ETH/MAR23" should be:
   423        | mark price | trading mode            | target stake | supplied stake | open interest | ref price | mid price | static mid price | best offer price | best bid price |
   424        | 100        | TRADING_MODE_CONTINUOUS | 13915        | 1000           | 348           | 100       | 90        | 90               | 91               | 89             |