code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/fcap_liquidations_and_fees.feature (about)

     1  Feature: FCAP liquidations
     2  
     3      Checking interactions between parties paying fees when barely having
     4      enough funds to cover positions on FCAP markets.
     5  
     6    Background:
     7  
     8      # Initialise the network and register the assets
     9      Given the average block duration is "1"
    10      And the following network parameters are set:
    11        | name                                    | value |
    12        | market.fee.factors.makerFee             | 0.1   |
    13        | market.fee.factors.infrastructureFee    | 0.1   |
    14        | network.markPriceUpdateMaximumFrequency | 0s    |
    15      And the following assets are registered:
    16        | id       | decimal places | quantum |
    17        | USD-1-10 | 0              | 1       |
    18  
    19      # Initialise the parties and deposit assets
    20      Given the parties deposit on asset's general account the following amount:
    21        | party | asset    | amount       |
    22        | lp    | USD-1-10 | 100000000000 |
    23        | aux1  | USD-1-10 | 100000000000 |
    24        | aux2  | USD-1-10 | 100000000000 |
    25  
    26      # Setup the FCAP market in continuous trading
    27      Given the price monitoring named "price-monitoring":
    28        | horizon | probability | auction extension |
    29        | 3600    | 0.99        | 5                 |
    30      Given the markets:
    31        | id               | quote name | asset    | risk model                    | margin calculator         | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      | decimal places | position decimal places | max price cap | binary | fully collateralised |
    32        | FCAP-PM/USD-1-10 | ETH        | USD-1-10 | default-log-normal-risk-model | default-margin-calculator | 1                | default-none | price-monitoring | default-eth-for-future | 1e-3                   | 0                         | default-futures | 0              | 0                       | 100           | true   | true                 |
    33      And the parties submit the following liquidity provision:
    34        | id  | party | market id        | commitment amount | fee | lp type    |
    35        | lp1 | lp    | FCAP-PM/USD-1-10 | 1000000           | 0   | submission |
    36      And the parties place the following orders:
    37        | party | market id        | side | volume | price | resulting trades | type       | tif     |
    38        | aux1  | FCAP-PM/USD-1-10 | buy  | 1      | 50    | 0                | TYPE_LIMIT | TIF_GTC |
    39        | aux2  | FCAP-PM/USD-1-10 | sell | 1      | 50    | 0                | TYPE_LIMIT | TIF_GTC |
    40      When the network moves ahead "2" blocks
    41      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "FCAP-PM/USD-1-10"
    42  
    43    @CappedF @NoPerp
    44    Scenario: Party places a limit order with not enough funds to cover fes
    45  
    46      Given the parties deposit on asset's general account the following amount:
    47        | party  | asset    | amount |
    48        | trader | USD-1-10 | 50     |
    49  
    50      Given the parties place the following orders:
    51        | party  | market id        | side | volume | price | resulting trades | type       | tif     |
    52        | aux1   | FCAP-PM/USD-1-10 | sell | 1      | 50    | 0                | TYPE_LIMIT | TIF_GTC |
    53        | trader | FCAP-PM/USD-1-10 | buy  | 1      | 50    | 1                | TYPE_LIMIT | TIF_GTC |
    54      When the network moves ahead "1" blocks
    55      Then the following trades should be executed:
    56        | buyer   | price | size | seller |
    57        | trader  | 50    | 1    | aux1   |
    58        | network | 50    | 1    | trader |
    59  
    60    @CappedF @NoPerp
    61    Scenario: Party places a limit order which requires no fees in continuous trading but later requires fees in auction
    62  
    63      Given the parties deposit on asset's general account the following amount:
    64        | party  | asset    | amount |
    65        | trader | USD-1-10 | 50     |
    66  
    67      Given the parties place the following orders:
    68        | party  | market id        | side | volume | price | resulting trades | type       | tif     |
    69        | trader | FCAP-PM/USD-1-10 | buy  | 1      | 50    | 0                | TYPE_LIMIT | TIF_GTC |
    70      When the network moves ahead "1" blocks
    71      And the parties should have the following account balances:
    72        | party  | asset    | market id        | margin | general |
    73        | trader | USD-1-10 | FCAP-PM/USD-1-10 | 50     | 0       |
    74  
    75      And the market data for the market "FCAP-PM/USD-1-10" should be:
    76        | mark price | trading mode            | horizon | min bound | max bound |
    77        | 50         | TRADING_MODE_CONTINUOUS | 3600    | 48        | 52        |
    78      Given the parties place the following orders:
    79        | party | market id        | side | volume | price | resulting trades | type       | tif     | reference          |
    80        | aux1  | FCAP-PM/USD-1-10 | buy  | 1      | 60    | 0                | TYPE_LIMIT | TIF_GTC | auction-order-aux1 |
    81        | aux2  | FCAP-PM/USD-1-10 | sell | 1      | 60    | 0                | TYPE_LIMIT | TIF_GTC | auction-order-aux2 |
    82      When the network moves ahead "1" blocks
    83      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "FCAP-PM/USD-1-10"
    84      Then the parties cancel the following orders:
    85        | party | reference          |
    86        | aux1  | auction-order-aux1 |
    87        | aux2  | auction-order-aux2 |
    88      Given the parties place the following orders:
    89        | party | market id        | side | volume | price | resulting trades | type       | tif     |
    90        | aux1  | FCAP-PM/USD-1-10 | sell | 1      | 50    | 0                | TYPE_LIMIT | TIF_GTC |
    91      Then the network moves ahead "10" blocks
    92      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "FCAP-PM/USD-1-10"
    93      And the following trades should be executed:
    94        | buyer   | price | size | seller |
    95        | trader  | 50    | 1    | aux1   |
    96        | network | 50    | 1    | trader |
    97  
    98