code.vegaprotocol.io/vega@v0.79.0/core/integration/features/price_monitoring/volume-near-price-mon-bounds-2.feature (about) 1 # Test volume and margin when LP volume is pushed inside price monitoring bounds 2 # and the price monitoring bounds happen to be best bid/ask 3 Feature: Test margin for lp near price monitoring boundaries 4 Background: 5 Given the following network parameters are set: 6 | name | value | 7 | market.value.windowLength | 1h | 8 | network.markPriceUpdateMaximumFrequency | 0s | 9 | limits.markets.maxPeggedOrders | 2 | 10 And the liquidity monitoring parameters: 11 | name | triggering ratio | time window | scaling factor | 12 | lqm-params | 0.00 | 24h | 1 | 13 And the average block duration is "1" 14 15 Scenario: second scenario for volume at near price monitoring bounds with log-normal 16 17 Given the log normal risk model named "log-normal-risk-model-1": 18 | risk aversion | tau | mu | r | sigma | 19 | 0.000001 | 0.00273 | 0 | 0 | 1.2 | 20 And the fees configuration named "fees-config-1": 21 | maker fee | infrastructure fee | 22 | 0.004 | 0.001 | 23 And the price monitoring named "price-monitoring-2": 24 | horizon | probability | auction extension | 25 | 43200 | 0.982 | 300 | 26 And the liquidity sla params named "SLA": 27 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 28 | 1.0 | 0.5 | 1 | 1.0 | 29 And the markets: 30 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | 31 | ETH2/MAR22 | ETH2 | ETH2 | lqm-params | log-normal-risk-model-1 | default-margin-calculator | 1 | fees-config-1 | price-monitoring-2 | default-eth-for-future | 0.25 | 0 | SLA | 32 And the following network parameters are set: 33 | name | value | 34 | market.liquidity.providersFeeCalculationTimeStep | 600s | 35 And the oracles broadcast data signed with "0xDEADBEEF": 36 | name | value | 37 | prices.ETH2.value | 100000 | 38 And the parties deposit on asset's general account the following amount: 39 | party | asset | amount | 40 | lp1 | ETH2 | 10000000000 | 41 | party1 | ETH2 | 1000000000 | 42 | party2 | ETH2 | 1000000000 | 43 44 Given the parties submit the following liquidity provision: 45 | id | party | market id | commitment amount | fee | lp type | 46 | commitment1 | lp1 | ETH2/MAR22 | 3000000 | 0.001 | submission | 47 | commitment1 | lp1 | ETH2/MAR22 | 3000000 | 0.001 | amendment | 48 And the parties place the following pegged iceberg orders: 49 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 50 | lp1 | ETH2/MAR22 | 34 | 1 | buy | BID | 34 | 100 | 51 | lp1 | ETH2/MAR22 | 28 | 1 | sell | ASK | 28 | 100 | 52 53 And the parties place the following orders: 54 | party | market id | side | volume | price | resulting trades | type | tif | reference | 55 | party1 | ETH2/MAR22 | buy | 1 | 89942 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-1 | 56 | party1 | ETH2/MAR22 | buy | 10 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-2 | 57 | party2 | ETH2/MAR22 | sell | 1 | 110965 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-1 | 58 | party2 | ETH2/MAR22 | sell | 10 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | sell-ref-2 | 59 60 When the opening auction period ends for market "ETH2/MAR22" 61 Then the auction ends with a traded volume of "10" at a price of "100000" 62 63 And the parties should have the following profit and loss: 64 | party | volume | unrealised pnl | realised pnl | 65 | party1 | 10 | 0 | 0 | 66 | party2 | -10 | 0 | 0 | 67 68 And the market data for the market "ETH2/MAR22" should be: 69 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 70 | 100000 | TRADING_MODE_CONTINUOUS | 43200 | 89942 | 110965 | 361190 | 3000000 | 10 | 71 72 And the order book should have the following volumes for market "ETH2/MAR22": 73 | side | price | volume | 74 | sell | 111065 | 28 | 75 | sell | 110965 | 1 | 76 | buy | 89943 | 0 | 77 | buy | 89942 | 1 | 78 | buy | 89842 | 34 | 79 80 And the parties should have the following margin levels: 81 | party | market id | maintenance | search | initial | release | 82 | lp1 | ETH2/MAR22 | 1011341 | 1112475 | 1213609 | 1415877 | 83 84 And the parties should have the following account balances: 85 | party | asset | market id | margin | general | bond | 86 | lp1 | ETH2 | ETH2/MAR22 | 1213609 | 9995786391 | 3000000 | 87 88 Then the parties place the following orders: 89 | party | market id | side | volume | price | resulting trades | type | tif | reference | 90 | party1 | ETH2/MAR22 | buy | 1 | 89942 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-3 | 91 92 And the order book should have the following volumes for market "ETH2/MAR22": 93 | side | price | volume | 94 | sell | 111065 | 28 | 95 | sell | 110965 | 1 | 96 | buy | 89943 | 0 | 97 | buy | 89942 | 2 | 98 | buy | 89842 | 34 | 99 100 And the parties should have the following margin levels: 101 | party | market id | maintenance | search | initial | release | 102 | lp1 | ETH2/MAR22 | 1011341 | 1112475 | 1213609 | 1415877 | 103 104 # # now we place an order which makes the best bid 89943. 105 Then the parties place the following orders: 106 | party | market id | side | volume | price | resulting trades | type | tif | reference | 107 | party1 | ETH2/MAR22 | buy | 1 | 89943 | 0 | TYPE_LIMIT | TIF_GTC | buy-ref-4 | 108 109 And the market data for the market "ETH2/MAR22" should be: 110 | mark price | trading mode | horizon | min bound | max bound | target stake | supplied stake | open interest | 111 | 100000 | TRADING_MODE_CONTINUOUS | 43200 | 89942 | 110965 | 361190 | 3000000 | 10 | 112 113 And the order book should have the following volumes for market "ETH2/MAR22": 114 | side | price | volume | 115 | sell | 111065 | 28 | 116 | sell | 110965 | 1 | 117 | buy | 89943 | 1 | 118 | buy | 89942 | 2 | 119 | buy | 89843 | 34 | 120 121 And the parties should have the following margin levels: 122 | party | market id | maintenance | search | initial | release | 123 | lp1 | ETH2/MAR22 | 1011341 | 1112475 | 1213609 | 1415877 | 124