code.vegaprotocol.io/vega@v0.79.0/core/integration/features/closeouts/network-order-and-trades-sub.feature (about)

     1  Feature: Ensure network party are generated
     2  
     3    Background:
     4  
     5      Given the markets:
     6        | id        | quote name | asset | risk model                  | margin calculator                  | auction duration | fees         | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params      |
     7        | ETH/DEC19 | BTC        | BTC   | default-simple-risk-model-2 | default-overkill-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 1e3                    | 1e3                       | default-futures |
     8      And the following network parameters are set:
     9        | name                                    | value |
    10        | market.auction.minimumDuration          | 1     |
    11        | network.markPriceUpdateMaximumFrequency | 0s    |
    12  
    13    Scenario: Implement trade and order network
    14      # setup accounts
    15      Given the parties deposit on asset's general account the following amount:
    16        | party            | asset | amount        |
    17        | sellSideProvider | BTC   | 1000000000000 |
    18        | buySideProvider  | BTC   | 1000000000000 |
    19        | designatedLoser  | BTC   | 12000         |
    20        | aux              | BTC   | 1000000000000 |
    21        | aux2             | BTC   | 1000000000000 |
    22  
    23      # insurance pool generation - setup orderbook
    24      When the parties place the following orders:
    25        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference       |
    26        | sellSideProvider | ETH/DEC19 | sell | 290    | 150   | 0                | TYPE_LIMIT | TIF_GTC | sell-provider-1 |
    27        | buySideProvider  | ETH/DEC19 | buy  | 1      | 140   | 0                | TYPE_LIMIT | TIF_GTC | buy-provider-1  |
    28        | aux              | ETH/DEC19 | sell | 100    | 159   | 0                | TYPE_LIMIT | TIF_GTC | aux-s-1         |
    29        | aux              | ETH/DEC19 | sell | 1      | 149   | 0                | TYPE_LIMIT | TIF_GTC | aux-s-2         |
    30        | aux2             | ETH/DEC19 | buy  | 1      | 149   | 0                | TYPE_LIMIT | TIF_GTC | aux-b-1         |
    31        | aux2             | ETH/DEC19 | buy  | 100    | 140   | 0                | TYPE_LIMIT | TIF_GTC | aux-b-2         |
    32      Then the opening auction period ends for market "ETH/DEC19"
    33      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    34  
    35      # insurance pool generation - trade
    36      When the parties place the following orders "1" blocks apart:
    37        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    38        | designatedLoser  | ETH/DEC19 | buy  | 290    | 150   | 1                | TYPE_LIMIT | TIF_GTC | ref-1     |
    39      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    40  
    41      When the parties place the following orders:
    42        | party           | market id | side | volume | price | resulting trades | type       | tif     | reference      |
    43        | buySideProvider | ETH/DEC19 | buy  | 400    | 40    | 0                | TYPE_LIMIT | TIF_GTC | buy-provider-2 |
    44      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    45  
    46      # insurance pool generation - set new mark price (and trigger closeout)
    47      When the parties place the following orders "1" blocks apart:
    48        | party            | market id | side | volume | price | resulting trades | type       | tif     | reference |
    49        | sellSideProvider | ETH/DEC19 | sell | 1      | 120   | 0                | TYPE_LIMIT | TIF_GTC | ref-1     |
    50        | buySideProvider  | ETH/DEC19 | buy  | 1      | 120   | 1                | TYPE_LIMIT | TIF_GTC | ref-2     |
    51      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19"
    52  
    53      And debug trades
    54      # check the network trades happened
    55      Then the following network trades should be executed:
    56        | party           | aggressor side | volume |
    57        | designatedLoser | buy            | 290    |
    58        | buySideProvider | sell           | 1      |
    59        | aux2            | sell           | 100    |
    60        | buySideProvider | sell           | 189    |