code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spots/SpotFunctionalTests/0080-SPOT-020.feature (about)

     1  Feature: Spot Markets
     2  
     3    Scenario: When exiting an auction, for any orders that are still open, the funds held in the parties'
     4              holding_account to cover potential fees can be released to their respective general_account,
     5              so that the remaining amount in the holding_account is only sufficient to cover the value of the order.(0080-SPOT-020).
     6  
     7    Background:
     8      Given the following network parameters are set:
     9        | name                                    | value |
    10        | network.markPriceUpdateMaximumFrequency | 0s    |
    11      And the average block duration is "1"
    12  
    13      Given the fees configuration named "fees-config-1":
    14        | maker fee | infrastructure fee |
    15        | 0.005     | 0.05               |
    16      
    17      And the simple risk model named "my-simple-risk-model":
    18        | long | short | max move up | min move down | probability of trading |
    19        | 0.01 | 0.01  | 10          | -10           | 0.2                    |
    20  
    21      And the price monitoring named "price-monitoring":
    22        | horizon | probability | auction extension |
    23        | 3600    | 0.95        | 3                 |
    24  
    25      And the spot markets:
    26        | id      | name    | base asset | quote asset | risk model           | auction duration | fees          | price monitoring | sla params    |
    27        | BTC/ETH | BTC/ETH | BTC        | ETH         | my-simple-risk-model | 1                | fees-config-1 | price-monitoring | default-basic |
    28      # setup accounts
    29      Given the parties deposit on asset's general account the following amount:
    30        | party  | asset | amount |
    31        | party1 | ETH   | 20000  |
    32        | party2 | BTC   | 100    |
    33        | party3 | ETH   | 2000   |
    34        
    35      # place orders and generate trades
    36      And the parties place the following orders:
    37        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    38        | party1 | BTC/ETH   | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GFA | t1-b-1    |
    39        | party2 | BTC/ETH   | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | t2-s-1    |
    40        | party3 | BTC/ETH   | buy  | 10     | 100   | 0                | TYPE_LIMIT | TIF_GTC | bla-bla   |
    41  
    42      Then the opening auction period ends for market "BTC/ETH"
    43      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    44      And the mark price should be "100" for the market "BTC/ETH"
    45      When the network moves ahead "1" blocks
    46  
    47      # Check the account details for party3 while in continuous trading
    48      Then "party3" should have holding account balance of "1000" for asset "ETH"
    49      Then "party3" should have general account balance of "1000" for asset "ETH"
    50  
    51      # Place some orders outside the price range to trigger a price monitoring auction
    52      And the parties place the following orders:
    53        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    54        | party1 | BTC/ETH   | buy  | 1      | 111   | 0                | TYPE_LIMIT | TIF_GTC | 
    55        | party2 | BTC/ETH   | sell | 1      | 111   | 0                | TYPE_LIMIT | TIF_GTC | 
    56  
    57      When the network moves ahead "1" blocks
    58      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
    59  
    60      # We have moved into monitoring auction so will require that fees amounting to 25 are covered in our holding account
    61      Then "party3" should have holding account balance of "1025" for asset "ETH"
    62      Then "party3" should have general account balance of "975" for asset "ETH"
    63  
    64      # Place some new matching orders to get the mark price back to the right level and bring us out of auction
    65      And the parties place the following orders:
    66        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    67        | party1 | BTC/ETH   | buy  | 5      | 101   | 0                | TYPE_LIMIT | TIF_GTC | 
    68        | party2 | BTC/ETH   | sell | 5      | 101   | 0                | TYPE_LIMIT | TIF_GTC | 
    69  
    70      When the network moves ahead "5" blocks
    71      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    72  
    73      # We move out of auction and the fees should be returned from the holding account to the general accounts
    74      Then "party3" should have holding account balance of "1000" for asset "ETH"
    75      Then "party3" should have general account balance of "1000" for asset "ETH"
    76  
    77