diff --git a/core/integration/features/settlement/0019-MCAL_fundingMargin2.feature b/core/integration/features/settlement/0019-MCAL_fundingMargin2.feature index 92ef7bd9756..645e6244f25 100644 --- a/core/integration/features/settlement/0019-MCAL_fundingMargin2.feature +++ b/core/integration/features/settlement/0019-MCAL_fundingMargin2.feature @@ -11,7 +11,7 @@ Feature: Test funding margin for Perps market And the markets: | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | position decimal places | market type | sla params | - | ETH/DEC19 | ETH | USD | default-simple-risk-model-3 | default-margin-calculator | 1 | default-none | default-none | perp-oracle | 1e6 | 1e6 | -3 | perp | default-futures | + | ETH/DEC19 | ETH | USD | default-simple-risk-model-3 | default-margin-calculator | 1 | default-none | default-none | perp-oracle | 1e6 | 0 | -3 | perp | default-futures | And the following network parameters are set: | name | value | @@ -19,7 +19,7 @@ Feature: Test funding margin for Perps market | limits.markets.maxPeggedOrders | 2 | @Perpetual - Scenario: (0019-MCAL-019) check funding margin for Perps market when clumps are 0.1 and 0.9 + Scenario: (0019-MCAL-026) check funding margin for Perps market when clumps are 0.1 and 0.9 Given the following network parameters are set: | name | value | | network.markPriceUpdateMaximumFrequency | 5s | @@ -145,7 +145,7 @@ Feature: Test funding margin for Perps market | name | value | time offset | | perp.funding.cue | 1613061324 | 0s | -#funding payment = f_twap - s_twap + clamp_lower_bound*s_twap =2000-1600+(0.1*1600)=560 + #funding payment = f_twap - s_twap + clamp_lower_bound*s_twap =2000-1600+(0.1*1600)=560 And the following transfers should happen: | from | to | from account | to account | market id | amount | asset | | aux2 | market | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_SETTLEMENT | ETH/DEC19 | 1120000 | USD | @@ -185,6 +185,4 @@ Feature: Test funding margin for Perps market | market | party3 | ACCOUNT_TYPE_SETTLEMENT | ACCOUNT_TYPE_MARGIN | ETH/DEC19 | 1000 | USD | And the cumulated balance for all accounts should be worth "330000000" - And the settlement account should have a balance of "0" for the market "ETH/DEC19" - -# Then debug transfers + And the settlement account should have a balance of "0" for the market "ETH/DEC19" \ No newline at end of file diff --git a/core/integration/features/verified/0019-MCAL-margin_calculator-slippage.feature b/core/integration/features/verified/0019-MCAL-margin_calculator-slippage.feature index 9c4fa8b0254..8b437e8f33f 100644 --- a/core/integration/features/verified/0019-MCAL-margin_calculator-slippage.feature +++ b/core/integration/features/verified/0019-MCAL-margin_calculator-slippage.feature @@ -15,12 +15,12 @@ Feature: Test capped maximum slippage values are calculated correctly in range o And the markets: | 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 | - | ETH/FEB23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.25 | 0.25 | default-futures | - | ETH/MAR23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 100 | 100 | default-futures | + | ETH/FEB23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.25 | 0 | default-futures | + | ETH/MAR23 | ETH | USD | lqm-params | simple-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 100 | 0 | default-futures | @SLABug - Scenario: Check slippage-factors yield the correct maximum slippage for a specific market state (0019-MCAL-011)(0019-MCAL-012) + Scenario: Check slippage-factors yield the correct maximum slippage for a specific market state (0019-MCAL-024)(0019-MCAL-025) # Create position, order book, and mark price conditions matching the spec Given the parties deposit on asset's general account the following amount: @@ -46,7 +46,7 @@ Feature: Test capped maximum slippage values are calculated correctly in range o | sellSideProvider| ETH/MAR23 | sell | 10 | 100100 | 0 | TYPE_LIMIT | TIF_GTC | - # Checks for 0019-MCAL-012 +# Checks for 0019-MCAL-025 When the network moves ahead "2" blocks # Check mark-price matches the specification Then the mark price should be "15900" for the market "ETH/FEB23" @@ -60,8 +60,8 @@ Feature: Test capped maximum slippage values are calculated correctly in range o # Check party margin levels match the specification And the parties should have the following margin levels: | party | market id | maintenance | search | initial | release | - | party | ETH/FEB23 | 9540 | 10494 | 11448 | 13356 | - + | party | ETH/FEB23 | 5565 | 6121 | 6678 | 7791 | +#margin = min((100000-15900), 15900*(0.25))+0.1*15900=5565 # Checks for 0019-MCAL-013 # Network has moved ahead to leave ETH/FEB23 opening auction, ends this opening auction, too @@ -79,6 +79,7 @@ Feature: Test capped maximum slippage values are calculated correctly in range o And the parties should have the following margin levels: | party | market id | maintenance | search | initial | release | | party | ETH/MAR23 | 85690 | 94259 | 102828 | 119966 | +#margin = min((100000-15900), 15900*(100))+0.1*15900=85690 Scenario: Check margin is calculated correctly using capped slippage depending on the volume of orders on the book (0019-MCAL-014)(0019-MCAL-015)(0019-MCAL-016)(0019-MCAL-017)(0019-MCAL-018) @@ -99,7 +100,6 @@ Feature: Test capped maximum slippage values are calculated correctly in range o | sellSideProvider | ETH/FEB23 | sell | 5 | 502 | 0 | TYPE_LIMIT | TIF_GTC | ssp-2 | | sellSideProvider | ETH/FEB23 | sell | 10 | 504 | 0 | TYPE_LIMIT | TIF_GTC | ssp-1 | - # Case for 0019-MCAL-017 and 0019-MCAL-018: # - For the party 'longTrader'; riskiest long > 0 && abs(riskiest long) < sum of volume of order book bids # - For the party 'shortTrader'; riskiest short < 0 && abs(riskiest long) < sum of volume of order book bids @@ -116,7 +116,6 @@ Feature: Test capped maximum slippage values are calculated correctly in range o | longTrader | ETH/FEB23 | 530 | 583 | 636 | 742 | | shortTrader | ETH/FEB23 | 530 | 583 | 636 | 742 | - # Case for 0019-MCAL-015: # - For the party 'longTrader'; riskiest long > 0 && abs(riskiest long) > sum of volume of order book bids When the parties cancel the following orders: @@ -139,8 +138,7 @@ Feature: Test capped maximum slippage values are calculated correctly in range o Then the mark price should be "500" for the market "ETH/FEB23" And the parties should have the following margin levels: | party | market id | maintenance | search | initial | release | - | longTrader | ETH/FEB23 | 14250 | 15675 | 17100 | 19950 | - + | longTrader | ETH/FEB23 | 1750 | 1925 | 2100 | 2450 | # Case for 0019-MCAL-016: # - For the party 'shortTrader'; riskiest short < 0 && abs(riskiest short) > sum of volume of order book asks @@ -164,9 +162,8 @@ Feature: Test capped maximum slippage values are calculated correctly in range o Then the mark price should be "500" for the market "ETH/FEB23" And the parties should have the following margin levels: | party | market id | maintenance | search | initial | release | - | shortTrader | ETH/FEB23 | 14250 | 15675 | 17100 | 19950 | + | shortTrader | ETH/FEB23 | 1750 | 1925 | 2100 | 2450 | - # Case for 0019-MCAL-014: # - For the party 'longTrader'; riskiest long > 0 && no bids on the book # - For the party 'shortTrader'; riskiest short < 0 && no asks on the book @@ -184,5 +181,5 @@ Feature: Test capped maximum slippage values are calculated correctly in range o Then the mark price should be "498" for the market "ETH/FEB23" And the parties should have the following margin levels: | party | market id | maintenance | search | initial | release | - | longTrader | ETH/FEB23 | 14193 | 15612 | 17031 | 19870 | - | shortTrader | ETH/FEB23 | 14193 | 15612 | 17031 | 19870 | + | longTrader | ETH/FEB23 | 1743 | 1917 | 2091 | 2440 | + | shortTrader | ETH/FEB23 | 1743 | 1917 | 2091 | 2440 |