code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/635-margin-calculation.feature (about)

     1  Feature: Regression test for issue 596
     2  
     3    Background:
     4      Given the markets:
     5        | id        | quote name | asset | risk model                | margin calculator                  | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
     6        | ETH/DEC19 | BTC        | BTC   | default-simple-risk-model | default-overkill-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 0.25                   | 0                         | default-futures |
     7      And the following network parameters are set:
     8        | name                                    | value |
     9        | market.auction.minimumDuration          | 1     |
    10        | network.markPriceUpdateMaximumFrequency | 0s    |
    11        | limits.markets.maxPeggedOrders          | 2     |
    12  
    13    @ignore
    14    Scenario: Traded out position but monies left in margin account
    15      # setup accounts
    16      Given the parties deposit on asset's general account the following amount:
    17        | party            | asset | amount     |
    18        | partyGuy         | BTC   | 1000000000 |
    19        | sellSideProvider | BTC   | 1000000000 |
    20        | buySideProvider  | BTC   | 1000000000 |
    21        | aux              | BTC   | 1000000000 |
    22        | aux2             | BTC   | 1000000000 |
    23        | lpprov           | BTC   | 1000000000 |
    24  
    25      When the parties submit the following liquidity provision:
    26        | id  | party  | market id | commitment amount | fee | lp type    |
    27        | lp1 | lpprov | ETH/DEC19 | 900000000         | 0.0 | submission |
    28        | lp1 | lpprov | ETH/DEC19 | 900000000         | 0.0 | submission |
    29   
    30      # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction
    31      And the parties place the following orders:
    32        | party | market id | side | volume | price    | resulting trades | type       | tif     |
    33        | aux   | ETH/DEC19 | buy  | 1      | 8700000  | 0                | TYPE_LIMIT | TIF_GTC |
    34        | aux   | ETH/DEC19 | sell | 1      | 25000000 | 0                | TYPE_LIMIT | TIF_GTC |
    35        | aux2  | ETH/DEC19 | buy  | 1      | 10300000 | 0                | TYPE_LIMIT | TIF_GTC |
    36        | aux   | ETH/DEC19 | sell | 1      | 10300000 | 0                | TYPE_LIMIT | TIF_GTC |
    37      Then the opening auction period ends for market "ETH/DEC19"
    38      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    39  
    40  
    41      # setup previous mark price
    42      Then the parties place the following orders with ticks:
    43        | party            | market id | side | volume | price    | resulting trades | type       | tif     | reference |
    44        | sellSideProvider | ETH/DEC19 | sell | 1      | 10300000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    45        | buySideProvider  | ETH/DEC19 | buy  | 1      | 10300000 | 1                | TYPE_LIMIT | TIF_GTC | ref-2     |
    46  
    47      # setup orderbook
    48      When the parties place the following orders with ticks:
    49        | party            | market id | side | volume | price    | resulting trades | type       | tif     | reference |
    50        | sellSideProvider | ETH/DEC19 | sell | 100    | 25000000 | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    51        | sellSideProvider | ETH/DEC19 | sell | 11     | 14000000 | 0                | TYPE_LIMIT | TIF_GTC | ref-2     |
    52        | sellSideProvider | ETH/DEC19 | sell | 2      | 11200000 | 0                | TYPE_LIMIT | TIF_GTC | ref-3     |
    53        | buySideProvider  | ETH/DEC19 | buy  | 1      | 10000000 | 0                | TYPE_LIMIT | TIF_GTC | ref-4     |
    54        | buySideProvider  | ETH/DEC19 | buy  | 3      | 9600000  | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    55        | buySideProvider  | ETH/DEC19 | buy  | 15     | 9000000  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    56        | buySideProvider  | ETH/DEC19 | buy  | 50     | 8700000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    57      # buy 13@150
    58      Then the parties place the following orders with ticks:
    59        | party    | market id | side | volume | price    | resulting trades | type       | tif     | reference |
    60        | partyGuy | ETH/DEC19 | buy  | 13     | 15000000 | 2                | TYPE_LIMIT | TIF_GTC | ref-1     |
    61      # checking margins
    62      Then the parties should have the following account balances:
    63        | party    | asset | market id | margin    | general   |
    64        | partyGuy | BTC   | ETH/DEC19 | 327600000 | 678000000 |
    65      # checking margins levels
    66      Then the parties should have the following margin levels:
    67        | party    | market id | maintenance |
    68        | partyGuy | ETH/DEC19 | 81900000    |