fix(trading): amend formula for max leverage calc (#5462)

Co-authored-by: bwallacee <ben@vega.xyz>
This commit is contained in:
Witold 2023-12-06 18:58:59 +01:00 committed by GitHub
parent 2e9fa0c52e
commit a157ff1e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 15 deletions

View File

@ -31,7 +31,7 @@ initial_spread: float = 0.1
market_name = "BTC:DAI_2023"
@pytest.mark.usefixtures("vega", "page", "simple_market", "risk_accepted")
@pytest.mark.usefixtures("vega", "page", "simple_market", "risk_accepted", "auth")
def test_price_monitoring(simple_market, vega: VegaService, page: Page):
page.goto(f"/#/markets/all")
expect(page.locator(table_row_selector).locator(trading_mode_col)).to_have_text(
@ -109,9 +109,8 @@ def test_price_monitoring(simple_market, vega: VegaService, page: Page):
expect(
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)
).to_have_text("100.00 (>100%)")
vega.forward("10s")
vega.wait_fn(1)
vega.wait_fn(10)
vega.wait_for_total_catchup()
expect(
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)

View File

@ -197,10 +197,10 @@ def test_market_info_risk_factors(page: Page):
fields = [
["Long", "0.05153"],
["Short", "0.05422"],
["Max Leverage Long", "19.036"],
["Max Leverage Short", "18.111"],
["Max Initial Leverage Long", "12.691"],
["Max Initial Leverage Short", "12.074"],
["Max Leverage Long", "19.406"],
["Max Leverage Short", "18.445"],
["Max Initial Leverage Long", "12.937"],
["Max Initial Leverage Short", "12.297"],
]
validate_info_section(page, fields)

View File

@ -59,7 +59,7 @@ def test_market_selector_filter(continuous_market, page: Page):
page.get_by_test_id("search-term").fill("btc")
expect(page.locator('[data-testid="market-selector-list"] a')).to_have_count(1)
expect(page.locator('[data-testid="market-selector-list"] a').nth(0)).to_have_text(
"BTC:DAI_2023107.50 tDAI0.00"
"BTC:DAI_2023107.50 tDAI1"
)
page.get_by_test_id("search-term").clear()
@ -84,5 +84,5 @@ def test_market_selector_filter(continuous_market, page: Page):
page.get_by_role("menuitemcheckbox").nth(0).get_by_text("tDAI").click()
expect(page.locator('[data-testid="market-selector-list"] a')).to_have_count(1)
expect(page.locator('[data-testid="market-selector-list"] a').nth(0)).to_have_text(
"BTC:DAI_2023107.50 tDAI0.00"
"BTC:DAI_2023107.50 tDAI1"
)

View File

@ -632,13 +632,9 @@ export const RiskFactorsInfoPanel = ({
const { short, long } = market.riskFactors;
const maxLeverageLong = new BigNumber(1).dividedBy(
new BigNumber(market.linearSlippageFactor).plus(long)
);
const maxLeverageLong = new BigNumber(1).dividedBy(long);
const maxLeverageShort = new BigNumber(1).dividedBy(
new BigNumber(market.linearSlippageFactor).plus(short)
);
const maxLeverageShort = new BigNumber(1).dividedBy(short);
const maxInitialLeverageLong = !market.tradableInstrument.marginCalculator
? undefined