code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0024-OSTA-033.feature (about)

     1  Feature: Spot market
     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 | 2              |
    13        | BTC | 2              |
    14  
    15      Given the fees configuration named "fees-config-1":
    16        | maker fee | infrastructure fee |
    17        | 0.01      | 0.03               |
    18      Given the log normal risk model named "lognormal-risk-model-1":
    19        | risk aversion | tau  | mu | r   | sigma |
    20        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    21      And the price monitoring named "price-monitoring-1":
    22        | horizon | probability | auction extension |
    23        | 360000  | 0.999       | 1                 |
    24  
    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 | 2              | 2                       | 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   | 10000  |
    33        | party1 | BTC   | 1000   |
    34        | party2 | ETH   | 100000 |
    35        | party2 | BTC   | 1000   |
    36        | party3 | ETH   | 100000 |
    37        | party5 | BTC   | 1000   |
    38      And the average block duration is "1"
    39  
    40      # Place some orders to get out of auction
    41      And the parties place the following orders:
    42        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    43        | party1 | BTC/ETH   | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GFA |
    44        | party5 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    45  
    46      And the opening auction period ends for market "BTC/ETH"
    47      When the network moves ahead "1" blocks
    48      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH"
    49  
    50    Scenario: 0024-OSTA-033 GTT order on spot market
    51  
    52      And the parties place the following orders:
    53        | party  | market id | side | volume | price | resulting trades | type       | tif     | expires in | reference |
    54        | party1 | BTC/ETH   | buy  | 2      | 996   | 0                | TYPE_LIMIT | TIF_GTT | 3          | p1-buy1   |
    55        | party1 | BTC/ETH   | buy  | 2      | 997   | 0                | TYPE_LIMIT | TIF_GTT | 3          | p1-buy2   |
    56        | party1 | BTC/ETH   | buy  | 2      | 998   | 0                | TYPE_LIMIT | TIF_GTT | 3          | p1-buy3   |
    57        | party1 | BTC/ETH   | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTT | 3          | p1-buy4   |
    58        | party2 | BTC/ETH   | sell | 1      | 999   | 1                | TYPE_LIMIT | TIF_GTT | 3          | p2-sell1  |
    59        | party2 | BTC/ETH   | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTT | 1          | p2-sell2  |
    60      When the network moves ahead "1" blocks
    61  
    62      # GTT order no filled, partially filled, and GTT order expires
    63      And the orders should have the following status:
    64        | party  | reference | status         |
    65        | party1 | p1-buy1   | STATUS_ACTIVE  |
    66        | party1 | p1-buy2   | STATUS_ACTIVE  |
    67        | party1 | p1-buy3   | STATUS_ACTIVE  |
    68        | party2 | p2-sell1  | STATUS_FILLED  |
    69        | party2 | p2-sell2  | STATUS_EXPIRED |
    70  
    71      And the order book should have the following volumes for market "BTC/ETH":
    72        | side | price | volume |
    73        | buy  | 999   | 1      |
    74  
    75      And the parties place the following orders:
    76        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
    77        | party2 | BTC/ETH   | sell | 1      | 999   | 1                | TYPE_LIMIT | TIF_GTT | p2-sell3  | 2          |
    78      #GTT order filled
    79      And the orders should have the following status:
    80        | party  | reference | status        |
    81        | party1 | p1-buy4   | STATUS_FILLED |
    82  
    83      And the order book should have the following volumes for market "BTC/ETH":
    84        | side | price | volume |
    85        | buy  | 999   | 0      |
    86  
    87      And the parties place the following orders:
    88        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
    89        | party2 | BTC/ETH   | sell | 1      | 998   | 1                | TYPE_LIMIT | TIF_GTT | p2-sell3  | 2          |
    90      #GTCT order partially filled
    91      And the orders should have the following status:
    92        | party  | reference | status        |
    93        | party1 | p1-buy3   | STATUS_ACTIVE |
    94  
    95      And the order book should have the following volumes for market "BTC/ETH":
    96        | side | price | volume |
    97        | buy  | 998   | 1      |
    98  
    99      Then the parties amend the following orders:
   100        | party  | reference | price | size delta | tif     | expiration date      |
   101        | party1 | p1-buy3   | 998   | -1         | TIF_GTT | 2030-11-30T00:00:00Z |
   102      #GTT partially filled is canclled by trader
   103      And the orders should have the following status:
   104        | party  | reference | status           |
   105        | party1 | p1-buy3   | STATUS_CANCELLED |
   106  
   107      #GTT order rejected by system
   108      And the parties place the following orders:
   109        | party  | market id | side | volume | price | resulting trades | type       | tif     | expires in | reference | error                                                              |
   110        | party5 | BTC/ETH   | sell | 5000   | 998   | 0                | TYPE_LIMIT | TIF_GTT | 3          | p5-sell2  | party does not have sufficient balance to cover the trade and fees |
   111  
   112      And the parties place the following orders:
   113        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
   114        | party2 | BTC/ETH   | sell | 1      | 997   | 1                | TYPE_LIMIT | TIF_GTT | p2-sell4  | 2          |
   115  
   116      #GTT order filled
   117      And the orders should have the following status:
   118        | party  | reference | status        |
   119        | party2 | p2-sell4  | STATUS_FILLED |
   120  
   121      And the parties place the following orders:
   122        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference | expires in |
   123        | party2 | BTC/ETH   | sell | 2      | 997   | 1                | TYPE_LIMIT | TIF_GTT | p2-sell5  | 2          |
   124  
   125      #GTT order partially filled
   126      And the orders should have the following status:
   127        | party  | reference | status        |
   128        | party2 | p2-sell5  | STATUS_ACTIVE |
   129      When the network moves ahead "2" blocks
   130  
   131      And the order book should have the following volumes for market "BTC/ETH":
   132        | side | price | volume |
   133        | sell | 997   | 0      |
   134      #GTT partially filled order is expired
   135      And the orders should have the following status:
   136        | party  | reference | status         |
   137        | party2 | p2-sell5  | STATUS_EXPIRED |