fix(trading): amend formula for max leverage calc (#5462)
Co-authored-by: bwallacee <ben@vega.xyz>
This commit is contained in:
parent
2e9fa0c52e
commit
a157ff1e05
@ -31,7 +31,7 @@ initial_spread: float = 0.1
|
|||||||
market_name = "BTC:DAI_2023"
|
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):
|
def test_price_monitoring(simple_market, vega: VegaService, page: Page):
|
||||||
page.goto(f"/#/markets/all")
|
page.goto(f"/#/markets/all")
|
||||||
expect(page.locator(table_row_selector).locator(trading_mode_col)).to_have_text(
|
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(
|
expect(
|
||||||
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)
|
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)
|
||||||
).to_have_text("100.00 (>100%)")
|
).to_have_text("100.00 (>100%)")
|
||||||
|
|
||||||
vega.forward("10s")
|
vega.forward("10s")
|
||||||
vega.wait_fn(1)
|
vega.wait_fn(10)
|
||||||
vega.wait_for_total_catchup()
|
vega.wait_for_total_catchup()
|
||||||
expect(
|
expect(
|
||||||
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)
|
page.get_by_test_id(liquidity_supplied).get_by_test_id(item_value)
|
||||||
|
@ -197,10 +197,10 @@ def test_market_info_risk_factors(page: Page):
|
|||||||
fields = [
|
fields = [
|
||||||
["Long", "0.05153"],
|
["Long", "0.05153"],
|
||||||
["Short", "0.05422"],
|
["Short", "0.05422"],
|
||||||
["Max Leverage Long", "19.036"],
|
["Max Leverage Long", "19.406"],
|
||||||
["Max Leverage Short", "18.111"],
|
["Max Leverage Short", "18.445"],
|
||||||
["Max Initial Leverage Long", "12.691"],
|
["Max Initial Leverage Long", "12.937"],
|
||||||
["Max Initial Leverage Short", "12.074"],
|
["Max Initial Leverage Short", "12.297"],
|
||||||
]
|
]
|
||||||
validate_info_section(page, fields)
|
validate_info_section(page, fields)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ def test_market_selector_filter(continuous_market, page: Page):
|
|||||||
page.get_by_test_id("search-term").fill("btc")
|
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')).to_have_count(1)
|
||||||
expect(page.locator('[data-testid="market-selector-list"] a').nth(0)).to_have_text(
|
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()
|
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()
|
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')).to_have_count(1)
|
||||||
expect(page.locator('[data-testid="market-selector-list"] a').nth(0)).to_have_text(
|
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"
|
||||||
)
|
)
|
||||||
|
@ -632,13 +632,9 @@ export const RiskFactorsInfoPanel = ({
|
|||||||
|
|
||||||
const { short, long } = market.riskFactors;
|
const { short, long } = market.riskFactors;
|
||||||
|
|
||||||
const maxLeverageLong = new BigNumber(1).dividedBy(
|
const maxLeverageLong = new BigNumber(1).dividedBy(long);
|
||||||
new BigNumber(market.linearSlippageFactor).plus(long)
|
|
||||||
);
|
|
||||||
|
|
||||||
const maxLeverageShort = new BigNumber(1).dividedBy(
|
const maxLeverageShort = new BigNumber(1).dividedBy(short);
|
||||||
new BigNumber(market.linearSlippageFactor).plus(short)
|
|
||||||
);
|
|
||||||
|
|
||||||
const maxInitialLeverageLong = !market.tradableInstrument.marginCalculator
|
const maxInitialLeverageLong = !market.tradableInstrument.marginCalculator
|
||||||
? undefined
|
? undefined
|
||||||
|
Loading…
Reference in New Issue
Block a user