code.vegaprotocol.io/vega@v0.79.0/core/integration/features/volume-rebate/0095-HVMR-multiple.feature (about) 1 Feature: Volume rebate program - two programs overlapping 2 Background: 3 4 # Initialise the network and register the assets 5 Given the average block duration is "1" 6 And the following network parameters are set: 7 | name | value | 8 | market.fee.factors.makerFee | 0.01 | 9 | market.fee.factors.infrastructureFee | 0.01 | 10 | market.fee.factors.treasuryFee | 0.1 | 11 | market.fee.factors.buybackFee | 0.1 | 12 | network.markPriceUpdateMaximumFrequency | 0s | 13 | validators.epoch.length | 20s | 14 | market.auction.minimumDuration | 1 | 15 16 And the following assets are registered: 17 | id | decimal places | quantum | 18 | USD-0-1 | 0 | 1 | 19 | MXN-0-10 | 0 | 10 | 20 21 # Initialise the parties and deposit assets 22 And the parties deposit on asset's general account the following amount: 23 | party | asset | amount | 24 | aux1 | USD-0-1 | 3000000 | 25 | aux2 | USD-0-1 | 3000000 | 26 | aux1 | MXN-0-10 | 30000000 | 27 | aux2 | MXN-0-10 | 30000000 | 28 | party1 | USD-0-1 | 3000000 | 29 | party2 | USD-0-1 | 3000000 | 30 | party1 | MXN-0-10 | 30000000 | 31 | party2 | MXN-0-10 | 30000000 | 32 33 # Setup the markets 34 And the price monitoring named "price-monitoring": 35 | horizon | probability | auction extension | 36 | 3600 | 0.99 | 1 | 37 And the markets: 38 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | position decimal places | 39 | BTC/USD-0-1 | USD | USD-0-1 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | price-monitoring | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 40 | BTC/MXN-0-10 | VND | MXN-0-10 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | price-monitoring | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 41 And the spot markets: 42 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | decimal places | position decimal places | sla params | 43 | MXN-0-10/USD-0-1 | MXN/USD | MXN-0-10 | USD-0-1 | default-log-normal-risk-model | 1 | default-none | price-monitoring | 0 | 0 | default-basic | 44 | USD-0-1/MXN-0-10 | MXN/USD | USD-0-1 | MXN-0-10 | default-log-normal-risk-model | 1 | default-none | price-monitoring | 0 | 0 | default-basic | 45 And the parties place the following orders: 46 | party | market id | side | volume | price | resulting trades | type | tif | 47 | aux1 | BTC/USD-0-1 | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | 48 | aux2 | BTC/USD-0-1 | sell | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | 49 And the parties place the following orders: 50 | party | market id | side | volume | price | resulting trades | type | tif | 51 | aux1 | BTC/MXN-0-10 | buy | 1 | 500000 | 0 | TYPE_LIMIT | TIF_GTC | 52 | aux2 | BTC/MXN-0-10 | sell | 1 | 500000 | 0 | TYPE_LIMIT | TIF_GTC | 53 And the parties place the following orders: 54 | party | market id | side | volume | price | resulting trades | type | tif | 55 | aux1 | MXN-0-10/USD-0-1 | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | 56 | aux2 | MXN-0-10/USD-0-1 | sell | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | 57 And the parties place the following orders: 58 | party | market id | side | volume | price | resulting trades | type | tif | 59 | aux1 | USD-0-1/MXN-0-10 | buy | 1 | 500000 | 0 | TYPE_LIMIT | TIF_GTC | 60 | aux2 | USD-0-1/MXN-0-10 | sell | 1 | 500000 | 0 | TYPE_LIMIT | TIF_GTC | 61 When the network moves ahead "2" blocks 62 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USD-0-1" 63 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/MXN-0-10" 64 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "MXN-0-10/USD-0-1" 65 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "MXN-0-10/USD-0-1" 66 67 Scenario Outline: rebate program A is enacted, during its lifetime program B takes over. Program B closes after program A, so after B closes, no programs should be active. (0095-HVMR-005)(0095-HVMR-006)(0095-HMVR-007)(0095-HVMR-008)(0095-HVMR-009)(0095-HVM-010)(0095-HVMR-011). 68 Given the volume rebate program tiers named "A1": 69 | fraction | rebate | 70 | 0.0001 | 0.001 | 71 And the volume rebate program tiers named "B3": 72 | fraction | rebate | 73 | 0.0001 | 0.002 | 74 | 0.0002 | 0.003 | 75 | 0.0003 | 0.004 | 76 And the volume rebate program: 77 | id | tiers | closing timestamp | window length | closing delta | 78 | programA | A1 | 0 | <window length> | <closing delta> | 79 And the network moves ahead "1" epochs 80 81 And the parties place the following orders: 82 | party | market id | side | volume | price | resulting trades | type | tif | error | 83 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 84 | aux1 | <market> | sell | 1 | 50000 | 1 | TYPE_LIMIT | TIF_GTC | | 85 When the network moves ahead "1" blocks 86 Then the following trades should be executed: 87 | buyer | seller | size | price | aggressor side | buyer maker fee | seller maker fee | 88 | party1 | aux1 | 1 | 50000 | sell | 0 | 500 | 89 90 Given the network moves ahead <epochs between trades> epochs 91 When the parties place the following orders: 92 | party | market id | side | volume | price | resulting trades | type | tif | error | 93 | party2 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 94 | aux1 | <market> | sell | 1 | 50000 | 1 | TYPE_LIMIT | TIF_GTC | | 95 When the network moves ahead "1" blocks 96 Then the following trades should be executed: 97 | buyer | seller | size | price | aggressor side | buyer maker fee | seller maker fee | 98 | party2 | aux1 | 1 | 50000 | sell | 0 | 500 | 99 100 When the network moves ahead "1" epochs 101 When the parties place the following orders: 102 | party | market id | side | volume | price | resulting trades | type | tif | error | 103 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 104 | party2 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 105 | aux1 | <market> | sell | 2 | 50000 | 2 | TYPE_LIMIT | TIF_GTC | | 106 When the network moves ahead "1" blocks 107 Then the following trades should be executed: 108 | buyer | seller | size | price | aggressor side | buyer high volume maker fee | seller high volume maker fee | 109 | party1 | aux1 | 1 | 50000 | sell | 0 | <party1 rebate A> | 110 | party2 | aux1 | 1 | 50000 | sell | 0 | <party2 rebate A> | 111 112 When the network moves ahead "1" epochs 113 Then the volume rebate program: 114 | id | tiers | closing timestamp | window length | closing delta | 115 | programB | B3 | 0 | <window length> | <closing delta> | 116 117 When the network moves ahead "1" epochs 118 Then the parties place the following orders: 119 | party | market id | side | volume | price | resulting trades | type | tif | error | 120 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 121 | aux1 | <market> | sell | 1 | 50000 | 1 | TYPE_LIMIT | TIF_GTC | | 122 When the network moves ahead "1" blocks 123 Then the following trades should be executed: 124 | buyer | seller | size | price | aggressor side | buyer maker fee | seller maker fee | 125 | party1 | aux1 | 1 | 50000 | sell | 0 | 500 | 126 127 Given the network moves ahead <epochs between trades> epochs 128 When the parties place the following orders: 129 | party | market id | side | volume | price | resulting trades | type | tif | error | 130 | party2 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 131 | aux1 | <market> | sell | 1 | 50000 | 1 | TYPE_LIMIT | TIF_GTC | | 132 When the network moves ahead "1" blocks 133 Then the following trades should be executed: 134 | buyer | seller | size | price | aggressor side | buyer maker fee | seller maker fee | 135 | party2 | aux1 | 1 | 50000 | sell | 0 | 500 | 136 137 When the network moves ahead "1" epochs 138 Then the parties place the following orders: 139 | party | market id | side | volume | price | resulting trades | type | tif | error | 140 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 141 | party2 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 142 | aux1 | <market> | sell | 2 | 50000 | 2 | TYPE_LIMIT | TIF_GTC | | 143 When the network moves ahead "1" blocks 144 Then the following trades should be executed: 145 | buyer | seller | size | price | aggressor side | buyer high volume maker fee | seller high volume maker fee | 146 | party1 | aux1 | 1 | 50000 | sell | 0 | <party1 rebate B> | 147 | party2 | aux1 | 1 | 50000 | sell | 0 | <party2 rebate B> | 148 149 # Now no programs are active 150 When the network moves ahead "4" epochs 151 Then the parties place the following orders: 152 | party | market id | side | volume | price | resulting trades | type | tif | error | 153 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 154 | aux1 | <market> | sell | 1 | 50000 | 1 | TYPE_LIMIT | TIF_GTC | | 155 When the network moves ahead "1" blocks 156 Then the following trades should be executed: 157 | buyer | seller | size | price | aggressor side | buyer maker fee | seller maker fee | 158 | party2 | aux1 | 1 | 50000 | sell | 0 | 500 | 159 160 When the network moves ahead "1" epochs 161 Then the parties place the following orders: 162 | party | market id | side | volume | price | resulting trades | type | tif | error | 163 | party1 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 164 | party2 | <market> | buy | 1 | 50000 | 0 | TYPE_LIMIT | TIF_GTC | | 165 | aux1 | <market> | sell | 2 | 50000 | 2 | TYPE_LIMIT | TIF_GTC | | 166 When the network moves ahead "1" blocks 167 Then the following trades should be executed: 168 | buyer | seller | size | price | aggressor side | buyer high volume maker fee | seller high volume maker fee | 169 | party1 | aux1 | 1 | 50000 | sell | 0 | 0 | 170 | party2 | aux1 | 1 | 50000 | sell | 0 | 0 | 171 172 # Closing delta must be > 1 epoch + epochs betwochs between trades + 3 blocks, 80s == 4 epochs 173 Examples: 174 | market | window length | epochs between trades | party1 rebate A | party2 rebate A | closing delta | party1 rebate B | party2 rebate B | 175 | BTC/USD-0-1 | 2 | "0" | 50 | 50 | 80s | 200 | 200 | 176 | BTC/USD-0-1 | 2 | "1" | 50 | 50 | 80s | 200 | 200 | 177 | MXN-0-10/USD-0-1 | 2 | "0" | 50 | 50 | 80s | 200 | 200 | 178 | MXN-0-10/USD-0-1 | 2 | "1" | 50 | 50 | 80s | 200 | 200 | 179