code.vegaprotocol.io/vega@v0.79.0/core/integration/features/orders/FOK_order_stopped.feature (about) 1 Feature: check when FOK market order unable to trade 2 3 Background: 4 Given the log normal risk model named "log-normal-risk-model-1": 5 | risk aversion | tau | mu | r | sigma | 6 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 7 #risk factor short = 3.55690359157934000 8 #risk factor long = 0.801225765 9 And the margin calculator named "margin-calculator-0": 10 | search factor | initial factor | release factor | 11 | 1.2 | 1.5 | 2 | 12 13 And the markets: 14 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 15 | ETH/DEC20 | BTC | USD | log-normal-risk-model-1 | margin-calculator-0 | 1 | default-none | default-none | default-eth-for-future | 0.25 | 0 | default-futures | 16 17 And the following network parameters are set: 18 | name | value | 19 | market.auction.minimumDuration | 1 | 20 | network.markPriceUpdateMaximumFrequency | 0s | 21 | limits.markets.maxPeggedOrders | 4 | 22 And the average block duration is "1" 23 24 Scenario: 001 FOK market order unable to trade 25 Given the parties deposit on asset's general account the following amount: 26 | party | asset | amount | 27 | auxiliary1 | USD | 1000000000000 | 28 | auxiliary2 | USD | 1000000000000 | 29 | trader2 | USD | 90000 | 30 | trader20 | USD | 10000 | 31 | trader3 | USD | 90000 | 32 | lprov | USD | 1000000000000 | 33 34 When the parties submit the following liquidity provision: 35 | id | party | market id | commitment amount | fee | lp type | 36 | lp0 | lprov | ETH/DEC20 | 5000 | 0.001 | submission | 37 | lp0 | lprov | ETH/DEC20 | 5000 | 0.001 | submission | 38 And the parties place the following pegged iceberg orders: 39 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 40 | lprov | ETH/DEC20 | 5 | 1 | sell | ASK | 5000 | 5 | 41 | lprov | ETH/DEC20 | 5000 | 1 | buy | BID | 5000 | 4 | 42 43 Then the parties place the following orders: 44 | party | market id | side | volume | price | resulting trades | type | tif | reference | 45 | auxiliary2 | ETH/DEC20 | buy | 5 | 5 | 0 | TYPE_LIMIT | TIF_GTC | aux-b-50 | 46 | auxiliary1 | ETH/DEC20 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | aux-s-10000 | 47 | auxiliary2 | ETH/DEC20 | buy | 10 | 10 | 0 | TYPE_LIMIT | TIF_GTC | aux-b-10 | 48 | auxiliary1 | ETH/DEC20 | sell | 10 | 10 | 0 | TYPE_LIMIT | TIF_GTC | aux-s-10 | 49 50 When the opening auction period ends for market "ETH/DEC20" 51 And the mark price should be "10" for the market "ETH/DEC20" 52 53 And the order book should have the following volumes for market "ETH/DEC20": 54 | side | price | volume | 55 | buy | 1 | 5000 | 56 | buy | 5 | 5 | 57 | sell | 1000 | 10 | 58 | sell | 1005 | 5 | 59 60 When the parties place the following orders with ticks: 61 | party | market id | side | volume | price | resulting trades | type | tif | reference | 62 | auxiliary1 | ETH/DEC20 | buy | 1000 | 0 | 0 | TYPE_MARKET | TIF_FOK | FOK-order-market | 63 64 And the order book should have the following volumes for market "ETH/DEC20": 65 | side | price | volume | 66 | buy | 1 | 5000 | 67 | buy | 5 | 5 | 68 | sell | 1000 | 10 | 69 | sell | 1005 | 5 | 70 71 # check the order status, it should be stopped 72 And the orders should have the following status: 73 | party | reference | status | 74 | auxiliary1 |FOK-order-market | STATUS_STOPPED | 75 76 Scenario: 002 GTC and GTT order cancellaiton 77 Given the parties deposit on asset's general account the following amount: 78 | party | asset | amount | 79 | trader1 | USD | 1000000 | 80 | trader2 | USD | 90000 | 81 | trader3 | USD | 90000 | 82 | lprov | USD | 1000000000000 | 83 84 When the parties submit the following liquidity provision: 85 | id | party | market id | commitment amount | fee | lp type | 86 | lp0 | lprov | ETH/DEC20 | 5000 | 0.001 | submission | 87 | lp0 | lprov | ETH/DEC20 | 5000 | 0.001 | submission | 88 And the parties place the following pegged iceberg orders: 89 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 90 | lprov | ETH/DEC20 | 5 | 1 | sell | ASK | 1125 | 55 | 91 | lprov | ETH/DEC20 | 5 | 1 | buy | BID | 1125 | 8 | 92 93 Then the parties place the following orders: 94 | party | market id | side | volume | price | resulting trades | type | tif | reference | 95 | trader2 | ETH/DEC20 | buy | 5 | 9 | 0 | TYPE_LIMIT | TIF_GTC | aux-b-50 | 96 | trader2 | ETH/DEC20 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | aux-s-10000 | 97 | trader2 | ETH/DEC20 | buy | 10 | 10 | 0 | TYPE_LIMIT | TIF_GTC | aux-b-10 | 98 | trader3 | ETH/DEC20 | sell | 10 | 10 | 0 | TYPE_LIMIT | TIF_GTC | aux-s-10 | 99 100 When the opening auction period ends for market "ETH/DEC20" 101 And the mark price should be "10" for the market "ETH/DEC20" 102 103 When the parties place the following orders with ticks: 104 | party | market id | side | volume | price | resulting trades | type | tif | reference | 105 | trader1 | ETH/DEC20 | buy | 1000 | 8 | 0 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-8 | 106 | trader1 | ETH/DEC20 | buy | 1000 | 7 | 0 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-7 | 107 108 And the parties should have the following account balances: 109 | party | asset | market id | margin | general | 110 | trader1 | USD | ETH/DEC20 | 24022 | 975978 | 111 | lprov | USD | ETH/DEC20 | 60024 | 999999934976 | 112 113 # test LP reduce commitment, margin release 114 And the parties submit the following liquidity provision: 115 | id | party | market id | commitment amount| fee | lp type | 116 | lp1 | lprov | ETH/DEC20 | 4000 | 0.001 | amendment | 117 | lp1 | lprov | ETH/DEC20 | 4000 | 0.001 | amendment | 118 And the parties place the following pegged iceberg orders: 119 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 120 | lprov | ETH/DEC20 | 2 | 1 | sell | ASK | 100 | 55 | 121 | lprov | ETH/DEC20 | 2 | 1 | buy | BID | 100 | 55 | 122 And the parties should have the following account balances: 123 | party | asset | market id | margin | general | 124 | trader1 | USD | ETH/DEC20 | 24022 | 975978 | 125 126 # test GTC order cancelation 127 And the parties cancel the following orders: 128 | party | reference | 129 | trader1 | GTC-order-limit-8 | 130 # check the order status, it should be stopped 131 And the orders should have the following status: 132 | party | reference | status | 133 | trader1 |GTC-order-limit-8| STATUS_CANCELLED | 134 135 And the parties should have the following account balances: 136 | party | asset | market id | margin | general | 137 | trader1 | USD | ETH/DEC20 | 24022 | 975978 | 138 139 When the parties place the following orders with ticks: 140 | party | market id | side | volume | price | resulting trades | type | tif | reference | 141 | trader2 | ETH/DEC20 | buy | 1 | 10 | 0 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-0 | 142 | trader3 | ETH/DEC20 | sell | 1 | 10 | 1 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-1 | 143 144 And the parties should have the following account balances: 145 | party | asset | market id | margin | general | 146 | trader1 | USD | ETH/DEC20 | 12012 | 987988 | 147 148 # test GTT order cancelation 149 When the parties place the following orders with ticks: 150 | party | market id | side | volume | price | resulting trades | type | tif | reference | expires in | 151 | trader1 | ETH/DEC20 | buy | 1000 | 8 | 0 | TYPE_LIMIT | TIF_GTT | GTT-order-limit-8 | 2 | 152 153 And the parties should have the following account balances: 154 | party | asset | market id | margin | general | 155 | trader1 | USD | ETH/DEC20 | 24022 | 975978 | 156 157 # test GTT order cancelation 158 And the parties cancel the following orders: 159 | party | reference | 160 | trader1 | GTT-order-limit-8 | 161 # check the order status, it should be stopped 162 And the orders should have the following status: 163 | party | reference | status | 164 | trader1 |GTT-order-limit-8| STATUS_CANCELLED | 165 166 And the parties should have the following account balances: 167 | party | asset | market id | margin | general | 168 | trader1 | USD | ETH/DEC20 | 24022 | 975978 | 169 170 When the parties place the following orders with ticks: 171 | party | market id | side | volume | price | resulting trades | type | tif | reference | 172 | trader2 | ETH/DEC20 | buy | 1 | 10 | 0 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-0 | 173 | trader3 | ETH/DEC20 | sell | 1 | 10 | 1 | TYPE_LIMIT | TIF_GTC | GTC-order-limit-1 | 174 175 And the parties should have the following account balances: 176 | party | asset | market id | margin | general | 177 | trader1 | USD | ETH/DEC20 | 12012 | 987988 |