code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spots/SpotFunctionalTests/TC-0014-Spot-MultipleParties.feature (about) 1 Feature: Spot order gets filled partially by 10 different parties 2 3 Scenario: Spot Order gets filled partially by 10 different parties 4 5 Background: 6 7 Given the fees configuration named "fees-config-1": 8 | maker fee | infrastructure fee | 9 | 0.005 | 0.002 | 10 11 Given the log normal risk model named "lognormal-risk-model-1": 12 | risk aversion | tau | mu | r | sigma | 13 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 14 And the simple risk model named "my-simple-risk-model": 15 | long | short | max move up | min move down | probability of trading | 16 | 0.08628781058136630000 | 0.09370922348428490000 | -1 | -1 | 0.2 | 17 And the fees configuration named "my-fees-config": 18 | maker fee | infrastructure fee | 19 | 0.004 | 0.001 | 20 And the price monitoring named "price-monitoring-1": 21 | horizon | probability | auction extension | 22 | 36000 | 0.999 | 3 | 23 And the spot markets: 24 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 25 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | default-basic | 26 27 # setup accounts 28 Given the parties deposit on asset's general account the following amount: 29 | party | asset | amount | 30 | party1 | ETH | 100 | 31 | party2 | BTC | 5 | 32 | party3 | ETH | 200 | 33 | party4 | ETH | 50 | 34 | party5 | ETH | 10 | 35 | party6 | ETH | 30 | 36 | party7 | BTC | 7 | 37 | party8 | ETH | 100 | 38 | party9 | BTC | 3 | 39 | party10 | BTC | 9 | 40 41 # place orders and generate trades 42 And the parties place the following orders: 43 | party | market id | side | volume | price | resulting trades | type | tif | reference | 44 | party4 | BTC/ETH | buy | 1 | 3 | 0 | TYPE_LIMIT | TIF_GTC | party-order4 | 45 | party5 | BTC/ETH | buy | 1 | 5 | 0 | TYPE_LIMIT | TIF_GTC | party-order5 | 46 | party6 | BTC/ETH | buy | 1 | 12 | 0 | TYPE_LIMIT | TIF_GTC | party-order6 | 47 | party8 | BTC/ETH | buy | 5 | 10 | 0 | TYPE_LIMIT | TIF_GTC | party-order8 | 48 | party3 | BTC/ETH | buy | 5 | 10 | 0 | TYPE_LIMIT | TIF_GTC | party-order3 | 49 | party1 | BTC/ETH | buy | 2 | 10 | 0 | TYPE_LIMIT | TIF_GTC | party-order11 | 50 | party1 | BTC/ETH | buy | 1 | 20 | 0 | TYPE_LIMIT | TIF_GFA | party-order1 | 51 | party2 | BTC/ETH | sell | 1 | 30 | 0 | TYPE_LIMIT | TIF_GTC | party-order2 | 52 | party7 | BTC/ETH | sell | 2 | 60 | 0 | TYPE_LIMIT | TIF_GTC | party-order7 | 53 | party2 | BTC/ETH | sell | 1 | 90 | 0 | TYPE_LIMIT | TIF_GTC | party-order12 | 54 | party9 | BTC/ETH | sell | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | party-order9 | 55 | party10 | BTC/ETH | sell | 5 | 200 | 0 | TYPE_LIMIT | TIF_GTC | party-order10 | 56 57 58 Then "party1" should have holding account balance of "40" for asset "ETH" 59 Then "party2" should have holding account balance of "2" for asset "BTC" 60 Then "party3" should have holding account balance of "50" for asset "ETH" 61 Then "party4" should have holding account balance of "3" for asset "ETH" 62 Then "party5" should have holding account balance of "5" for asset "ETH" 63 Then "party6" should have holding account balance of "12" for asset "ETH" 64 Then "party7" should have holding account balance of "2" for asset "BTC" 65 Then "party8" should have holding account balance of "50" for asset "ETH" 66 Then "party9" should have holding account balance of "1" for asset "BTC" 67 Then "party10" should have holding account balance of "5" for asset "BTC" 68 69 And the parties amend the following orders: 70 | party | reference | price | size delta | tif | 71 | party2 | party-order2 | 10 | 0 | TIF_GTC | 72 73 And the opening auction period ends for market "BTC/ETH" 74 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 75 Then the market data for the market "BTC/ETH" should be: 76 | mark price | trading mode | auction trigger | horizon | min bound | max bound | target stake | supplied stake | open interest | 77 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 36000 | 14 | 17 | 0 | 0 | 0 | 78 79 Then "party1" should have holding account balance of "20" for asset "ETH" 80 Then "party2" should have holding account balance of "1" for asset "BTC" 81 Then "party7" should have holding account balance of "2" for asset "BTC" 82 83 And the following trades should be executed: 84 | buyer | price | size | seller | 85 | party1 | 15 | 1 | party2 | 86 87 And the parties amend the following orders: 88 | party | reference | price | size delta | tif | 89 | party2 | party-order12 | 10 | 0 | TIF_GTC | 90 91 Then the market data for the market "BTC/ETH" should be: 92 | mark price | trading mode | auction trigger | 93 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 94 95 Then "party1" should have holding account balance of "21" for asset "ETH" 96 Then "party2" should have holding account balance of "1" for asset "BTC" 97 Then "party3" should have holding account balance of "51" for asset "ETH" 98 Then "party4" should have holding account balance of "4" for asset "ETH" 99 Then "party5" should have holding account balance of "6" for asset "ETH" 100 Then "party6" should have holding account balance of "13" for asset "ETH" 101 Then "party7" should have holding account balance of "2" for asset "BTC" 102 Then "party8" should have holding account balance of "51" for asset "ETH" 103 Then "party9" should have holding account balance of "1" for asset "BTC" 104 Then "party10" should have holding account balance of "5" for asset "BTC" 105 106 Then the market data for the market "BTC/ETH" should be: 107 | mark price | trading mode | auction trigger | 108 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 109 110 And the parties amend the following orders: 111 | party | reference | price | size delta | tif | 112 | party7 | party-order7 | 10 | 0 | TIF_GTC | 113 114 Then the market data for the market "BTC/ETH" should be: 115 | mark price | trading mode | auction trigger | 116 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 117 118 Then "party7" should have holding account balance of "3" for asset "BTC" 119 120 # as we're amending sell orders the price change doesn't affect their ability to cover the trade, only the size matters, 121 And the parties amend the following orders: 122 | party | reference | price | size delta | tif | error | 123 | party10 | party-order10 | 10 | 5 | TIF_GTC | party does not have sufficient balance to cover the new size | 124 | party9 | party-order9 | 10 | 3 | TIF_GTC | party does not have sufficient balance to cover the new size | 125 126 Then "party1" should have holding account balance of "21" for asset "ETH" 127 Then "party2" should have holding account balance of "1" for asset "BTC" 128 Then "party3" should have holding account balance of "51" for asset "ETH" 129 Then "party4" should have holding account balance of "4" for asset "ETH" 130 Then "party5" should have holding account balance of "6" for asset "ETH" 131 Then "party6" should have holding account balance of "13" for asset "ETH" 132 Then "party7" should have holding account balance of "3" for asset "BTC" 133 Then "party8" should have holding account balance of "51" for asset "ETH" 134 Then "party9" should have holding account balance of "1" for asset "BTC" 135 Then "party10" should have holding account balance of "5" for asset "BTC"