code.vegaprotocol.io/vega@v0.79.0/core/integration/features/orders/batch-orders.feature (about) 1 Feature: Iceberg orders 2 3 Background: 4 5 Given the log normal risk model named "lognormal-risk-model-1": 6 | risk aversion | tau | mu | r | sigma | 7 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 8 #calculated risk factor long: 0.336895684; risk factor short: 0.4878731 9 10 And the price monitoring named "price-monitoring-1": 11 | horizon | probability | auction extension | 12 | 100 | 0.99999999 | 300 | 13 And the margin calculator named "margin-calculator-1": 14 | search factor | initial factor | release factor | 15 | 1.2 | 1.5 | 2 | 16 17 And the oracle spec for settlement data filtering data from "0xCAFECAFE19" named "ethDec19Oracle": 18 | property | type | binding | 19 | prices.ETH.value | TYPE_INTEGER | settlement data | 20 21 And the oracle spec for trading termination filtering data from "0xCAFECAFE19" named "ethDec19Oracle": 22 | property | type | binding | 23 | trading.terminated | TYPE_BOOLEAN | trading termination | 24 Given the markets: 25 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 26 | ETH/DEC19 | ETH | USD | lognormal-risk-model-1 | margin-calculator-1 | 1 | default-none | price-monitoring-1 | ethDec19Oracle | 0.25 | 0 | default-futures | 27 And the following network parameters are set: 28 | name | value | 29 | market.auction.minimumDuration | 1 | 30 | network.markPriceUpdateMaximumFrequency | 0s | 31 | limits.markets.maxPeggedOrders | 1500 | 32 | network.markPriceUpdateMaximumFrequency | 0s | 33 34 @batch 35 Scenario: Batch with normal orders and icebergs, 0014-ORDT-014, 0014-ORDT-015 36 # setup accounts 37 Given the parties deposit on asset's general account the following amount: 38 | party | asset | amount | 39 | party1 | USD | 10000 | 40 | party2 | USD | 10000 | 41 | party3 | USD | 1000000000 | 42 | party4 | USD | 1000000 | 43 | party5 | USD | 1000000 | 44 | aux | USD | 1000000 | 45 | aux2 | USD | 100000 | 46 | lpprov | USD | 90000000 | 47 48 When the parties submit the following liquidity provision: 49 | id | party | market id | commitment amount | fee | lp type | 50 | lp1 | lpprov | ETH/DEC19 | 90000000 | 0.1 | submission | 51 | lp1 | lpprov | ETH/DEC19 | 90000000 | 0.1 | submission | 52 And the parties place the following pegged iceberg orders: 53 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 54 | lpprov | ETH/DEC19 | 2 | 1 | buy | BID | 50 | 100 | 55 | lpprov | ETH/DEC19 | 2 | 1 | sell | ASK | 50 | 100 | 56 57 # place auxiliary orders so we always have best bid and best offer as to not trigger the liquidity auction 58 When the parties place the following orders: 59 | party | market id | side | volume | price | resulting trades | type | tif | 60 | aux | ETH/DEC19 | buy | 1 | 99 | 0 | TYPE_LIMIT | TIF_GTC | 61 | aux | ETH/DEC19 | sell | 1 | 101 | 0 | TYPE_LIMIT | TIF_GTC | 62 | aux2 | ETH/DEC19 | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 63 | aux | ETH/DEC19 | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | 64 Then the opening auction period ends for market "ETH/DEC19" 65 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 66 And the mark price should be "100" for the market "ETH/DEC19" 67 68 And the parties place the following iceberg orders: 69 | party | market id | side | volume | price | resulting trades | type | tif | reference | peak size | minimum visible size | 70 | party1 | ETH/DEC19 | sell | 6 | 100 | 0 | TYPE_LIMIT | TIF_GTC | this-order-1 | 4 | 5 | 71 | party2 | ETH/DEC19 | sell | 3 | 100 | 0 | TYPE_LIMIT | TIF_GTC | this-order-2 | 4 | 5 | 72 | party1 | ETH/DEC19 | sell | 100 | 101 | 0 | TYPE_LIMIT | TIF_GTC | this-order-3 | 4 | 5 | 73 | party2 | ETH/DEC19 | buy | 100 | 99 | 0 | TYPE_LIMIT | TIF_GTC | this-order-4 | 4 | 5 | 74 75 And the parties should have the following account balances: 76 | party | asset | market id | margin | general | 77 | party1 | USD | ETH/DEC19 | 7758 | 2242 | 78 | party2 | USD | ETH/DEC19 | 5053 | 4947 | 79 80 # margin initial = 0.4878731*100*2*1.5 = 147 81 82 Then the party "party3" starts a batch instruction 83 84 Then the party "party3" adds the following orders to a batch: 85 | market id | side | volume | price | type | tif | reference | 86 | ETH/DEC19 | buy | 4 | 101 | TYPE_LIMIT | TIF_GTC | party3 | 87 88 Then the party "party3" adds the following iceberg orders to a batch: 89 | market id | side | volume | price | type | tif | reference | peak size | minimum visible size | 90 | ETH/DEC19 | buy | 3 | 101 | TYPE_LIMIT | TIF_GTC | this-order-5 | 2 | 1 | 91 | ETH/DEC19 | buy | 4 | 101 | TYPE_LIMIT | TIF_GTC | this-order-6 | 2 | 1 | 92 93 Then the party "party3" submits their batch instruction 94 95 #Iceberg order trading during continous mode 96 Then the following trades should be executed: 97 | buyer | seller | price | size | 98 | party3 | party1 | 100 | 4 | 99 | party3 | party2 | 100 | 3 | 100 | party3 | party1 | 100 | 2 | 101 102 And the network moves ahead "10" blocks 103 104 And the parties should have the following account balances: 105 | party | asset | market id | margin | general | 106 | party1 | USD | ETH/DEC19 | 7752 | 2242 | 107 | party2 | USD | ETH/DEC19 | 5050 | 4947 | 108 | party3 | USD | ETH/DEC19 | 828 | 999999069 | 109 110 111 #cancel an order which had been traded 112 When the parties cancel the following orders: 113 | party | reference | error | 114 | party3 | this-order-5 | unable to find the order in the market | 115 116 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 117 And the mark price should be "101" for the market "ETH/DEC19" 118 119 Then the party "party4" starts a batch instruction 120 121 Then the party "party4" adds the following iceberg orders to a batch: 122 | market id | side | volume | price | type | tif | reference | peak size | minimum visible size | 123 | ETH/DEC19 | buy | 6 | 100 | TYPE_LIMIT | TIF_GTC | this-order-7 | 3 | 1 | 124 | ETH/DEC19 | buy | 8 | 100 | TYPE_LIMIT | TIF_GTC | this-order-8 | 2 | 1 | 125 Then the party "party4" adds the following orders to a batch: 126 | market id | side | volume | price | type | tif | reference | 127 | ETH/DEC19 | buy | 8 | 100 | TYPE_LIMIT | TIF_GTC | party4-normal-order | 128 129 Then the party "party4" submits their batch instruction 130 131 And the parties should have the following account balances: 132 | party | asset | market id | margin | general | 133 | party4 | USD | ETH/DEC19 | 1123 | 998877 | 134 Then the parties should have the following margin levels: 135 | party | market id | maintenance | search | initial | release | 136 | party4 | ETH/DEC19 | 749 | 898 | 1123 | 1498 | 137 138 And the network moves ahead "10" blocks 139 140 And the parties should have the following account balances: 141 | party | asset | market id | margin | general | 142 | party4 | USD | ETH/DEC19 | 1123 | 998877 | 143 144 When the parties cancel the following orders: 145 | party | reference | 146 | party4 | party4-normal-order | 147 | party4 | this-order-7 | 148 149 #iceberg order canceled 150 Then the iceberg orders should have the following states: 151 | party | market id | side | visible volume | price | status | reserved volume | reference | 152 | party4 | ETH/DEC19 | buy | 3 | 100 | STATUS_CANCELLED | 3 | this-order-7 | 153 154 And the network moves ahead "10" blocks 155 And the parties should have the following account balances: 156 | party | asset | market id | margin | general | 157 | party4 | USD | ETH/DEC19 | 1123 | 998877 | 158 Then the parties should have the following margin levels: 159 | party | market id | maintenance | search | initial | release | 160 | party4 | ETH/DEC19 | 749 | 898 | 1123 | 1498 | 161 162 When the parties cancel the following orders: 163 | party | reference | 164 | party4 | this-order-8 | 165 166 #margin released after order cancellation 167 And the parties should have the following account balances: 168 | party | asset | market id | margin | general | 169 | party4 | USD | ETH/DEC19 | 0 | 1000000 |