code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/0032-PRIM-price_monitoring_horizon.feature (about) 1 Feature: 0032-PRIM-price-mornitoring, test horizon trigger. 2 Scenario: 001, horizon set to 3600 in price monitoring model. 0032-PRIM-001, 0032-PRIM-009, 0018-RSKM-007 3 4 Given the following network parameters are set: 5 | name | value | 6 | market.liquidity.bondPenaltyParameter | 0.2 | 7 | network.markPriceUpdateMaximumFrequency | 0s | 8 | limits.markets.maxPeggedOrders | 2 | 9 Given the liquidity monitoring parameters: 10 | name | triggering ratio | time window | scaling factor | 11 | lqm-params | 0.1 | 24h | 1.0 | 12 And the following assets are registered: 13 | id | decimal places | 14 | USD | 5 | 15 16 And the average block duration is "1" 17 And the log normal risk model named "log-normal-risk-model-1": 18 | risk aversion | tau | mu | r | sigma | 19 | 0.001 | 0.0001 | 0 | 0 | 1.5 | 20 21 # RiskFactorShort 0.0516933 22 # RiskFactorLong 0.04935184 23 24 And the fees configuration named "fees-config-1": 25 | maker fee | infrastructure fee | 26 | 0.004 | 0.001 | 27 And the price monitoring named "price-monitoring-1": 28 | horizon | probability | auction extension | 29 | 3600 | 0.99 | 300 | 30 And the markets: 31 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params | 32 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 5 | 5 | 0.25 | 0 | default-futures | 33 And the parties deposit on asset's general account the following amount: 34 | party | asset | amount | 35 | lp | USD | 10000000000000 | 36 | party1 | USD | 10000000000000 | 37 | party2 | USD | 10000000000000 | 38 39 Given the parties submit the following liquidity provision: 40 | id | party | market id | commitment amount | fee | lp type | 41 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | submission | 42 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | amendment | 43 44 And the parties place the following orders: 45 | party | market id | side | volume | price | resulting trades | type | tif | reference | 46 | party1 | ETH/MAR22 | buy | 100000 | 10000000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-3 | 47 | party1 | ETH/MAR22 | buy | 500000 | 90000000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-2 | 48 | party1 | ETH/MAR22 | buy | 500000 | 100100000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 49 | party2 | ETH/MAR22 | sell | 500000 | 95100000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-1 | 50 | party2 | ETH/MAR22 | sell | 500000 | 120000000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-2 | 51 | party2 | ETH/MAR22 | sell | 100000 | 10000000000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-3 | 52 | lp | ETH/MAR22 | sell | 325145712 | 120100000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-4 | 53 | lp | ETH/MAR22 | buy | 434371524 | 89900000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-5 | 54 55 When the opening auction period ends for market "ETH/MAR22" 56 Then the auction ends with a traded volume of "500000" at a price of "97600000" 57 # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1001 x 5 x 1 x 0.1 58 And the insurance pool balance should be "0" for the market "ETH/MAR22" 59 And the market data for the market "ETH/MAR22" should be: 60 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 61 | 97600000 | TRADING_MODE_CONTINUOUS | 3600 | 93642254 | 101698911 | 25224720 | 390500000000 | 500000 | 62 63 #check the volume on the order book 64 Then the order book should have the following volumes for market "ETH/MAR22": 65 | side | price | volume | 66 | buy | 10000000 | 100000 | 67 | buy | 90000000 | 500000 | 68 | buy | 89900000 | 434371524 | 69 | sell | 120000000 | 500000 | 70 | sell | 120100000 | 325145712 | 71 | sell | 10000000000 | 100000 | 72 73 # check the requried balances 74 And the parties should have the following account balances: 75 | party | asset | market id | margin | general | bond | 76 | lp | USD | ETH/MAR22 | 25107048175 | 9584392951825 | 390500000000 | 77 78 #check the margin levels 79 Then the parties should have the following margin levels: 80 | party | market id | maintenance | search | initial | release | 81 | lp | ETH/MAR22 | 20922540146 | 23014794160 | 25107048175 | 29291556204 | 82 83 Scenario: 002, horizon set to 360000 in price monitoring model. 0032-PRIM-001, 0032-PRIM-009 84 85 Given the following network parameters are set: 86 | name | value | 87 | market.liquidity.bondPenaltyParameter | 0.2 | 88 | network.markPriceUpdateMaximumFrequency | 0s | 89 | limits.markets.maxPeggedOrders | 2 | 90 91 And the following assets are registered: 92 | id | decimal places | 93 | USD | 5 | 94 95 And the average block duration is "1" 96 And the log normal risk model named "log-normal-risk-model-1": 97 | risk aversion | tau | mu | r | sigma | 98 | 0.001 | 0.0001 | 0 | 0 | 1.5 | 99 100 # RiskFactorShort 0.0516933 101 # RiskFactorLong 0.04935184 102 103 And the fees configuration named "fees-config-1": 104 | maker fee | infrastructure fee | 105 | 0.004 | 0.001 | 106 And the price monitoring named "price-monitoring-1": 107 | horizon | probability | auction extension | 108 | 360000 | 0.99 | 300 | 109 And the markets: 110 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params | 111 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 5 | 5 | 0.25 | 0 | default-futures | 112 And the parties deposit on asset's general account the following amount: 113 | party | asset | amount | 114 | lp | USD | 10000000000000 | 115 | party1 | USD | 10000000000000 | 116 | party2 | USD | 10000000000000 | 117 118 Given the parties submit the following liquidity provision: 119 | id | party | market id | commitment amount | fee | lp type | 120 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | submission | 121 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | amendment | 122 123 And the parties place the following orders: 124 | party | market id | side | volume | price | resulting trades | type | tif | reference | 125 | party1 | ETH/MAR22 | buy | 100000 | 10000000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-3 | 126 | party1 | ETH/MAR22 | buy | 500000 | 90000000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-2 | 127 | party1 | ETH/MAR22 | buy | 500000 | 100100000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 128 | party2 | ETH/MAR22 | sell | 500000 | 95100000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-1 | 129 | party2 | ETH/MAR22 | sell | 500000 | 120000000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-2 | 130 | party2 | ETH/MAR22 | sell | 100000 | 10000000000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-3 | 131 | lp | ETH/MAR22 | buy | 434371524 | 89900000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-4 | 132 | lp | ETH/MAR22 | sell | 325145712 | 120100000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-5 | 133 134 When the opening auction period ends for market "ETH/MAR22" 135 Then the auction ends with a traded volume of "500000" at a price of "97600000" 136 # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1001 x 5 x 1 x 0.1 137 And the insurance pool balance should be "0" for the market "ETH/MAR22" 138 139 And the market data for the market "ETH/MAR22" should be: 140 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 141 | 97600000 | TRADING_MODE_CONTINUOUS | 360000 | 63775516 | 145578912 | 25224720 | 390500000000 | 500000 | 142 143 #check the volume on the order book 144 Then the order book should have the following volumes for market "ETH/MAR22": 145 | side | price | volume | 146 | buy | 10000000 | 100000 | 147 | buy | 90000000 | 500000 | 148 | buy | 89900000 | 434371524 | 149 | sell | 120000000 | 500000 | 150 | sell | 120100000 | 325145712 | 151 | sell | 10000000000 | 100000 | 152 153 # check the requried balances 154 And the parties should have the following account balances: 155 | party | asset | market id | margin | general | bond | 156 | lp | USD | ETH/MAR22 | 25107048175 | 9584392951825 | 390500000000 | 157 158 #check the margin levels 159 Then the parties should have the following margin levels: 160 | party | market id | maintenance | search | initial | release | 161 | lp | ETH/MAR22 | 20922540146 | 23014794160 | 25107048175 | 29291556204 | 162 163 Scenario: 003, horizon set to 360000 in price monitoring model. 0032-PRIM-001, 0032-PRIM-009; 0070-MKTD-003; 0070-MKTD-004; 0070-MKTD-005; 0070-MKTD-006; 0070-MKTD-007; 0070-MKTD-008 164 # test different dps, asset: 6/market: 2/position: 1 165 166 Given the following network parameters are set: 167 | name | value | 168 | market.liquidity.bondPenaltyParameter | 0.2 | 169 | network.markPriceUpdateMaximumFrequency | 0s | 170 | limits.markets.maxPeggedOrders | 2 | 171 172 And the following assets are registered: 173 | id | decimal places | 174 | USD | 6 | 175 176 And the average block duration is "1" 177 And the log normal risk model named "log-normal-risk-model-1": 178 | risk aversion | tau | mu | r | sigma | 179 | 0.001 | 0.0001 | 0 | 0 | 1.5 | 180 181 # RiskFactorShort 0.0516933 182 # RiskFactorLong 0.04935184 183 184 And the fees configuration named "fees-config-1": 185 | maker fee | infrastructure fee | 186 | 0.004 | 0.001 | 187 And the price monitoring named "price-monitoring-1": 188 | horizon | probability | auction extension | 189 | 360000 | 0.99 | 300 | 190 And the markets: 191 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | decimal places | position decimal places | linear slippage factor | quadratic slippage factor | sla params | 192 | ETH/MAR22 | ETH | USD | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-1 | default-eth-for-future | 2 | 1 | 0.25 | 0 | default-futures | 193 And the parties deposit on asset's general account the following amount: 194 | party | asset | amount | 195 | lp | USD | 100000000000000 | 196 | party1 | USD | 100000000000000 | 197 | party2 | USD | 100000000000000 | 198 199 Given the parties submit the following liquidity provision: 200 | id | party | market id | commitment amount | fee | lp type | 201 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | submission | 202 | lp1 | lp | ETH/MAR22 | 390500000000 | 0.3 | amendment | 203 204 And the parties place the following orders: 205 | party | market id | side | volume | price | resulting trades | type | tif | reference | 206 | party1 | ETH/MAR22 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-3 | 207 | party1 | ETH/MAR22 | buy | 5 | 9000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-2 | 208 | party1 | ETH/MAR22 | buy | 5 | 10010 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 209 | party2 | ETH/MAR22 | sell | 5 | 9510 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-1 | 210 | party2 | ETH/MAR22 | sell | 5 | 12000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-2 | 211 | party2 | ETH/MAR22 | sell | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-3 | 212 | lp | ETH/MAR22 | buy | 43438 | 8990 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-4 | 213 | lp | ETH/MAR22 | sell | 32515 | 12010 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-4 | 214 215 When the opening auction period ends for market "ETH/MAR22" 216 Then the auction ends with a traded volume of "5" at a price of "9760" 217 # target_stake = mark_price x max_oi x target_stake_scaling_factor x rf = 1001 x 5 x 1 x 0.1 218 And the insurance pool balance should be "0" for the market "ETH/MAR22" 219 220 And the market data for the market "ETH/MAR22" should be: 221 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 222 | 9760 | TRADING_MODE_CONTINUOUS | 360000 | 6378 | 14557 | 2522472 | 390500000000 | 5 | 223 224 #check the volume on the order book 225 226 Then the order book should have the following volumes for market "ETH/MAR22": 227 | side | price | volume | 228 | buy | 1000 | 1 | 229 | buy | 9000 | 5 | 230 | buy | 8990 | 43438 | 231 | sell | 12000 | 5 | 232 | sell | 12010 | 32515 | 233 | sell | 1000000 | 1 | 234 235 # check the requried balances 236 And the parties should have the following account balances: 237 | party | asset | market id | margin | general | bond | 238 | lp | USD | ETH/MAR22 | 25107538095 | 99584392461905 | 390500000000 | 239 240 #check the margin levels 241 Then the parties should have the following margin levels: 242 | party | market id | maintenance | search | initial | release | 243 | lp | ETH/MAR22 | 20922948413 | 23015243254 | 25107538095 | 29292127778 | 244