code.vegaprotocol.io/vega@v0.79.0/core/integration/features/margin/0019-MCAL-145.feature (about) 1 Feature: pegged order in isoalted margin is not supported during auction 2 Background: 3 Given the following network parameters are set: 4 | name | value | 5 | network.markPriceUpdateMaximumFrequency | 0s | 6 | limits.markets.maxPeggedOrders | 6 | 7 And the price monitoring named "my-price-monitoring-1": 8 | horizon | probability | auction extension | 9 | 5 | 0.99 | 6 | 10 11 And the liquidity monitoring parameters: 12 | name | triggering ratio | time window | scaling factor | 13 | lqm-params | 0.00 | 24h | 1e-9 | 14 And the simple risk model named "simple-risk-model": 15 | long | short | max move up | min move down | probability of trading | 16 | 0.1 | 0.2 | 100 | -100 | 0.2 | 17 And the markets: 18 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | position decimal places | sla params | 19 | ETH/FEB23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | my-price-monitoring-1 | default-eth-for-future | 0.25 | 0 | 2 | default-futures | 20 21 And the following network parameters are set: 22 | name | value | 23 | market.auction.minimumDuration | 1 | 24 Given the average block duration is "1" 25 26 Scenario: 001 (0019-MCAL-145) A market in auction and party with a partially filled pegged order switches from cross margin mode to isolated margin mode the unfilled portion of the pegged order is cancelled 27 Given the parties deposit on asset's general account the following amount: 28 | party | asset | amount | 29 | buySideProvider | USD | 100000000000 | 30 | sellSideProvider | USD | 100000000000 | 31 | party1 | USD | 158550 | 32 | aux | USD | 1585510000 | 33 34 When the parties submit the following liquidity provision: 35 | id | party | market id | commitment amount | fee | lp type | 36 | lp1 | party1 | ETH/FEB23 | 1000 | 0.1 | submission | 37 38 And the parties place the following orders: 39 | party | market id | side | volume | price | resulting trades | type | tif | reference | 40 | buySideProvider | ETH/FEB23 | buy | 1000 | 15600 | 0 | TYPE_LIMIT | TIF_GTC | | 41 | buySideProvider | ETH/FEB23 | buy | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | | 42 | buySideProvider | ETH/FEB23 | buy | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | | 43 | sellSideProvider | ETH/FEB23 | sell | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | | 44 | sellSideProvider | ETH/FEB23 | sell | 100 | 15810 | 0 | TYPE_LIMIT | TIF_GTC | | 45 | sellSideProvider | ETH/FEB23 | sell | 1000 | 200100 | 0 | TYPE_LIMIT | TIF_GTC | | 46 47 When the network moves ahead "2" blocks 48 And the market data for the market "ETH/FEB23" should be: 49 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 50 | 15800 | TRADING_MODE_CONTINUOUS | 5 | 15701 | 15899 | 0 | 1000 | 100 | 51 52 #now we try to place short pegged order which does offset the current short position, order margin should be 0 53 When the parties place the following pegged orders: 54 | party | market id | side | volume | pegged reference | offset | reference | 55 | party1 | ETH/FEB23 | buy | 200 | BID | 10 | buy_peg_1 | 56 | party1 | ETH/FEB23 | buy | 200 | BID | 100 | buy_peg_2 | 57 And the parties place the following orders: 58 | party | market id | side | volume | price | resulting trades | type | tif | 59 | aux | ETH/FEB23 | sell | 200 | 15790 | 2 | TYPE_LIMIT | TIF_GTC | 60 61 And the following trades should be executed: 62 | buyer | price | size | seller | 63 | party1 | 15790 | 100 | aux | 64 65 Then the orders should have the following status: 66 | party | reference | status | 67 | party1 | buy_peg_1 | STATUS_ACTIVE | 68 | party1 | buy_peg_2 | STATUS_ACTIVE | 69 70 And the parties place the following orders: 71 | party | market id | side | volume | price | resulting trades | type | tif | 72 | aux | ETH/FEB23 | sell | 2 | 15600 | 0 | TYPE_LIMIT | TIF_GTC | 73 74 And the market data for the market "ETH/FEB23" should be: 75 | mark price | trading mode | 76 | 15800 | TRADING_MODE_MONITORING_AUCTION | 77 78 And the parties submit update margin mode: 79 | party | market | margin_mode | margin_factor | error | 80 | party1 | ETH/FEB23 | isolated margin | 0.5 | | 81 82 Then the orders should have the following status: 83 | party | reference | status | 84 | party1 | buy_peg_1 | STATUS_CANCELLED | 85 | party1 | buy_peg_2 | STATUS_CANCELLED | 86 87 Scenario: 002 (0019-MCAL-146) A market in an auction and party with a partially filled iceberg pegged order switches from cross margin mode to isolated margin mode the unfilled portion of the iceberg pegged order is cancelled 88 Given the parties deposit on asset's general account the following amount: 89 | party | asset | amount | 90 | buySideProvider | USD | 100000000000 | 91 | sellSideProvider | USD | 100000000000 | 92 | party1 | USD | 158550 | 93 | aux | USD | 1585510000 | 94 95 When the parties submit the following liquidity provision: 96 | id | party | market id | commitment amount | fee | lp type | 97 | lp1 | party1 | ETH/FEB23 | 1000 | 0.1 | submission | 98 99 And the parties place the following orders: 100 | party | market id | side | volume | price | resulting trades | type | tif | 101 | buySideProvider | ETH/FEB23 | buy | 1000 | 15600 | 0 | TYPE_LIMIT | TIF_GTC | 102 | buySideProvider | ETH/FEB23 | buy | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | 103 | buySideProvider | ETH/FEB23 | buy | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | 104 | sellSideProvider | ETH/FEB23 | sell | 100 | 15800 | 0 | TYPE_LIMIT | TIF_GTC | 105 | sellSideProvider | ETH/FEB23 | sell | 100 | 15810 | 0 | TYPE_LIMIT | TIF_GTC | 106 | sellSideProvider | ETH/FEB23 | sell | 1000 | 200100 | 0 | TYPE_LIMIT | TIF_GTC | 107 108 When the network moves ahead "2" blocks 109 And the market data for the market "ETH/FEB23" should be: 110 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 111 | 15800 | TRADING_MODE_CONTINUOUS | 5 | 15701 | 15899 | 0 | 1000 | 100 | 112 113 And the parties place the following pegged iceberg orders: 114 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | reference | 115 | party1 | ETH/FEB23 | 200 | 200 | buy | BID | 200 | 10 | buy_peg_1 | 116 | party1 | ETH/FEB23 | 200 | 200 | buy | BID | 200 | 100 | buy_peg_2 | 117 118 And the parties place the following orders: 119 | party | market id | side | volume | price | resulting trades | type | tif | 120 | aux | ETH/FEB23 | sell | 200 | 15790 | 2 | TYPE_LIMIT | TIF_GTC | 121 122 And the following trades should be executed: 123 | buyer | price | size | seller | 124 | party1 | 15790 | 100 | aux | 125 126 Then the orders should have the following status: 127 | party | reference | status | 128 | party1 | buy_peg_1 | STATUS_ACTIVE | 129 | party1 | buy_peg_2 | STATUS_ACTIVE | 130 131 And the parties place the following orders: 132 | party | market id | side | volume | price | resulting trades | type | tif | 133 | aux | ETH/FEB23 | sell | 2 | 15600 | 0 | TYPE_LIMIT | TIF_GTC | 134 135 And the market data for the market "ETH/FEB23" should be: 136 | mark price | trading mode | 137 | 15800 | TRADING_MODE_MONITORING_AUCTION | 138 139 And the parties submit update margin mode: 140 | party | market | margin_mode | margin_factor | error | 141 | party1 | ETH/FEB23 | isolated margin | 0.5 | | 142 143 Then the orders should have the following status: 144 | party | reference | status | 145 | party1 | buy_peg_1 | STATUS_CANCELLED | 146 | party1 | buy_peg_2 | STATUS_CANCELLED | 147 148 #