code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0068-MATC-068.feature (about)

     1  Feature: Spot market FOK limit and market order
     2  
     3    Background:
     4  
     5      Given the following network parameters are set:
     6        | name                                    | value |
     7        | network.markPriceUpdateMaximumFrequency | 0s    |
     8        | market.value.windowLength               | 1h    |
     9  
    10      Given the following assets are registered:
    11        | id  | decimal places |
    12        | ETH | 0              |
    13        | BTC | 0              |
    14  
    15      Given the fees configuration named "fees-config-1":
    16        | maker fee | infrastructure fee |
    17        | 0.01      | 0.03               |
    18  
    19      Given the log normal risk model named "lognormal-risk-model-1":
    20        | risk aversion | tau  | mu | r   | sigma |
    21        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    22      And the price monitoring named "price-monitoring-1":
    23        | horizon | probability | auction extension |
    24        | 360000  | 0.999       | 1                 |
    25      And the spot markets:
    26        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | decimal places | position decimal places | sla params    |
    27        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | 0              | 0                       | default-basic |
    28  
    29      # setup accounts
    30      Given the parties deposit on asset's general account the following amount:
    31        | party  | asset | amount |
    32        | party1 | ETH   | 40000  |
    33        | party2 | ETH   | 10000  |
    34        | party3 | ETH   | 10000  |
    35        | party4 | BTC   | 900    |
    36        | party5 | BTC   | 900    |
    37      And the average block duration is "1"
    38      # Place some orders to get out of auction
    39      And the parties place the following orders:
    40        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    41        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFA |
    42        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    43      And the opening auction period ends for market "BTC/ETH"
    44      When the network moves ahead "1" blocks
    45      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    46  
    47    Scenario: test FOK limit order and market order (0068-MATC-067, 0068-MATC-068, 0068-MATC-069)
    48  
    49      # Place a buy order
    50      Given the parties place the following orders:
    51        | party  | market id | side | volume | price | resulting trades | type        | tif     | reference | error |
    52        | party1 | BTC/ETH   | buy  | 10     | 1000  | 0                | TYPE_LIMIT  | TIF_GTC | buy1      |       |
    53        | party5 | BTC/ETH   | sell | 5      | 1000  | 1                | TYPE_MARKET | TIF_FOK | sell1     |       |
    54        | party5 | BTC/ETH   | sell | 15     | 1000  | 0                | TYPE_MARKET | TIF_FOK | sell2     |       |
    55        | party4 | BTC/ETH   | sell | 1      | 1000  | 1                | TYPE_LIMIT  | TIF_FOK | sell3     |       |
    56        | party4 | BTC/ETH   | sell | 6      | 1000  | 0                | TYPE_LIMIT  | TIF_FOK | sell4     |       |
    57  
    58      And "party5" should have general account balance of "894" for asset "BTC"
    59      And "party5" should have holding account balance of "0" for asset "BTC"
    60      And "party4" should have general account balance of "899" for asset "BTC"
    61  
    62      #0068-MATC-067,Incoming MARKET orders will be matched fully if the volume is available, otherwise the order is cancelled.
    63      #0068-MATC-068,Incoming FOK limit order will be fully matched if possible to the other side of the book  
    64      #0068-MATC-069,for incoming FOK limit order, if a complete fill is not possible the order is stopped without trading at all.
    65      Then the orders should have the following status:
    66        | party  | reference | status         |
    67        | party1 | buy1      | STATUS_ACTIVE  |
    68        | party5 | sell1     | STATUS_FILLED  |
    69        | party5 | sell2     | STATUS_STOPPED |
    70        | party4 | sell3     | STATUS_FILLED  |
    71        | party4 | sell4     | STATUS_STOPPED |
    72  
    73      And "party4" should have general account balance of "899" for asset "BTC"
    74      And "party5" should have general account balance of "894" for asset "BTC"