code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/0019-MCAL-164.feature (about)

     1  Feature: amend the order and it isn't matched and it's all good and it just moves some funds around and it sits in the book and wait
     2    Background:
     3      # Set liquidity parameters to allow "zero" target-stake which is needed to construct the order-book defined in the ACs
     4      Given the following network parameters are set:
     5        | name                                    | value |
     6        | network.markPriceUpdateMaximumFrequency | 1s    |
     7      And the liquidity monitoring parameters:
     8        | name       | triggering ratio | time window | scaling factor |
     9        | lqm-params | 0.00             | 24h         | 1e-9           |
    10      And the simple risk model named "simple-risk-model":
    11        | long | short | max move up | min move down | probability of trading |
    12        | 0.1  | 0.1   | 100         | -100          | 0.2                    |
    13      And the markets:
    14        | 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      |
    15        | ETH/FEB23 | ETH        | USD   | lqm-params           | simple-risk-model | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 0.000125               | 0                         | default-futures |
    16  
    17    Scenario: 001 party holds orders only, and party1 holds both orders and positions
    18      Given the parties deposit on asset's general account the following amount:
    19        | party            | asset | amount       |
    20        | buySideProvider  | USD   | 100000000000 |
    21        | sellSideProvider | USD   | 100000000000 |
    22        | party            | USD   | 48050        |
    23        | party1           | USD   | 48050        |
    24      And the parties place the following orders:
    25        | party            | market id | side | volume | price  | resulting trades | type       | tif     | reference   |
    26        | buySideProvider  | ETH/FEB23 | buy  | 10     | 14900  | 0                | TYPE_LIMIT | TIF_GTC |             |
    27        | buySideProvider  | ETH/FEB23 | buy  | 1      | 15000  | 0                | TYPE_LIMIT | TIF_GTC |             |
    28        | buySideProvider  | ETH/FEB23 | buy  | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |             |
    29        | party            | ETH/FEB23 | sell | 3      | 15900  | 0                | TYPE_LIMIT | TIF_GTC |             |
    30        | party            | ETH/FEB23 | sell | 5      | 15900  | 0                | TYPE_LIMIT | TIF_GTC | party-sell  |
    31        | party1           | ETH/FEB23 | sell | 5      | 15900  | 0                | TYPE_LIMIT | TIF_GTC | party1-sell |
    32        | sellSideProvider | ETH/FEB23 | sell | 1      | 100000 | 0                | TYPE_LIMIT | TIF_GTC |             |
    33        | sellSideProvider | ETH/FEB23 | sell | 10     | 100100 | 0                | TYPE_LIMIT | TIF_GTC |             |
    34  
    35      When the network moves ahead "2" blocks
    36      Then the mark price should be "15900" for the market "ETH/FEB23"
    37  
    38      #AC: 0019-MCAL-164, 0019-MCAL-165
    39      And the parties submit update margin mode:
    40        | party  | market    | margin_mode     | margin_factor | error |
    41        | party  | ETH/FEB23 | isolated margin | 0.2           |       |
    42        | party1 | ETH/FEB23 | isolated margin | 0.2           |       |
    43  
    44      And the parties should have the following margin levels:
    45        | party  | market id | maintenance | margin mode     | margin factor | order |
    46        | party  | ETH/FEB23 | 4776        | isolated margin | 0.2           | 15900 |
    47        | party1 | ETH/FEB23 | 0           | isolated margin | 0.2           | 15900 |
    48  
    49      When the parties amend the following orders:
    50        | party  | reference   | price | size delta | tif     | error |
    51        | party  | party-sell  | 15500 | 0          | TIF_GTC |       |
    52        | party1 | party1-sell | 15500 | 0          | TIF_GTC |       |
    53  
    54      When the network moves ahead "2" blocks
    55  
    56      Then the parties should have the following account balances:
    57        | party  | asset | market id | margin | general | order margin |
    58        | party  | USD   | ETH/FEB23 | 9540   | 23010   | 15500        |
    59        | party1 | USD   | ETH/FEB23 | 0      | 32550   | 15500        |
    60  
    61      And the order book should have the following volumes for market "ETH/FEB23":
    62        | side | price | volume |
    63        | sell | 15900 | 0      |
    64        | sell | 15500 | 10     |
    65  
    66      And the orders should have the following status:
    67        | party  | reference   | status        |
    68        | party  | party-sell  | STATUS_ACTIVE |
    69        | party1 | party1-sell | STATUS_ACTIVE |
    70  
    71      And the parties should have the following margin levels:
    72        | party  | market id | maintenance | margin mode     | margin factor | order |
    73        | party  | ETH/FEB23 | 4776        | isolated margin | 0.2           | 15500 |
    74        | party1 | ETH/FEB23 | 0           | isolated margin | 0.2           | 15500 |
    75  
    76      #AC: 0019-MCAL-166, 0019-MCAL-167
    77      When the parties amend the following orders:
    78        | party  | reference   | price | size delta | tif     | error |
    79        | party  | party-sell  | 15500 | -2         | TIF_GTC |       |
    80        | party1 | party1-sell | 15500 | -2         | TIF_GTC |       |
    81      When the network moves ahead "2" blocks
    82  
    83      Then the parties should have the following account balances:
    84        | party  | asset | market id | margin | general | order margin |
    85        | party  | USD   | ETH/FEB23 | 9540   | 29210   | 9300         |
    86        | party1 | USD   | ETH/FEB23 | 0      | 38750   | 9300         |
    87  
    88      When the network moves ahead "2" blocks
    89  
    90      And the order book should have the following volumes for market "ETH/FEB23":
    91        | side | price | volume |
    92        | sell | 15900 | 0      |
    93        | sell | 15500 | 6      |
    94  
    95      And the orders should have the following status:
    96        | party  | reference   | status        |
    97        | party  | party-sell  | STATUS_ACTIVE |
    98        | party1 | party1-sell | STATUS_ACTIVE |
    99  
   100      #maintenance margin: min(3*0,15900*3*0.25)+3*0.1*15900=4770
   101      And the parties should have the following margin levels:
   102        | party  | market id | maintenance | margin mode     | margin factor | order |
   103        | party  | ETH/FEB23 | 4776        | isolated margin | 0.2           | 9300  |
   104        | party1 | ETH/FEB23 | 0           | isolated margin | 0.2           | 9300  |
   105  
   106      Then the mark price should be "15900" for the market "ETH/FEB23"