code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0011-MARA-016017.feature (about)

     1  Feature: check pegged GTT and GTC in auction
     2  
     3    Background:
     4      Given the liquidity monitoring parameters:
     5        | name               | triggering ratio | time window | scaling factor |
     6        | lqm-params         | 1.0              | 20s         | 1.0            |  
     7      Given the log normal risk model named "log-normal-risk-model-1":
     8        | risk aversion | tau | mu | r | sigma |
     9        | 0.000001      | 0.1 | 0  | 0 | 1.0   |
    10      #risk factor short = 3.55690359157934000
    11      #risk factor long = 0.801225765
    12      And the margin calculator named "margin-calculator-0":
    13        | search factor | initial factor | release factor |
    14        | 1.2           | 1.5            | 2              |
    15      And the price monitoring named "price-monitoring-1":
    16        | horizon | probability | auction extension |
    17        | 36600   | 0.99        | 300               |
    18      And the following network parameters are set:
    19        | name                              | value |
    20        | market.auction.minimumDuration    | 1     |
    21        | limits.markets.maxPeggedOrders    | 1500  |
    22        | limits.markets.maxPeggedOrders    | 4     |
    23      And the markets:
    24        | 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      |
    25        | ETH/DEC19 | ETH        | ETH   | lqm-params           | log-normal-risk-model-1 | margin-calculator-0 | 1                | default-none | price-monitoring-1 | default-eth-for-future | 0.25                   | 0                         | default-futures |
    26  
    27    Scenario: 001, Pegged GTC (good till time) (parked in auction), Pegged orders will be [parked] if placed during [an auction], with time priority preserved. 0011-MARA-017
    28      Given the parties deposit on asset's general account the following amount:
    29        | party            | asset | amount    |
    30        | party1           | ETH   | 100000000 |
    31        | sellSideProvider | ETH   | 100000000 |
    32        | buySideProvider  | ETH   | 100000000 |
    33        | auxiliary        | ETH   | 100000000 |
    34        | aux2             | ETH   | 100000000 |
    35  
    36      # submit our LP
    37      Then the parties submit the following liquidity provision:
    38        | id  | party  | market id | commitment amount | fee | lp type    |
    39        | lp1 | party1 | ETH/DEC19 | 3000              | 0.1 | submission |
    40        | lp1 | party1 | ETH/DEC19 | 3000              | 0.1 | submission |
    41      And the parties place the following pegged iceberg orders:
    42        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    43        | party1 | ETH/DEC19 | 43 | 1 | buy  | BID | 43 | 10 |
    44        | party1 | ETH/DEC19 | 24 | 1 | sell | ASK | 24 | 10 |
    45  
    46      # get out of auction
    47      When the parties place the following orders:
    48        | party     | market id | side | volume | price | resulting trades | type       | tif     | reference |
    49        | auxiliary | ETH/DEC19 | buy  | 20     | 80    | 0                | TYPE_LIMIT | TIF_GTC | oa-b-1    |
    50        | auxiliary | ETH/DEC19 | sell | 20     | 120   | 0                | TYPE_LIMIT | TIF_GTC | oa-s-1    |
    51        | aux2      | ETH/DEC19 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | oa-b-2    |
    52        | auxiliary | ETH/DEC19 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | oa-s-2    |
    53      Then the opening auction period ends for market "ETH/DEC19"
    54      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    55  
    56      And the market data for the market "ETH/DEC19" should be:
    57        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    58        | 100        | TRADING_MODE_CONTINUOUS | 36600   | 92        | 109       | 355          | 3000           | 1             |
    59  
    60      # add a few pegged orders now
    61      Then the parties place the following pegged orders:
    62        | party | market id | side | volume | pegged reference | offset |
    63        | aux2  | ETH/DEC19 | sell | 10     | ASK              | 2      |
    64        | aux2  | ETH/DEC19 | buy  | 5      | BID              | 4      |
    65  
    66      Then the order book should have the following volumes for market "ETH/DEC19":
    67        | side | price | volume |
    68        | sell | 130   | 24     |
    69        | sell | 122   | 10     |
    70        | sell | 120   | 20     |
    71        | buy  | 80    | 20     |
    72        | buy  | 76    | 5      |
    73        | buy  | 70    | 43     |
    74  
    75      # now consume all the volume on the sell side
    76      When the parties place the following orders:
    77        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    78        | party1 | ETH/DEC19 | buy  | 20     | 120   | 0                | TYPE_LIMIT | TIF_GTC | t1-1      |
    79      And the network moves ahead "1" blocks
    80  
    81      # enter price monitoring auction
    82      Then the market state should be "STATE_SUSPENDED" for the market "ETH/DEC19"
    83      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19"
    84  
    85  
    86      Then the order book should have the following volumes for market "ETH/DEC19":
    87        | side | price | volume |
    88        | sell | 120 | 20 |
    89        | buy  | 120 | 20 |
    90        | buy  | 80  | 20 |
    91  
    92  
    93    Scenario: 002, Pegged GTT (good till time) (parked in auction), Pegged orders will be [parked] if placed during [an auction], with time priority preserved. 0011-MARA-016
    94      Given the parties deposit on asset's general account the following amount:
    95        | party            | asset | amount    |
    96        | party1           | ETH   | 100000000 |
    97        | sellSideProvider | ETH   | 100000000 |
    98        | buySideProvider  | ETH   | 100000000 |
    99        | auxiliary        | ETH   | 100000000 |
   100        | aux2             | ETH   | 100000000 |
   101  
   102      # submit our LP
   103      Then the parties submit the following liquidity provision:
   104        | id  | party  | market id | commitment amount | fee | lp type    |
   105        | lp1 | party1 | ETH/DEC19 | 3000              | 0.1 | submission |
   106        | lp1 | party1 | ETH/DEC19 | 3000              | 0.1 | submission |
   107      And the parties place the following pegged iceberg orders:
   108        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
   109        | party1 | ETH/DEC19 | 43 | 1 | buy  | BID | 43 | 10 |
   110        | party1 | ETH/DEC19 | 24 | 1 | sell | ASK | 24 | 10 |
   111   
   112      # get out of auction
   113      When the parties place the following orders:
   114        | party     | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
   115        | auxiliary | ETH/DEC19 | buy  | 20     | 80    | 0                | TYPE_LIMIT | TIF_GTT | oa-b-1    | 6          |
   116        | auxiliary | ETH/DEC19 | sell | 20     | 120   | 0                | TYPE_LIMIT | TIF_GTT | oa-s-1    | 6          |
   117        | aux2      | ETH/DEC19 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTT | oa-b-2    | 6          |
   118        | auxiliary | ETH/DEC19 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTT | oa-s-2    | 6          |
   119      Then the opening auction period ends for market "ETH/DEC19"
   120      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
   121  
   122      And the market data for the market "ETH/DEC19" should be:
   123        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
   124        | 100        | TRADING_MODE_CONTINUOUS | 36600   | 92        | 109       | 355          | 3000           | 1             |
   125  
   126      # add a few pegged orders now
   127      Then the parties place the following pegged orders:
   128        | party | market id | side | volume | pegged reference | offset |
   129        | aux2  | ETH/DEC19 | sell | 10     | ASK              | 2      |
   130        | aux2  | ETH/DEC19 | buy  | 5      | BID              | 4      |
   131  
   132      Then the order book should have the following volumes for market "ETH/DEC19":
   133        | side | price | volume |
   134        | sell | 130   | 24     |
   135        | sell | 122   | 10     |
   136        | sell | 120   | 20     |
   137        | buy  | 80    | 20     |
   138        | buy  | 76    | 5      |
   139        | buy  | 70    | 43     |
   140  
   141      # now consume all the volume on the sell side
   142      When the parties place the following orders:
   143        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
   144        | party1 | ETH/DEC19 | buy  | 20     | 120   | 0                | TYPE_LIMIT | TIF_GTC | t1-1      |
   145      And the network moves ahead "1" blocks
   146  
   147      # enter price monitoring auction
   148      Then the market state should be "STATE_SUSPENDED" for the market "ETH/DEC19"
   149      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "ETH/DEC19"
   150  
   151      Then the order book should have the following volumes for market "ETH/DEC19":
   152        | side | price | volume |
   153        | sell | 122   | 0      |
   154        | sell | 120   | 20     |
   155        | buy  | 80    | 20     |
   156        | buy  | 76    | 0      |
   157  
   158