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

     1  Feature: Spot Markets
     2  
     3    Scenario: For a "buy" order to be considered valid during an auction, the party must have a sufficient amount of the quote_asset
     4              to cover the order size, as well as any potential fees that may be incurred due to the order trading
     5              in the auction (0080-SPOT-018).
     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      Given the fees configuration named "fees-config-1":
    13        | maker fee | infrastructure fee |
    14        | 0.005     | 0.002              |
    15      And the simple risk model named "my-simple-risk-model":
    16        | long | short | max move up | min move down | probability of trading |
    17        | 0.01 | 0.01  | 10          | -10           | 0.2                    |
    18      And the fees configuration named "my-fees-config":
    19        | maker fee | infrastructure fee |
    20        | 0.004     | 0.001              |
    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   | 100    |
    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  
    41      Then the opening auction period ends for market "BTC/ETH"
    42      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    43      And the mark price should be "100" for the market "BTC/ETH"
    44      When the network moves ahead "1" blocks
    45  
    46      # Place an order outside the price range to trigger a price monitoring auction
    47      And the parties place the following orders:
    48        | party  | market id | side | volume | price | resulting trades | type       | tif     | 
    49        | party1 | BTC/ETH   | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | 
    50        | party2 | BTC/ETH   | sell | 2      | 191   | 0                | TYPE_LIMIT | TIF_GTC | 
    51  
    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      | 191   | 0                | TYPE_LIMIT | TIF_GTC | 
    55  
    56      When the network moves ahead "1" blocks
    57      And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
    58  
    59      # We have moved into monitoring auction so let's try to submit some orders to test out
    60      # the transfer of funds from the general to the holding account
    61  
    62      # Trying to place an order at price 100 will require a holding account amount of 100+(0.01*100)=101 which will fail
    63      And the parties place the following orders:
    64        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | error                                                              |
    65        | party3 | BTC/ETH   | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | buy1      | party does not have sufficient balance to cover the trade and fees |
    66  
    67      # Trying to place an order at price 99 will require a holding account amount of 99+(0.01*99)=100 which will be fine
    68      And the parties place the following orders:
    69        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | error |
    70        | party3 | BTC/ETH   | buy  | 1      | 99    | 0                | TYPE_LIMIT | TIF_GTC | buy1      |       |
    71  
    72  
    73  
    74  
    75