code.vegaprotocol.io/vega@v0.79.0/core/integration/features/liquidity-provision/lp-margin-post-auction.feature (about)

     1  Feature: Assure LP margin is correct
     2  
     3    Background:
     4  
     5      Given the log normal risk model named "log-normal-risk-model-1":
     6        | risk aversion | tau  | mu | r | sigma |
     7        | 0.000001      | 0.01 | 0  | 0 | 1.0   |
     8      And the fees configuration named "fees-config-1":
     9        | maker fee | infrastructure fee |
    10        | 0.004     | 0.001              |
    11      And the price monitoring named "price-monitoring-1":
    12        | horizon | probability | auction extension |
    13        | 3600    | 0.99        | 300               |
    14      And the following network parameters are set:
    15        | name                                          | value |
    16        | market.liquidity.bondPenaltyParameter       | 0.2   |
    17      And the liquidity monitoring parameters:
    18        | name               | triggering ratio | time window | scaling factor |
    19        | lqm-params         | 0.24             | 24h         | 1.5            |  
    20      
    21      And the markets:
    22        | 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      |
    23        | ETH/MAR22 | ETH        | USD   | lqm-params           | log-normal-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | default-eth-for-future | 0.25                   | 0                         | default-futures |
    24      And the parties deposit on asset's general account the following amount:
    25        | party  | asset | amount    |
    26        | party0 | USD   | 500000000 |
    27        | party1 | USD   | 100000000 |
    28        | party2 | USD   | 100000000 |
    29        | party3 | USD   | 100000000 |
    30      And the following network parameters are set:
    31        | name                                    | value |
    32        | network.markPriceUpdateMaximumFrequency | 0s    |
    33        | limits.markets.maxPeggedOrders          | 2     |
    34  
    35    Scenario: Assure LP margin is released when opening auction concludes with a price lower than indicative uncrossing price at the time of LP submission
    36  
    37      Given the average block duration is "1"
    38      And the parties submit the following liquidity provision:
    39        | id  | party  | market id | commitment amount | fee   | lp type    |
    40        | lp1 | party0 | ETH/MAR22 | 50000             | 0.001 | submission |
    41        | lp1 | party0 | ETH/MAR22 | 50000             | 0.001 | amendment  |
    42      And the parties place the following pegged iceberg orders:
    43        | party  | market id | peak size | minimum visible size | side | pegged reference | volume     | offset |
    44        | party0 | ETH/MAR22 | 20         | 1                    | sell | ASK              | 54        | 17     |
    45        | party0 | ETH/MAR22 | 20         | 1                    | buy  | BID              | 54        | 17     |
    46      And the parties place the following orders:
    47        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference  |
    48        | party1 | ETH/MAR22 | buy  | 1      | 900   | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-1  |
    49        | party1 | ETH/MAR22 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-2  |
    50        | party1 | ETH/MAR22 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-3  |
    51        | party1 | ETH/MAR22 | buy  | 100    | 50000 | 0                | TYPE_LIMIT | TIF_GTC | buy-ref-4  |
    52        | party2 | ETH/MAR22 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-3 |
    53        | party2 | ETH/MAR22 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-2 |
    54        | party2 | ETH/MAR22 | sell | 1      | 1010  | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-1 |
    55        | party3 | ETH/MAR22 | sell | 100    | 50000 | 0                | TYPE_LIMIT | TIF_GTC | sell-ref-4 |
    56      Then the market data for the market "ETH/MAR22" should be:
    57        | mark price | trading mode                 | indicative price | indicative volume |
    58        | 0          | TRADING_MODE_OPENING_AUCTION | 50000            | 100               |
    59  
    60      When the parties submit the following liquidity provision:
    61        | id  | party  | market id | commitment amount | fee   | lp type   |
    62        | lp1 | party0 | ETH/MAR22 | 55000             | 0.001 | amendment |
    63        | lp1 | party0 | ETH/MAR22 | 55000             | 0.001 | amendment |
    64      # Then the parties should have the following margin levels:
    65      #   | party  | market id | maintenance | search | initial | release |
    66      #   | party0 | ETH/MAR22 | 63256       | 69581  | 75907   | 88558   |
    67      # And the parties should have the following account balances:
    68      #   | party  | asset | market id | margin | general   | bond  |
    69      #   | party0 | USD   | ETH/MAR22 | 75907  | 499869093 | 55000 |
    70  
    71      When the parties cancel the following orders:
    72        | party  | reference  |
    73        | party3 | sell-ref-4 |
    74        | party1 | buy-ref-4  |
    75      Then the market data for the market "ETH/MAR22" should be:
    76        | mark price | trading mode                 | indicative price | indicative volume |
    77        | 0          | TRADING_MODE_OPENING_AUCTION | 1000             | 10                |
    78  
    79      When the opening auction period ends for market "ETH/MAR22"
    80      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/MAR22"
    81      And the market data for the market "ETH/MAR22" should be:
    82        | mark price | trading mode            | horizon | min bound | max bound | target stake | supplied stake | open interest |
    83        | 1000       | TRADING_MODE_CONTINUOUS | 3600    | 973       | 1027      | 9484         | 55000          | 10            |
    84      And the parties should have the following margin levels:
    85        | party  | market id | maintenance | search | initial | release |
    86        | party0 | ETH/MAR22 | 34147       | 37561  | 40976   | 47805   |
    87      And the parties should have the following account balances:
    88        | party  | asset | market id | margin | general   | bond  |
    89        | party0 | USD   | ETH/MAR22 | 40976  | 499904024 | 55000 |