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

     1  Feature: Spot Markets
     2  
     3    Scenario: If a "sell" order incurs fees through trading, the required amount of the quote_asset to cover the fees will
     4              be deducted from the total quote_asset resulting from the sale of the base_asset.(0080-SPOT-010)
     5  
     6    Background:
     7      Given the following network parameters are set:
     8        | name                                    | value |
     9        | network.markPriceUpdateMaximumFrequency | 0s    |
    10      And the average block duration is "1"
    11      Given the fees configuration named "fees-config-1":
    12        | maker fee | infrastructure fee |
    13        | 0.005     | 0.002              |
    14      And the simple risk model named "my-simple-risk-model":
    15        | long | short | max move up | min move down | probability of trading |
    16        | 0.01 | 0.01  | 10          | -10           | 0.2                    |
    17      And the fees configuration named "my-fees-config":
    18        | maker fee | infrastructure fee |
    19        | 0.004     | 0.001              |
    20      And the price monitoring named "price-monitoring":
    21        | horizon | probability | auction extension |
    22        | 3600    | 0.95        | 3                 |
    23  
    24      And the spot markets:
    25        | id      | name    | base asset | quote asset | risk model           | auction duration | fees          | price monitoring | sla params    |
    26        | BTC/ETH | BTC/ETH | BTC        | ETH         | my-simple-risk-model | 1                | fees-config-1 | price-monitoring | default-basic |
    27      # setup accounts
    28      Given the parties deposit on asset's general account the following amount:
    29        | party  | asset | amount  |
    30        | party1 | ETH   | 5000000 |
    31        | party1 | BTC   | 5000    |
    32        | party2 | ETH   | 5000000 |
    33        | party2 | BTC   | 5000    |
    34        | party4 | ETH   | 5000000 |
    35        | party4 | BTC   | 5000    |
    36        | party5 | ETH   | 5000000 |
    37        | party5 | BTC   | 5000    |
    38        
    39      # place orders to get us out of the opening auction
    40      And the parties place the following orders:
    41        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    42        | party4 | BTC/ETH   | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GFA | open-sell |
    43        | party5 | BTC/ETH   | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC | open-buy  |
    44  
    45      Then the opening auction period ends for market "BTC/ETH"
    46      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    47      And the mark price should be "100" for the market "BTC/ETH"
    48      When the network moves ahead "1" blocks
    49  
    50      # place some orders with an aggressive sell
    51      And the parties place the following orders:
    52        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    53        | party2 | BTC/ETH   | buy  | 1000   | 100   | 0                | TYPE_LIMIT | TIF_GTC | big-buy   |
    54        | party1 | BTC/ETH   | sell | 1000   | 100   | 1                | TYPE_LIMIT | TIF_GTC | big-sell  |
    55  
    56      # Check that the total amount moved to our general account = (1000*100)*(1-(0.002+0.005))
    57      #                                                          = (100,000)*(0.993)
    58      #                                                          = 99,300
    59      # So we gave up 1000 BTC in exchange for 100,000 ETH and a fee of 700 ETH
    60      Then "party1" should have general account balance of "5099300" for asset "ETH"
    61      Then "party1" should have general account balance of "4000" for asset "BTC"
    62  
    63