code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/1920-trader-with-no-pos-and-stopped-fok-should-have-0-margin.feature (about)

     1  Feature: test for issue 1920
     2  
     3    Background:
     4  
     5      Given the markets:
     6        | id        | quote name | asset | risk model                  | margin calculator         | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
     7        | ETH/DEC19 | ETH        | ETH   | default-simple-risk-model-3 | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 0.25                   | 0                         | default-futures |
     8      And the following network parameters are set:
     9        | name                                    | value |
    10        | network.markPriceUpdateMaximumFrequency | 0s    |
    11        | limits.markets.maxPeggedOrders          | 2     |
    12  
    13    Scenario: a party place a new order in the system, margin are calculated, then the order is stopped, the margin is released
    14      Given the parties deposit on asset's general account the following amount:
    15        | party  | asset | amount    |
    16        | party1 | ETH   | 10000     |
    17        | party2 | ETH   | 100000000 |
    18        | party3 | ETH   | 100000000 |
    19        | party4 | ETH   | 100000000 |
    20        | lpprov | ETH   | 100000000 |
    21      When the parties place the following orders:
    22        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    23        | party2 | ETH/DEC19 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GFA | ref-1     |
    24        | party3 | ETH/DEC19 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GFA | ref-2     |
    25        | party4 | ETH/DEC19 | buy  | 10     | 100   | 0                | TYPE_LIMIT | TIF_GTC | ref-3     |
    26        | party4 | ETH/DEC19 | sell | 10     | 10000 | 0                | TYPE_LIMIT | TIF_GTC | ref-3     |
    27      And the parties submit the following liquidity provision:
    28        | id  | party  | market id | commitment amount | fee | lp type    |
    29        | lp1 | lpprov | ETH/DEC19 | 900000            | 0.1 | submission |
    30        | lp1 | lpprov | ETH/DEC19 | 900000            | 0.1 | submission |
    31      And the parties place the following pegged iceberg orders:
    32        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    33        | lpprov | ETH/DEC19 | 2         | 1                    | buy  | BID              | 50         | 100    |
    34        | lpprov | ETH/DEC19 | 2         | 1                    | sell | ASK              | 50         | 100    |
    35   
    36      Then the opening auction period ends for market "ETH/DEC19"
    37      And the mark price should be "1000" for the market "ETH/DEC19"
    38  
    39      When the parties place the following orders:
    40        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    41        | party1 | ETH/DEC19 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_FOK | ref-1     |
    42  
    43      # If the order isn't filled, the margin levels are calculated, but a zero-event is sent once the order is stopped
    44      Then the parties should have the following margin levels:
    45        | party  | market id | maintenance | search | initial | release |
    46        | party1 | ETH/DEC19 | 0           | 0      | 0       | 0       |
    47        #| party1 | ETH/DEC19 | 100         | 110    | 120     | 140     |
    48      Then the parties should have the following account balances:
    49        | party  | asset | market id | margin | general |
    50        | party1 | ETH   | ETH/DEC19 | 0      | 10000   |