code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spots/SpotFunctionalTests/0080-SPOT-021.feature (about) 1 Feature: Spot Markets 2 3 Background: 4 Given the following network parameters are set: 5 | name | value | 6 | network.markPriceUpdateMaximumFrequency | 0s | 7 And the average block duration is "1" 8 9 Given the fees configuration named "fees-config-1": 10 | maker fee | infrastructure fee | 11 | 0.005 | 0.05 | 12 13 And the simple risk model named "my-simple-risk-model": 14 | long | short | max move up | min move down | probability of trading | 15 | 0.01 | 0.01 | 10 | -10 | 0.2 | 16 17 And the price monitoring named "price-monitoring": 18 | horizon | probability | auction extension | 19 | 3600 | 0.95 | 3 | 20 21 And the spot markets: 22 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 23 | BTC/ETH | BTC/ETH | BTC | ETH | my-simple-risk-model | 1 | fees-config-1 | price-monitoring | default-basic | 24 25 Scenario: If the fee rates change for any reason within an auction, the amount required to cover fees must be recalculated at uncrossing time, 26 and if the user does not have enough to cover the fees the order will be cancelled (0080-SPOT-021). 27 28 # setup accounts 29 Given the parties deposit on asset's general account the following amount: 30 | party | asset | amount | 31 | party1 | ETH | 20000 | 32 | party2 | BTC | 100 | 33 | party3 | ETH | 1200 | 34 35 # place orders and generate trades 36 And the parties place the following orders: 37 | party | market id | side | volume | price | resulting trades | type | tif | reference | 38 | party1 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 | 39 | party2 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 40 | party3 | BTC/ETH | buy | 10 | 100 | 0 | TYPE_LIMIT | TIF_GTC | bla-bla | 41 42 Then the opening auction period ends for market "BTC/ETH" 43 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 44 And the mark price should be "100" for the market "BTC/ETH" 45 When the network moves ahead "1" blocks 46 47 # Check the account details for party3 while in continuous trading 48 Then "party3" should have holding account balance of "1000" for asset "ETH" 49 Then "party3" should have general account balance of "200" for asset "ETH" 50 51 # Place some orders outside the price range to trigger a price monitoring auction 52 And the parties place the following orders: 53 | party | market id | side | volume | price | resulting trades | type | tif | 54 | party1 | BTC/ETH | buy | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | 55 | party2 | BTC/ETH | sell | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | 56 57 When the network moves ahead "1" blocks 58 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 59 60 # We have moved into monitoring auction so will require that fees amounting to 25 are covered in our holding account 61 Then "party3" should have holding account balance of "1025" for asset "ETH" 62 Then "party3" should have general account balance of "175" for asset "ETH" 63 64 # Let's change the infrastructure fees so that we no longer have enough funds to cover our order 65 Given the following network parameters are set: 66 | name | value | 67 | market.fee.factors.infrastructureFee | 0.5 | 68 69 And the orders should have the following status: 70 | party | reference | status | 71 | party3 | bla-bla | STATUS_ACTIVE | 72 73 # Place some new matching orders to get the mark price back to the right level and bring us out of auction 74 And the parties place the following orders: 75 | party | market id | side | volume | price | resulting trades | type | tif | 76 | party1 | BTC/ETH | buy | 5 | 101 | 0 | TYPE_LIMIT | TIF_GTC | 77 | party2 | BTC/ETH | sell | 5 | 101 | 0 | TYPE_LIMIT | TIF_GTC | 78 79 When the network moves ahead "3" blocks 80 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 81 82 # The market will attempt to move the required amount of fees (250) for the orders to the holding account ready for the uncrossing, 83 # but there will not be enough for party3, so their order will be cancelled. 84 85 And the orders should have the following status: 86 | party | reference | status | 87 | party3 | bla-bla | STATUS_CANCELLED | 88 89 # We move out of auction and everything for party3 will be returned from the holding account to the general account 90 Then "party3" should have holding account balance of "0" for asset "ETH" 91 Then "party3" should have general account balance of "1200" for asset "ETH" 92 93 94 95 Scenario: If the fee rates change for any reason within an auction, the amount required to cover fees must be recalculated at uncrossing time, 96 and the necessary amount should be transferred to or released from the holding_account.(0080-SPOT-021). 97 98 # setup accounts 99 Given the parties deposit on asset's general account the following amount: 100 | party | asset | amount | 101 | party1 | ETH | 20000 | 102 | party2 | BTC | 100 | 103 | party3 | ETH | 1200 | 104 105 # place orders and generate trades 106 And the parties place the following orders: 107 | party | market id | side | volume | price | resulting trades | type | tif | reference | 108 | party1 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 | 109 | party2 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 110 | party3 | BTC/ETH | buy | 10 | 100 | 0 | TYPE_LIMIT | TIF_GTC | bla-bla | 111 112 Then the opening auction period ends for market "BTC/ETH" 113 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 114 And the mark price should be "100" for the market "BTC/ETH" 115 When the network moves ahead "1" blocks 116 117 # Check the account details for party3 while in continuous trading 118 Then "party3" should have holding account balance of "1000" for asset "ETH" 119 Then "party3" should have general account balance of "200" for asset "ETH" 120 121 # Place some orders outside the price range to trigger a price monitoring auction 122 And the parties place the following orders: 123 | party | market id | side | volume | price | resulting trades | type | tif | 124 | party1 | BTC/ETH | buy | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | 125 | party2 | BTC/ETH | sell | 1 | 111 | 0 | TYPE_LIMIT | TIF_GTC | 126 127 When the network moves ahead "1" blocks 128 And the trading mode should be "TRADING_MODE_MONITORING_AUCTION" for the market "BTC/ETH" 129 130 # We have moved into monitoring auction so will require that fees amounting to 25 are covered in our holding account 131 Then "party3" should have holding account balance of "1025" for asset "ETH" 132 Then "party3" should have general account balance of "175" for asset "ETH" 133 134 # Let's change the infrastructure fees so that we have more holding value than we need 135 Given the following network parameters are set: 136 | name | value | 137 | market.fee.factors.infrastructureFee | 0.01 | 138 139 And the orders should have the following status: 140 | party | reference | status | 141 | party3 | bla-bla | STATUS_ACTIVE | 142 143 # Place some new matching orders to get the mark price back to the right level and bring us out of auction 144 And the parties place the following orders: 145 | party | market id | side | volume | price | resulting trades | type | tif | 146 | party1 | BTC/ETH | buy | 5 | 101 | 0 | TYPE_LIMIT | TIF_GTC | 147 | party2 | BTC/ETH | sell | 5 | 101 | 0 | TYPE_LIMIT | TIF_GTC | 148 149 When the network moves ahead "3" blocks 150 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 151 152 # The market will check the holding amount for each order is enough before we uncross. If we have too much in the 153 # holding account we do not reduce it yet, that will happen once the orders are uncrossed. 154 155 And the orders should have the following status: 156 | party | reference | status | 157 | party3 | bla-bla | STATUS_ACTIVE | 158 159 # We move out of auction and all fees for orders for party3 will be returned from the holding account to the general account 160 Then "party3" should have holding account balance of "1000" for asset "ETH" 161 Then "party3" should have general account balance of "200" for asset "ETH" 162 163