code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/orders/0068-MATC-060.feature (about) 1 Feature: Spot market matching engine 2 3 @MATC 4 Scenario: 0068-MATC-060: Any persistent order that is currently ACTIVE or PARKED can be cancelled. 5 6 Given time is updated to "2023-07-20T00:00:00Z" 7 8 Given the fees configuration named "fees-config-1": 9 | maker fee | infrastructure fee | 10 | 0 | 0 | 11 Given the log normal risk model named "lognormal-risk-model-1": 12 | risk aversion | tau | mu | r | sigma | 13 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 14 15 And the price monitoring named "price-monitoring-1": 16 | horizon | probability | auction extension | 17 | 36000 | 0.999 | 3 | 18 19 And the liquidity sla params named "SLA-1": 20 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 21 | 1 | 0.6 | 2 | 0.2 | 22 23 Given the following assets are registered: 24 | id | decimal places | 25 | ETH | 1 | 26 | BTC | 1 | 27 28 And the following network parameters are set: 29 | name | value | 30 | network.markPriceUpdateMaximumFrequency | 2s | 31 | market.liquidity.earlyExitPenalty | 0.25 | 32 | market.liquidity.bondPenaltyParameter | 0.2 | 33 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.7 | 34 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.6 | 35 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4 | 36 | validators.epoch.length | 2s | 37 | limits.markets.maxPeggedOrders | 10 | 38 39 And the spot markets: 40 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 41 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | SLA-1 | 42 And the following network parameters are set: 43 | name | value | 44 | market.liquidity.providersFeeCalculationTimeStep | 1s | 45 | market.liquidity.stakeToCcyVolume | 1 | 46 47 Given the parties deposit on asset's general account the following amount: 48 | party | asset | amount | 49 | party1 | ETH | 10000 | 50 | party2 | BTC | 500 | 51 | lp1 | ETH | 4000 | 52 | lp1 | BTC | 60 | 53 | lp2 | ETH | 4000 | 54 | lp2 | BTC | 60 | 55 56 And the average block duration is "1" 57 58 Given the liquidity monitoring parameters: 59 | name | triggering ratio | time window | scaling factor | 60 | updated-lqm-params | 0.2 | 20s | 0.8 | 61 62 When the spot markets are updated: 63 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 64 | BTC/ETH | updated-lqm-params | 0.5 | 0.5 | 65 66 When the parties submit the following liquidity provision: 67 | id | party | market id | commitment amount | fee | lp type | 68 | lp1 | lp1 | BTC/ETH | 3000 | 0.1 | submission | 69 70 Then the network moves ahead "1" blocks 71 72 Then the market data for the market "BTC/ETH" should be: 73 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 74 | 0 | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 2400 | 3000 | 0 | 75 76 #0068-MATC-084: GFN order rejected 77 And the parties place the following orders: 78 | party | market id | side | volume | price | resulting trades | type | tif | reference | expires in | error | 79 | party1 | BTC/ETH | buy | 4 | 8 | 0 | TYPE_LIMIT | TIF_GTC | party-order5 | | | 80 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order3 | | | 81 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | party-order4 | | | 82 | party2 | BTC/ETH | sell | 6 | 24 | 0 | TYPE_LIMIT | TIF_GTC | party-order6 | | | 83 84 When the network moves ahead "2" blocks 85 86 Then the following trades should be executed: 87 | buyer | price | size | seller | 88 | party1 | 15 | 1 | party2 | 89 90 Then the market data for the market "BTC/ETH" should be: 91 | mark price | trading mode | auction trigger | horizon | min bound | max bound | 92 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 36000 | 14 | 17 | 93 94 And the parties place the following orders: 95 | party | market id | side | volume | price | resulting trades | type | tif | reference | expires in | error | 96 | party1 | BTC/ETH | buy | 1 | 8 | 0 | TYPE_LIMIT | TIF_GFN | party1-GFN | | | 97 | party1 | BTC/ETH | buy | 1 | 8 | 0 | TYPE_LIMIT | TIF_GTT | party1-GTT | 10 | | 98 99 #trigger auction 100 And the parties place the following orders: 101 | party | market id | side | volume | price | resulting trades | type | tif | 102 | party1 | BTC/ETH | buy | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | 103 | party2 | BTC/ETH | sell | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | 104 105 Then the market data for the market "BTC/ETH" should be: 106 | mark price | trading mode | auction trigger | 107 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 108 109 #0068-MATC-084: GFN order rejected 110 #0068-MATC-085: GTT order stays ACTIVE 111 Then the orders should have the following status: 112 | party | reference | status | 113 | party1 | party1-GFN | STATUS_CANCELLED | 114 | party1 | party1-GTT | STATUS_ACTIVE | 115 116 #0068-MATC-080: orders are placed into the book and no matching takes place. 117 #0068-MATC-081: post only orders are placed into the book and no matching takes place. 118 And the parties place the following orders: 119 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 120 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GFA | party1-GFA | | 121 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | | | 122 | party1 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | | | 123 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | | post | 124 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | | post | 125 126 And the parties place the following pegged orders: 127 | party | market id | side | volume | pegged reference | offset | reference | 128 | lp1 | BTC/ETH | buy | 2 | BID | 3 | lp1-peg-b | 129 | lp1 | BTC/ETH | sell | 2 | ASK | 3 | lp1-peg-s | 130 131 #0068-MATC-083: pegged order is parked during auction 132 Then the orders should have the following status: 133 | party | reference | status | 134 | lp1 | lp1-peg-b | STATUS_PARKED | 135 | lp1 | lp1-peg-s | STATUS_PARKED | 136 | party1 | party1-GFA | STATUS_ACTIVE | 137 138 When the parties cancel the following orders: 139 | party | reference | 140 | lp1 | lp1-peg-b | 141 | party1 | party1-GFA | 142 Then the orders should have the following status: 143 | party | reference | status | 144 | lp1 | lp1-peg-b | STATUS_CANCELLED | 145 | lp1 | lp1-peg-s | STATUS_PARKED | 146 | party1 | party1-GFA | STATUS_CANCELLED |