code.vegaprotocol.io/vega@v0.79.0/core/integration/features/closeouts/1919-close-out-occurs-above-maintenance.feature (about)

     1  Feature: Setting up 5 parties so that at once all the orders are places they end up with the following margin account balances: tt_5_0: 23 = searchLevel + 1, tt_5_1: 22=searchLevel, tt_5_2: 21=maintenanceLevel+1=searchLevel-1, tt_5_3=maintenanceLevel, tt_5_4=maintenanceLevel-1
     2  
     3  
     4    Background:
     5  
     6      Given the markets:
     7        | id        | quote name | asset | risk model                  | margin calculator         | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
     8        | ETH/DEC19 | BTC        | BTC   | default-simple-risk-model-4 | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 0                      | 0                         | default-futures |
     9      And the following network parameters are set:
    10        | name                                    | value |
    11        | network.markPriceUpdateMaximumFrequency | 0s    |
    12        | limits.markets.maxPeggedOrders          | 2     |
    13  
    14    Scenario: https://drive.google.com/file/d/1bYWbNJvG7E-tcqsK26JMu2uGwaqXqm0L/view
    15      # setup accounts
    16      Given the parties deposit on asset's general account the following amount:
    17        | party  | asset | amount    |
    18        | tt_4   | BTC   | 500000    |
    19        | tt_5_0 | BTC   | 123       |
    20        | tt_5_1 | BTC   | 122       |
    21        | tt_5_2 | BTC   | 121       |
    22        | tt_5_3 | BTC   | 120       |
    23        | tt_5_4 | BTC   | 119       |
    24        | tt_6   | BTC   | 100000000 |
    25        | tt_10  | BTC   | 10000000  |
    26        | tt_11  | BTC   | 10000000  |
    27        | party1 | BTC   | 100000000 |
    28        | party2 | BTC   | 100000000 |
    29        | tt_aux | BTC   | 100000000 |
    30        | lpprov | BTC   | 100000000 |
    31  
    32      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
    33      When the parties place the following orders:
    34        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    35        | tt_aux | ETH/DEC19 | buy  | 1      | 1     | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    36        | tt_aux | ETH/DEC19 | sell | 1      | 200   | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
    37  
    38      And the parties place the following orders:
    39        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    40        | party1 | ETH/DEC19 | sell | 1      | 200   | 0                | TYPE_LIMIT | TIF_GTC | t1-s-1    |
    41        | party2 | ETH/DEC19 | buy  | 1      | 95    | 0                | TYPE_LIMIT | TIF_GTC | t2-b-1    |
    42        | party1 | ETH/DEC19 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GFA | t1-b-1    |
    43        | party2 | ETH/DEC19 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GFA | t2-s-1    |
    44      And the parties submit the following liquidity provision:
    45        | id  | party  | market id | commitment amount | fee | lp type    |
    46        | lp1 | lpprov | ETH/DEC19 | 90000             | 0.1 | submission |
    47        | lp1 | lpprov | ETH/DEC19 | 90000             | 0.1 | submission |
    48      And the parties place the following pegged iceberg orders:
    49        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    50        | lpprov | ETH/DEC19 | 90000     | 1                    | buy  | BID              | 90000      |  94    |
    51        | lpprov | ETH/DEC19 | 306       | 1                    | sell | ASK              | 306        |  95    |
    52      Then the opening auction period ends for market "ETH/DEC19"
    53      And the mark price should be "100" for the market "ETH/DEC19"
    54     
    55      # place orders and generate trades
    56      When the parties place the following orders "1" blocks apart:
    57        | party  | market id | side | volume | price | resulting trades | type        | tif     | reference | expires in |
    58        | tt_10  | ETH/DEC19 | buy  | 10     | 100   | 0                | TYPE_LIMIT  | TIF_GTT | tt_10-1   | 3600       |
    59        | tt_11  | ETH/DEC19 | sell | 10     | 100   | 1                | TYPE_LIMIT  | TIF_GTT | tt_11-1   | 3600       |
    60        | tt_4   | ETH/DEC19 | buy  | 5      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_4-1    |            |
    61        | tt_4   | ETH/DEC19 | buy  | 5      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_4-2    |            |
    62        | tt_5_0 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_0-1  |            |
    63        | tt_5_1 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_1-1  |            |
    64        | tt_5_2 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_2-1  |            |
    65        | tt_5_3 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_3-1  |            |
    66        | tt_5_4 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_4-1  |            |
    67        | tt_6   | ETH/DEC19 | sell | 5      | 150   | 1                | TYPE_LIMIT  | TIF_GTC | tt_6-1    |            |
    68        | tt_5_0 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_0-2  |            |
    69        | tt_5_1 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_1-2  |            |
    70        | tt_5_2 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_2-2  |            |
    71        | tt_5_3 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_3-2  |            |
    72        | tt_5_4 | ETH/DEC19 | buy  | 1      | 150   | 0                | TYPE_LIMIT  | TIF_GTC | tt_5_4-2  |            |
    73        | tt_6   | ETH/DEC19 | sell | 5      | 150   | 1                | TYPE_LIMIT  | TIF_GTC | tt_6-2    |            |
    74        | tt_10  | ETH/DEC19 | buy  | 25     | 100   | 0                | TYPE_LIMIT  | TIF_GTC | tt_10-2   |            |
    75        | tt_11  | ETH/DEC19 | sell | 25     | 0     | 11               | TYPE_MARKET | TIF_FOK | tt_11-2   |            |
    76  
    77  
    78      And the mark price should be "100" for the market "ETH/DEC19"
    79  
    80  
    81  
    82      # checking margins
    83      And the parties should have the following margin levels:
    84        | party  | market id | maintenance | search | initial | release |
    85        | tt_5_0 | ETH/DEC19 | 20          | 22     | 24      | 28      |
    86        | tt_5_1 | ETH/DEC19 | 20          | 22     | 24      | 28      |
    87        | tt_5_2 | ETH/DEC19 | 20          | 22     | 24      | 28      |
    88        | tt_5_3 | ETH/DEC19 | 20          | 22     | 24      | 28      |
    89        | tt_5_4 | ETH/DEC19 | 0           | 0      | 0       | 0       |
    90  
    91      # checking balances
    92      Then the parties should have the following account balances:
    93        | party  | asset | market id | margin | general |
    94        | tt_5_0 | BTC   | ETH/DEC19 | 23     | 0       |
    95        | tt_5_1 | BTC   | ETH/DEC19 | 22     | 0       |
    96        | tt_5_2 | BTC   | ETH/DEC19 | 21     | 0       |
    97        | tt_5_3 | BTC   | ETH/DEC19 | 20     | 0       |
    98        | tt_5_4 | BTC   | ETH/DEC19 | 0      | 0       |