-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
456 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core/integration/features/fees/0029-FEES-high_volume_maker.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Feature: high volume maker fee rebate | ||
Feature: high volume maker fee rebate | ||
|
||
Background: | ||
|
||
|
162 changes: 162 additions & 0 deletions
162
core/integration/features/verified/eligibility_tests.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
Feature: FCAP liquidations | ||
|
||
vega-market-sim fuzz testing shows parties being liquidated after | ||
opening positions with market orders. | ||
|
||
Test replicates behaviour and shows network liquidating party. | ||
|
||
Background: | ||
|
||
# Initialise the network and register the assets | ||
Given the average block duration is "1" | ||
And the following network parameters are set: | ||
| name | value | | ||
| market.fee.factors.makerFee | 0.001 | | ||
| market.fee.factors.infrastructureFee | 0 | | ||
| network.markPriceUpdateMaximumFrequency | 0s | | ||
| validators.epoch.length | 100s | | ||
|
||
And the following assets are registered: | ||
| id | decimal places | quantum | | ||
| USD-0-1 | 0 | 1 | | ||
|
||
# Initialise the parties and deposit assets | ||
Given the parties deposit on asset's general account the following amount: | ||
| party | asset | amount | | ||
| lp | USD-0-1 | 1000000000000 | | ||
| aux1 | USD-0-1 | 1000000000000 | | ||
| aux2 | USD-0-1 | 1000000000000 | | ||
| party1 | USD-0-1 | 1000000000000 | | ||
| party2 | USD-0-1 | 1000000000000 | | ||
| a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-0-1 | 1000000000000 | | ||
|
||
# Setup the derivative market in continuous trading | ||
Given the markets: | ||
| 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 | | ||
| XAU/USDT | ETH | USD-0-1 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | | ||
And the parties submit the following liquidity provision: | ||
| id | party | market id | commitment amount | fee | lp type | | ||
| lp1 | lp | XAU/USDT | 100000000000 | 0 | submission | | ||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | buy | 1 | 2374000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 1 | 2374000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
When the network moves ahead "2" blocks | ||
And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "XAU/USDT" | ||
|
||
|
||
Scenario: A reward is funded with a reward window greater than one - a party meets the requirement in both. | ||
# Use taker volume, where parties always have the same volume. | ||
|
||
Given the current epoch is "0" | ||
When the parties submit the following recurring transfers: | ||
| id | from | from_account_type | to | to_account_type | entity_scope | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | window_length | notional_requirement | | ||
| 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | USD-0-1 | 100 | 1 | 100 | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-0-1 | | 10 | 2 | 1 | | ||
Then the network moves ahead "1" epochs | ||
|
||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party1 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party2 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
And the following trades should be executed: | ||
| buyer | size | price | seller | aggressor side | buyer maker fee | seller maker fee | | ||
| party1 | 100 | 1000 | aux1 | buy | 100 | 0 | | ||
| party2 | 100 | 1000 | aux2 | buy | 100 | 0 | | ||
|
||
Then the network moves ahead "1" epochs | ||
Then "party1" should have vesting account balance of "50" for asset "USD-0-1" | ||
Then "party2" should have vesting account balance of "50" for asset "USD-0-1" | ||
|
||
Then the network moves ahead "2" epochs | ||
Then "party1" should have vesting account balance of "100" for asset "USD-0-1" | ||
Then "party2" should have vesting account balance of "100" for asset "USD-0-1" | ||
|
||
|
||
Scenario: A reward is funded with a reward window greater than one - a party meets the requirement in both. | ||
# Use taker volume, where parties always have the same volume. | ||
|
||
Given the current epoch is "0" | ||
When the parties submit the following recurring transfers: | ||
| id | from | from_account_type | to | to_account_type | entity_scope | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | window_length | notional_requirement | | ||
| 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | USD-0-1 | 100 | 1 | 100 | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-0-1 | | 10 | 2 | 1 | | ||
Then the network moves ahead "1" epochs | ||
|
||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party1 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party2 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
And the following trades should be executed: | ||
| buyer | size | price | seller | aggressor side | buyer maker fee | seller maker fee | | ||
| party1 | 100 | 1000 | aux1 | buy | 100 | 0 | | ||
| party2 | 100 | 1000 | aux2 | buy | 100 | 0 | | ||
|
||
Then the network moves ahead "1" epochs | ||
Then "party1" should have vesting account balance of "50" for asset "USD-0-1" | ||
Then "party2" should have vesting account balance of "50" for asset "USD-0-1" | ||
|
||
|
||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | buy | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party1 | XAU/USDT | sell | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party2 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
Then the network moves ahead "1" blocks | ||
Then debug trades | ||
And the following trades should be executed: | ||
| buyer | size | price | seller | aggressor side | buyer maker fee | seller maker fee | | ||
| aux1 | 100 | 1000 | party1 | sell | 0 | 100 | | ||
| party2 | 100 | 1000 | aux2 | buy | 100 | 0 | | ||
|
||
Then the network moves ahead "1" epochs | ||
Then "party1" should have vesting account balance of "50" for asset "USD-0-1" | ||
Then "party2" should have vesting account balance of "150" for asset "USD-0-1" | ||
|
||
|
||
Scenario: A reward is funded with a reward window greater than one - a party meets the requirement in both. | ||
# Use taker volume, where parties always have the same volume. | ||
|
||
Given the current epoch is "0" | ||
When the parties submit the following recurring transfers: | ||
| id | from | from_account_type | to | to_account_type | entity_scope | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | window_length | notional_requirement | | ||
| 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | USD-0-1 | 100 | 1 | 100 | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-0-1 | | 10 | 2 | 1 | | ||
Then the network moves ahead "1" epochs | ||
|
||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party1 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux1 | XAU/USDT | buy | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party1 | XAU/USDT | sell | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party2 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
And the following trades should be executed: | ||
| buyer | size | price | seller | aggressor side | buyer maker fee | seller maker fee | | ||
| party1 | 100 | 1000 | aux1 | buy | 100 | 0 | | ||
| aux1 | 100 | 1000 | party1 | sell | 0 | 100 | | ||
| party2 | 100 | 1000 | aux2 | buy | 100 | 0 | | ||
|
||
Then the network moves ahead "1" epochs | ||
Then "party2" should have vesting account balance of "50" for asset "USD-0-1" | ||
|
||
|
||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| party1 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| aux1 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 100 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| party2 | XAU/USDT | buy | 100 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | | ||
Then the network moves ahead "1" blocks | ||
And the following trades should be executed: | ||
| buyer | size | price | seller | aggressor side | buyer maker fee | seller maker fee | | ||
| aux1 | 100 | 1000 | party1 | buy | 0 | 100 | | ||
| party2 | 100 | 1000 | aux2 | buy | 100 | 0 | | ||
|
||
Then the network moves ahead "1" epochs | ||
Then "party1" should have vesting account balance of "100" for asset "USD-0-1" | ||
Then "party2" should have vesting account balance of "100" for asset "USD-0-1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Feature: FCAP liquidations | ||
|
||
vega-market-sim fuzz testing shows parties being liquidated after | ||
opening positions with market orders. | ||
|
||
Test replicates behaviour and shows network liquidating party. | ||
|
||
Background: | ||
|
||
# Initialise the network and register the assets | ||
Given the average block duration is "1" | ||
And the following network parameters are set: | ||
| name | value | | ||
| market.fee.factors.makerFee | 0 | | ||
| market.fee.factors.infrastructureFee | 0 | | ||
| network.markPriceUpdateMaximumFrequency | 0s | | ||
# | spam.order.minimumMarginQuantumMultiple | 0.01 | | ||
|
||
And the following assets are registered: | ||
| id | decimal places | quantum | | ||
| USD-6-1000000 | 6 | 1000000 | | ||
|
||
# Initialise the parties and deposit assets | ||
Given the parties deposit on asset's general account the following amount: | ||
| party | asset | amount | | ||
| lp | USD-6-1000000 | 1000000000000 | | ||
| aux1 | USD-6-1000000 | 1000000000000 | | ||
| aux2 | USD-6-1000000 | 1000000000000 | | ||
|
||
# Setup the derivative market in continuous trading | ||
Given the markets: | ||
| 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 | | ||
| XAU/USDT | ETH | USD-6-1000000 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 3 | 3 | | ||
And the parties submit the following liquidity provision: | ||
| id | party | market id | commitment amount | fee | lp type | | ||
| lp1 | lp | XAU/USDT | 100000000000 | 0 | submission | | ||
And the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | | ||
| aux1 | XAU/USDT | buy | 1 | 2374000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
| aux2 | XAU/USDT | sell | 1 | 2374000 | 0 | TYPE_LIMIT | TIF_GTC | | ||
When the network moves ahead "2" blocks | ||
And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "XAU/USDT" | ||
|
||
|
||
|
||
@NoPerp | ||
Scenario: Party opens a short position with a market order and is liquidiated at the next mark to market. | ||
|
||
Given the parties deposit on asset's general account the following amount: | ||
| party | asset | amount | | ||
| trader | USD-6-1000000 | 1000000000000 | | ||
|
||
Given the parties place the following orders: | ||
| party | market id | side | volume | price | resulting trades | type | tif | error | | ||
| aux1 | XAU/USDT | sell | 10000 | 2374000 | 0 | TYPE_LIMIT | TIF_GTC | | | ||
| trader | XAU/USDT | buy | 1 | 0 | 1 | TYPE_MARKET | TIF_FOK | | | ||
|
||
Then debug trades |
Oops, something went wrong.