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

     1  Feature: Spot market
     2  
     3    Scenario: wash trade on spot market
     4      Given the fees configuration named "fees-config-1":
     5        | maker fee | infrastructure fee |
     6        | 0         | 0                  |
     7      Given the log normal risk model named "lognormal-risk-model-1":
     8        | risk aversion | tau  | mu | r   | sigma |
     9        | 0.001         | 0.01 | 0  | 0.0 | 1.2   |
    10  
    11      And the price monitoring named "price-monitoring-1":
    12        | horizon | probability | auction extension |
    13        | 360000  | 0.999       | 3                 |
    14  
    15      And the liquidity sla params named "SLA-1":
    16        | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor |
    17        | 0.99        | 0.1                          | 2                             | 0.2                    |
    18  
    19      Given the following assets are registered:
    20        | id  | decimal places |
    21        | ETH | 1              |
    22        | BTC | 1              |
    23  
    24      And the following network parameters are set:
    25        | name                                                | value |
    26        | network.markPriceUpdateMaximumFrequency             | 0s    |
    27        | market.liquidity.earlyExitPenalty                   | 0.02  |
    28        | market.liquidity.earlyExitPenalty                   | 0.5   |
    29        | market.liquidity.bondPenaltyParameter               | 0     |
    30        | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.5   |
    31        | market.liquidity.sla.nonPerformanceBondPenaltyMax   | 0.2   |
    32        | market.liquidity.maximumLiquidityFeeFactorLevel     | 0.4   |
    33        | validators.epoch.length                             | 2s    |
    34  
    35      Given time is updated to "2023-07-20T00:00:00Z"
    36  
    37      And the spot markets:
    38        | id      | name    | base asset | quote asset | risk model             | auction duration | fees          | price monitoring   | sla params |
    39        | BTC/ETH | BTC/ETH | BTC        | ETH         | lognormal-risk-model-1 | 1                | fees-config-1 | price-monitoring-1 | SLA-1      |
    40      And the following network parameters are set:
    41        | name                                             | value |
    42        | market.liquidity.providersFeeCalculationTimeStep | 1s    |
    43  
    44      Given the parties deposit on asset's general account the following amount:
    45        | party  | asset | amount |
    46        | party1 | ETH   | 10000  |
    47        | party2 | ETH   | 10000  |
    48        | party2 | BTC   | 50     |
    49        | lpprov | ETH   | 4000   |
    50        | lpprov | BTC   | 60     |
    51  
    52      And the average block duration is "1"
    53  
    54      Given the liquidity monitoring parameters:
    55        | name               | triggering ratio | time window | scaling factor |
    56        | updated-lqm-params | 0.2              | 20s         | 0.01           |
    57  
    58      When the spot markets are updated:
    59        | id      | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    60        | BTC/ETH | updated-lqm-params   | 0.5                    | 0.5                       |
    61  
    62      # Attempt to submit a liquidity request we do not have enough funds to cover (0080-SPOT-006)
    63      When the parties submit the following liquidity provision:
    64        | id  | party  | market id | commitment amount | fee | lp type    | error                                    |
    65        | lp1 | lpprov | BTC/ETH   | 5000              | 0.1 | submission | not enough collateral in general account |
    66  
    67      When the parties submit the following liquidity provision:
    68        | id  | party  | market id | commitment amount | fee | lp type    |
    69        | lp1 | lpprov | BTC/ETH   | 1000              | 0.1 | submission |
    70  
    71      Then the network moves ahead "1" blocks
    72      And the network treasury balance should be "0" for the asset "ETH"
    73      And the global insurance pool balance should be "0" for the asset "ETH"
    74      And the global insurance pool balance should be "0" for the asset "BTC"
    75      And the party "lpprov" lp liquidity fee account balance should be "0" for the market "BTC/ETH"
    76  
    77      Then "lpprov" should have general account balance of "3000" for asset "ETH"
    78      Then "lpprov" should have general account balance of "60" for asset "BTC"
    79      Then the party "lpprov" lp liquidity bond account balance should be "1000" for the market "BTC/ETH"
    80  
    81      Then the market data for the market "BTC/ETH" should be:
    82        | mark price | trading mode                 | auction trigger         | target stake | supplied stake | open interest |
    83        | 0          | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 10           | 1000           | 0             |
    84  
    85      # place orders and generate trades
    86      And the parties place the following orders:
    87        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference    | only |
    88        | lpprov | BTC/ETH   | buy  | 12     | 10    | 0                | TYPE_LIMIT | TIF_GTC | lp-order1    |      |
    89        | party1 | BTC/ETH   | buy  | 1      | 12    | 0                | TYPE_LIMIT | TIF_GTC | party-order1 |      |
    90        | party1 | BTC/ETH   | buy  | 2      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order3 |      |
    91        | party2 | BTC/ETH   | sell | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | party-order4 |      |
    92        | party2 | BTC/ETH   | sell | 1      | 19    | 0                | TYPE_LIMIT | TIF_GTC | party-order2 |      |
    93        | lpprov | BTC/ETH   | sell | 6      | 24    | 0                | TYPE_LIMIT | TIF_GTC | lp-order2    |      |
    94  
    95      When the network moves ahead "3" blocks
    96  
    97      Then the market data for the market "BTC/ETH" should be:
    98        | mark price | trading mode            | auction trigger             | horizon | min bound | max bound | target stake | supplied stake | open interest |
    99        | 15         | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 360000  | 10        | 22        | 10           | 1000           | 0             |
   100  
   101      #GTC order partially filled
   102      And the orders should have the following status:
   103        | party  | reference    | status        |
   104        | party1 | party-order3 | STATUS_ACTIVE |
   105  
   106      And the order book should have the following volumes for market "BTC/ETH":
   107        | side | price | volume |
   108        | buy  | 15    | 1      |
   109  
   110      #0024-OSTA-034, 0024-OSTA-035
   111      And the parties place the following orders:
   112        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error |
   113        | party2 | BTC/ETH   | buy  | 1      | 19    | 0                | TYPE_LIMIT | TIF_GTC | self-trade2 |       |
   114  
   115      And the orders should have the following status:
   116        | party  | reference   | status         |
   117        | party2 | self-trade2 | STATUS_STOPPED |
   118  
   119      And the parties place the following orders:
   120        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error |
   121        | party1 | BTC/ETH   | sell | 1      | 15    | 0                | TYPE_LIMIT | TIF_GTC | self-trade1 |       |
   122  
   123      And the orders should have the following status:
   124        | party  | reference   | status         |
   125        | party1 | self-trade1 | STATUS_STOPPED |
   126  
   127      Then the parties amend the following orders:
   128        | party  | reference    | price | size delta | tif     |
   129        | party2 | party-order2 | 19    | -1         | TIF_GTC |
   130      #GTT partially filled is canclled by trader
   131      And the orders should have the following status:
   132        | party  | reference    | status           |
   133        | party2 | party-order2 | STATUS_CANCELLED |
   134  
   135      #0024-OSTA-036
   136      And the parties place the following orders:
   137        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error                                                       |
   138        | party1 | BTC/ETH   | buy  | 1      | 24    | 0                | TYPE_LIMIT | TIF_FOK | FOK-OUTSIDE | OrderError: non-persistent order trades out of price bounds |
   139  
   140      And the orders should have the following status:
   141        | party  | reference   | status         |
   142        | party1 | FOK-OUTSIDE | STATUS_STOPPED |
   143  
   144      #0024-OSTA-038
   145      And the parties place the following orders:
   146        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error                                                       |
   147        | party1 | BTC/ETH   | buy  | 1      | 24    | 0                | TYPE_LIMIT | TIF_IOC | IOC-OUTSIDE | OrderError: non-persistent order trades out of price bounds |
   148  
   149      And the orders should have the following status:
   150        | party  | reference   | status         |
   151        | party1 | IOC-OUTSIDE | STATUS_STOPPED |
   152  
   153      #trigger auction
   154      And the parties place the following orders:
   155        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error |
   156        | party1 | BTC/ETH   | buy  | 1      | 24    | 0                | TYPE_LIMIT | TIF_GTC | GTC-OUTSIDE |       |
   157      And the orders should have the following status:
   158        | party  | reference   | status        |
   159        | party1 | GTC-OUTSIDE | STATUS_ACTIVE |
   160  
   161      Then the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH"
   162  
   163      #0024-OSTA-037,  Wash trading is allowed on auction
   164      And the parties place the following orders:
   165        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference   | error |
   166        | party2 | BTC/ETH   | buy  | 1      | 19    | 0                | TYPE_LIMIT | TIF_GTC | self-trade3 |       |
   167  
   168      And the orders should have the following status:
   169        | party  | reference   | status        |
   170        | party2 | self-trade3 | STATUS_ACTIVE |
   171  
   172  
   173