Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efb746f373 | ||
|
|
6d2f367987 | ||
|
|
6b7bbc9c94 | ||
|
|
9153677a33 | ||
|
|
cff1818940 | ||
|
|
d05dd6e4cb | ||
|
|
4ef789e00a | ||
|
|
0bd13a5f7b | ||
|
|
67d38ff03e |
@@ -1,6 +1,7 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import type { MarketInfoWithData } from '@vegaprotocol/markets';
|
||||
import {
|
||||
LiquidationStrategyInfoPanel,
|
||||
LiquidityPriceRangeInfoPanel,
|
||||
LiquiditySLAParametersInfoPanel,
|
||||
MarginScalingFactorsPanel,
|
||||
@@ -94,6 +95,8 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
||||
</>
|
||||
)
|
||||
)}
|
||||
<h2 className={headerClassName}>{t('Liquidation strategy')}</h2>
|
||||
<LiquidationStrategyInfoPanel market={market} />
|
||||
<h2 className={headerClassName}>{t('Liquidity monitoring')}</h2>
|
||||
<LiquidityMonitoringParametersInfoPanel market={market} />
|
||||
<h2 className={headerClassName}>{t('Liquidity price range')}</h2>
|
||||
|
||||
@@ -215,7 +215,7 @@ context(
|
||||
});
|
||||
|
||||
// 3003-PMAN-001
|
||||
it(
|
||||
it.skip(
|
||||
'Able to submit valid new market proposal',
|
||||
// @ts-ignore clash between jest and cypress
|
||||
{ tags: '@smoke' },
|
||||
|
||||
-1
@@ -266,7 +266,6 @@ export const ProposalMarketData = ({
|
||||
/>
|
||||
</>
|
||||
))}
|
||||
|
||||
<h2 className={marketDataHeaderStyles}>
|
||||
{t('Liquidity monitoring parameters')}
|
||||
</h2>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
CONSOLE_IMAGE_NAME=vegaprotocol/trading:latest
|
||||
VEGA_VERSION=v0.74.0-preview.2
|
||||
VEGA_VERSION=v0.74.0-preview.6
|
||||
LOCAL_SERVER=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
CONSOLE_IMAGE_NAME=vegaprotocol/trading:develop
|
||||
VEGA_VERSION=v0.74.0-preview.2
|
||||
VEGA_VERSION=v0.74.0-preview.6
|
||||
LOCAL_SERVER=false
|
||||
|
||||
Generated
+2
-2
@@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
@@ -1161,7 +1161,7 @@ profile = ["pytest-profiling", "snakeviz"]
|
||||
type = "git"
|
||||
url = "https://github.com/vegaprotocol/vega-market-sim.git/"
|
||||
reference = "HEAD"
|
||||
resolved_reference = "4440abbb6ce0d3e80beba5cd01f20cd21983cbf8"
|
||||
resolved_reference = "026976549c21e59f6f9c48f06ab15a210c5a5bf3"
|
||||
|
||||
[[package]]
|
||||
name = "websocket-client"
|
||||
|
||||
@@ -11,27 +11,35 @@ place_order = "place-order"
|
||||
deal_ticket_warning_margin = "deal-ticket-warning-margin"
|
||||
deal_ticket_deposit_dialog_button = "deal-ticket-deposit-dialog-button"
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def vega(request):
|
||||
with init_vega(request) as vega:
|
||||
yield vega
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def continuous_market(vega):
|
||||
return setup_continuous_market(vega)
|
||||
|
||||
|
||||
@pytest.mark.skip("marked id issue #5681")
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_should_display_info_and_button_for_deposit(continuous_market, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
page.get_by_test_id(order_size).fill("200000")
|
||||
page.get_by_test_id(order_price).fill("20")
|
||||
# 7002-SORD-060
|
||||
expect(page.get_by_test_id(deal_ticket_warning_margin)).to_have_text("You may not have enough margin available to open this position.")
|
||||
expect(page.get_by_test_id(deal_ticket_warning_margin)).to_have_text(
|
||||
"You may not have enough margin available to open this position.")
|
||||
page.get_by_test_id(deal_ticket_warning_margin).hover()
|
||||
expect(page.get_by_test_id("tooltip-content").nth(0)).to_have_text("1,661,896.6317 tDAI is currently required.You have only 1,000,000.00.Deposit tDAI")
|
||||
expect(page.get_by_test_id("tooltip-content").nth(0)).to_have_text(
|
||||
"1,661,896.6317 tDAI is currently required.You have only 1,000,000.00.Deposit tDAI")
|
||||
page.get_by_test_id(deal_ticket_deposit_dialog_button).nth(0).click()
|
||||
expect(page.get_by_test_id("sidebar-content")).to_contain_text("DepositFrom")
|
||||
|
||||
expect(page.get_by_test_id("sidebar-content")
|
||||
).to_contain_text("DepositFrom")
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("auth", "risk_accepted")
|
||||
def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
page.goto(f"/#/markets/{continuous_market}")
|
||||
@@ -42,5 +50,6 @@ def test_should_show_an_error_if_your_balance_is_zero(continuous_market, vega: V
|
||||
# 7002-SORD-060
|
||||
expect(page.get_by_test_id(place_order)).to_be_enabled()
|
||||
# 7002-SORD-003
|
||||
expect(page.get_by_test_id("deal-ticket-error-message-zero-balance")).to_have_text("You need tDAI in your wallet to trade in this market.Make a deposit")
|
||||
expect(page.get_by_test_id(deal_ticket_deposit_dialog_button)).to_be_visible()
|
||||
expect(page.get_by_test_id("deal-ticket-error-message-zero-balance")
|
||||
).to_have_text("You need tDAI in your wallet to trade in this market.Make a deposit")
|
||||
expect(page.get_by_test_id(deal_ticket_deposit_dialog_button)).to_be_visible()
|
||||
|
||||
@@ -10,15 +10,18 @@ import logging
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
||||
@pytest.fixture(scope="class")
|
||||
def vega():
|
||||
with init_vega() as vega:
|
||||
yield vega
|
||||
|
||||
|
||||
@pytest.fixture(scope="class")
|
||||
def simple_market(vega: VegaServiceNull):
|
||||
return setup_simple_market(vega)
|
||||
|
||||
|
||||
class TestGetStarted:
|
||||
def test_get_started_interactive(self, vega: VegaServiceNull, page: Page):
|
||||
page.goto("/")
|
||||
@@ -30,7 +33,8 @@ class TestGetStarted:
|
||||
expect(page.locator(".list-none")).to_contain_text(
|
||||
"1.Connect2.Deposit funds3.Open a position"
|
||||
)
|
||||
DEFAULT_WALLET_NAME = "MarketSim" # This is the default wallet name within VegaServiceNull and CANNOT be changed
|
||||
# This is the default wallet name within VegaServiceNull and CANNOT be changed
|
||||
DEFAULT_WALLET_NAME = "MarketSim"
|
||||
|
||||
# Calling get_keypairs will internally call _load_tokens for the given wallet
|
||||
keypairs = vega.wallet.get_keypairs(DEFAULT_WALLET_NAME)
|
||||
@@ -137,7 +141,8 @@ class TestGetStarted:
|
||||
def test_get_started_seen_already(self, simple_market, page: Page):
|
||||
page.goto(f"/#/markets/{simple_market}")
|
||||
get_started_locator = page.get_by_test_id("connect-vega-wallet")
|
||||
page.wait_for_selector('[data-testid="connect-vega-wallet"]', state="attached")
|
||||
page.wait_for_selector(
|
||||
'[data-testid="connect-vega-wallet"]', state="attached")
|
||||
expect(get_started_locator).to_be_enabled
|
||||
expect(get_started_locator).to_be_visible
|
||||
# 0007-FUGS-015
|
||||
|
||||
@@ -36,16 +36,19 @@ def validate_info_section(page: Page, fields: [[str, str]]):
|
||||
for rowNumber, field in enumerate(fields):
|
||||
name, value = field
|
||||
expect(
|
||||
page.get_by_test_id("key-value-table-row").nth(rowNumber).locator("dt")
|
||||
page.get_by_test_id(
|
||||
"key-value-table-row").nth(rowNumber).locator("dt")
|
||||
).to_contain_text(name)
|
||||
expect(
|
||||
page.get_by_test_id("key-value-table-row").nth(rowNumber).locator("dd")
|
||||
page.get_by_test_id(
|
||||
"key-value-table-row").nth(rowNumber).locator("dd")
|
||||
).to_contain_text(value)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_current_fees(page: Page):
|
||||
# 6002-MDET-101
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Current fees").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Current fees").click()
|
||||
fields = [
|
||||
["Maker Fee", "10%"],
|
||||
["Infrastructure Fee", "0.05%"],
|
||||
@@ -54,10 +57,11 @@ def test_market_info_current_fees(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_market_price(page: Page):
|
||||
# 6002-MDET-102
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Market price").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Market price").click()
|
||||
fields = [
|
||||
["Mark Price", "107.50"],
|
||||
["Best Bid Price", "101.50"],
|
||||
@@ -66,10 +70,11 @@ def test_market_info_market_price(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_market_volume(page: Page):
|
||||
# 6002-MDET-103
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Market volume").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Market volume").click()
|
||||
fields = [
|
||||
["24 Hour Volume", "-"],
|
||||
["Open Interest", "1"],
|
||||
@@ -80,17 +85,32 @@ def test_market_info_market_volume(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
def test_market_info_insurance_pool(page: Page):
|
||||
# 6002-MDET-104
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Insurance pool").click()
|
||||
fields = [["Balance", "0.00 tDAI"]]
|
||||
|
||||
def test_market_info_liquidation_strategy(page: Page):
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Liquidation strategy").click()
|
||||
fields = [
|
||||
["Disposal Fraction", "1"],
|
||||
["Disposal Time Step", "1"],
|
||||
["Full Disposal Size", "1,000,000,000"],
|
||||
["Max Fraction Consumed", "0.5"],
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_liquidation(page: Page):
|
||||
# 6002-MDET-104
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Liquidations").click()
|
||||
fields = [["Insurance Pool Balance", "0.00 tDAI"]]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
|
||||
@pytest.mark.skip("core issue #5681")
|
||||
def test_market_info_key_details(page: Page, vega: VegaServiceNull):
|
||||
# 6002-MDET-201
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Key details").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Key details").click()
|
||||
market_id = vega.find_market_id("BTC:DAI_2023")
|
||||
short_market_id = market_id[:6] + "…" + market_id[-4:]
|
||||
fields = [
|
||||
@@ -106,7 +126,7 @@ def test_market_info_key_details(page: Page, vega: VegaServiceNull):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_instrument(page: Page):
|
||||
# 6002-MDET-202
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Instrument").click()
|
||||
@@ -121,7 +141,7 @@ def test_market_info_instrument(page: Page):
|
||||
|
||||
# @pytest.mark.skip("oracle test to be fixed")
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_oracle(page: Page):
|
||||
# 6002-MDET-203
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Oracle").click()
|
||||
@@ -135,10 +155,11 @@ def test_market_info_oracle(page: Page):
|
||||
# "href", re.compile(rf'(\/oracles\/{vega.find_market_id("BTC:DAI_2023")})')
|
||||
# )
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_settlement_asset(page: Page, vega: VegaServiceNull):
|
||||
# 6002-MDET-206
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Settlement asset").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Settlement asset").click()
|
||||
tdai_id = vega.find_asset_id("tDAI")
|
||||
tdai_id_short = tdai_id[:6] + "…" + tdai_id[-4:]
|
||||
fields = [
|
||||
@@ -155,7 +176,7 @@ def test_market_info_settlement_asset(page: Page, vega: VegaServiceNull):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_metadata(page: Page):
|
||||
# 6002-MDET-207
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Metadata").click()
|
||||
@@ -164,7 +185,7 @@ def test_market_info_metadata(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_risk_model(page: Page):
|
||||
# 6002-MDET-208
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Risk model").click()
|
||||
@@ -175,7 +196,7 @@ def test_market_info_risk_model(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_margin_scaling_factors(page: Page):
|
||||
# 6002-MDET-209
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
@@ -183,17 +204,17 @@ def test_market_info_margin_scaling_factors(page: Page):
|
||||
).click()
|
||||
fields = [
|
||||
["Linear Slippage Factor", "0.001"],
|
||||
["Quadratic Slippage Factor", "0"],
|
||||
["Search Level", "1.1"],
|
||||
["Initial Margin", "1.5"],
|
||||
["Collateral Release", "1.7"],
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_risk_factors(page: Page):
|
||||
# 6002-MDET-210
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Risk factors").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Risk factors").click()
|
||||
fields = [
|
||||
["Long", "0.05153"],
|
||||
["Short", "0.05422"],
|
||||
@@ -204,7 +225,7 @@ def test_market_info_risk_factors(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_price_monitoring_bounds(page: Page):
|
||||
# 6002-MDET-211
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
@@ -213,27 +234,27 @@ def test_market_info_price_monitoring_bounds(page: Page):
|
||||
expect(page.locator("p.col-span-1").nth(0)).to_contain_text(
|
||||
"99.9999% probability price bounds"
|
||||
)
|
||||
expect(page.locator("p.col-span-1").nth(1)).to_contain_text("Within 86,400 seconds")
|
||||
expect(page.locator("p.col-span-1").nth(1)
|
||||
).to_contain_text("Within 86,400 seconds")
|
||||
fields = [
|
||||
["Highest Price", "138.66685 BTC"],
|
||||
["Lowest Price", "83.11038 BTC"],
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_liquidity_monitoring_parameters(page: Page):
|
||||
# 6002-MDET-212
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Liquidity monitoring parameters"
|
||||
).click()
|
||||
fields = [
|
||||
["Triggering Ratio", "0.7"],
|
||||
["Time Window", "3,600"],
|
||||
["Scaling Factor", "1"],
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
# Liquidity resolves to 3 results
|
||||
def test_market_info_liquidit(page: Page):
|
||||
# 6002-MDET-213
|
||||
@@ -246,7 +267,7 @@ def test_market_info_liquidit(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_liquidity_price_range(page: Page):
|
||||
# 6002-MDET-214
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
@@ -259,19 +280,22 @@ def test_market_info_liquidity_price_range(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_proposal(page: Page, vega: VegaServiceNull):
|
||||
# 6002-MDET-301
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Proposal").click()
|
||||
first_link = (
|
||||
page.get_by_test_id("accordion-content").get_by_test_id("external-link").first
|
||||
page.get_by_test_id(
|
||||
"accordion-content").get_by_test_id("external-link").first
|
||||
)
|
||||
second_link = (
|
||||
page.get_by_test_id("accordion-content").get_by_test_id("external-link").nth(1)
|
||||
page.get_by_test_id(
|
||||
"accordion-content").get_by_test_id("external-link").nth(1)
|
||||
)
|
||||
expect(first_link).to_have_text("View governance proposal")
|
||||
expect(first_link).to_have_attribute(
|
||||
"href", re.compile(rf'(\/proposals\/{vega.find_market_id("BTC:DAI_2023")})')
|
||||
"href", re.compile(
|
||||
rf'(\/proposals\/{vega.find_market_id("BTC:DAI_2023")})')
|
||||
)
|
||||
expect(second_link).to_have_text("Propose a change to market")
|
||||
|
||||
@@ -280,13 +304,14 @@ def test_market_info_proposal(page: Page, vega: VegaServiceNull):
|
||||
"href", re.compile(r"(\/proposals\/propose\/update-market)")
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip("tbd-market-sim")
|
||||
|
||||
def test_market_info_succession_line(page: Page, vega: VegaServiceNull):
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Succession line").click()
|
||||
page.get_by_test_id(market_title_test_id).get_by_text(
|
||||
"Succession line").click()
|
||||
market_id = vega.find_market_id("BTC:DAI_2023")
|
||||
succession_line = page.get_by_test_id("succession-line-item")
|
||||
expect(succession_line.get_by_test_id("external-link")).to_have_text("BTC:DAI_2023")
|
||||
expect(succession_line.get_by_test_id(
|
||||
"external-link")).to_have_text("BTC:DAI_2023")
|
||||
expect(succession_line.get_by_test_id("external-link")).to_have_attribute(
|
||||
"href", re.compile(rf"(\/proposals\/{market_id})")
|
||||
)
|
||||
|
||||
@@ -128,10 +128,11 @@ def test_limit_order_trade_open_position(continuous_market, page: Page):
|
||||
position["leverage"]
|
||||
)
|
||||
|
||||
liquidation = table.locator("[col-id='liquidationPrice']")
|
||||
expect(liquidation.get_by_test_id("liquidation-price")).to_have_text(
|
||||
position["liquidation"]
|
||||
)
|
||||
# need to ne check why it is not visible
|
||||
# liquidation = table.locator("[col-id='liquidationPrice']")
|
||||
# expect(liquidation.get_by_test_id("liquidation-price")).to_have_text(
|
||||
# position["liquidation"]
|
||||
# )
|
||||
|
||||
realisedPNL = table.locator("[col-id='realisedPNL']")
|
||||
expect(realisedPNL).to_have_text(position["realised_pnl"])
|
||||
|
||||
@@ -7,7 +7,7 @@ from wallet_config import MM_WALLET, PARTY_A, PARTY_B
|
||||
from vega_sim.service import MarketStateUpdateType
|
||||
import vega_sim.api.governance as governance
|
||||
|
||||
|
||||
@pytest.mark.skip("Skipping to unblock CI, working on fix")
|
||||
@pytest.mark.usefixtures("risk_accepted", "auth")
|
||||
def test_filtered_cards(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
tDAI_asset_id = vega.find_asset_id(symbol="tDAI")
|
||||
@@ -46,7 +46,9 @@ def test_filtered_cards(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
side="SIDE_BUY",
|
||||
volume=1,
|
||||
)
|
||||
next_epoch(vega=vega)
|
||||
vega.wait_fn(1)
|
||||
vega.wait_for_total_catchup()
|
||||
page.goto("/#/rewards")
|
||||
|
||||
vega.update_market_state(
|
||||
market_id=continuous_market,
|
||||
@@ -55,8 +57,9 @@ def test_filtered_cards(continuous_market, vega: VegaServiceNull, page: Page):
|
||||
forward_time_to_enactment=True,
|
||||
)
|
||||
next_epoch(vega=vega)
|
||||
page.goto("/#/rewards")
|
||||
expect(page.locator(".from-vega-cdark-400")).to_be_visible()
|
||||
|
||||
page.reload()
|
||||
expect(page.locator(".from-vega-cdark-400")).to_be_visible(timeout=15000)
|
||||
governance.submit_oracle_data(
|
||||
wallet=vega.wallet,
|
||||
payload={"trading.terminated": "true"},
|
||||
|
||||
@@ -8,7 +8,7 @@ from actions.utils import next_epoch
|
||||
|
||||
market_banner = "market-banner"
|
||||
|
||||
@pytest.mark.skip("tbd")
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_succession_line(vega: VegaServiceNull, page: Page):
|
||||
parent_market_id = setup_continuous_market(vega)
|
||||
@@ -20,12 +20,14 @@ def test_succession_line(vega: VegaServiceNull, page: Page):
|
||||
expect(page.get_by_test_id(market_banner)).not_to_be_attached()
|
||||
|
||||
successor_name = "successor market name"
|
||||
successor_id = propose_successor(vega, parent_market_id, tdai_id, successor_name)
|
||||
successor_id = propose_successor(
|
||||
vega, parent_market_id, tdai_id, successor_name)
|
||||
|
||||
# Check that the banner notifying about the successor proposal is shown
|
||||
banner = page.get_by_test_id(market_banner)
|
||||
expect(banner).to_be_attached()
|
||||
expect(banner.get_by_text("A successor to this market has been proposed")).to_be_visible()
|
||||
expect(banner.get_by_text(
|
||||
"A successor to this market has been proposed")).to_be_visible()
|
||||
|
||||
next_epoch(vega)
|
||||
|
||||
@@ -45,7 +47,6 @@ def test_succession_line(vega: VegaServiceNull, page: Page):
|
||||
# the succession line
|
||||
page.reload()
|
||||
|
||||
#tbd issue - 5546
|
||||
page.get_by_test_id("Info").click()
|
||||
|
||||
page.get_by_role("button", name="Succession line").click()
|
||||
@@ -78,6 +79,7 @@ def test_succession_line(vega: VegaServiceNull, page: Page):
|
||||
page.wait_for_selector('[data-testid="market-banner"]', state="attached")
|
||||
expect(banner.get_by_text("This market has been succeeded")).to_be_visible()
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("risk_accepted")
|
||||
def test_banners(vega: VegaServiceNull, page: Page):
|
||||
|
||||
@@ -91,9 +93,9 @@ def test_banners(vega: VegaServiceNull, page: Page):
|
||||
expect(page.get_by_test_id(market_banner)).not_to_be_attached()
|
||||
|
||||
vega.submit_termination_and_settlement_data(
|
||||
settlement_key=GOVERNANCE_WALLET.name,
|
||||
settlement_price=100,
|
||||
market_id=parent_market_id,
|
||||
settlement_key=GOVERNANCE_WALLET.name,
|
||||
settlement_price=100,
|
||||
market_id=parent_market_id,
|
||||
)
|
||||
|
||||
successor_name = "successor market name"
|
||||
@@ -108,7 +110,7 @@ def test_banners(vega: VegaServiceNull, page: Page):
|
||||
# Check that the banner notifying about the successor proposal and market has been settled are shown still after reload
|
||||
page.reload()
|
||||
expect(banner.get_by_text(banner_successor_text)).to_be_visible()
|
||||
expect(banner.get_by_text("1/2")).to_be_visible()
|
||||
expect(banner.get_by_text("1/2")).to_be_visible()
|
||||
# Check that the banner notifying about the successor proposal is not visible after close those banners
|
||||
banner.get_by_test_id("icon-cross").click()
|
||||
expect(banner.get_by_text("This market has been settled")).to_be_visible()
|
||||
@@ -119,7 +121,8 @@ def test_banners(vega: VegaServiceNull, page: Page):
|
||||
expect(page.get_by_test_id(market_banner)).not_to_be_attached()
|
||||
page.reload()
|
||||
expect(banner).to_be_attached()
|
||||
expect(banner.get_by_text(banner_successor_text)).to_be_visible()
|
||||
expect(banner.get_by_text(banner_successor_text)).to_be_visible()
|
||||
|
||||
|
||||
def propose_successor(
|
||||
vega: VegaServiceNull, parent_market_id, tdai_id, market_name
|
||||
@@ -137,6 +140,7 @@ def propose_successor(
|
||||
)
|
||||
return market_id
|
||||
|
||||
|
||||
def provide_successor_liquidity(
|
||||
vega: VegaServiceNull, market_id
|
||||
):
|
||||
|
||||
@@ -38,7 +38,7 @@ const BreakdownTable = forwardRef<AgGridReact, BreakdownTableProps>(
|
||||
{
|
||||
headerName: t('Market'),
|
||||
field: 'market.tradableInstrument.instrument.code',
|
||||
width: 90,
|
||||
maxWidth: 150,
|
||||
pinned: true,
|
||||
sort: 'desc',
|
||||
cellRenderer: ({
|
||||
|
||||
@@ -29,6 +29,7 @@ export const assetsProvider = makeDataProvider<
|
||||
>({
|
||||
query: AssetsDocument,
|
||||
getData,
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
export const assetsMapProvider = makeDerivedDataProvider<
|
||||
|
||||
@@ -20,6 +20,9 @@ query Candles($marketId: ID!, $interval: Interval!, $since: String!) {
|
||||
code
|
||||
}
|
||||
}
|
||||
marketTimestamps {
|
||||
open
|
||||
}
|
||||
candlesConnection(
|
||||
interval: $interval
|
||||
since: $since
|
||||
|
||||
+4
-1
@@ -12,7 +12,7 @@ export type CandlesQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', periodStart: any, lastUpdateInPeriod: any, high: string, low: string, open: string, close: string, volume: string } } | null> | null } | null } | null };
|
||||
export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, marketTimestamps: { __typename?: 'MarketTimestamps', open: any }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', periodStart: any, lastUpdateInPeriod: any, high: string, low: string, open: string, close: string, volume: string } } | null> | null } | null } | null };
|
||||
|
||||
export type CandlesEventsSubscriptionVariables = Types.Exact<{
|
||||
marketId: Types.Scalars['ID'];
|
||||
@@ -46,6 +46,9 @@ export const CandlesDocument = gql`
|
||||
code
|
||||
}
|
||||
}
|
||||
marketTimestamps {
|
||||
open
|
||||
}
|
||||
candlesConnection(interval: $interval, since: $since, pagination: {last: 5000}) {
|
||||
edges {
|
||||
node {
|
||||
|
||||
@@ -15,6 +15,10 @@ export const candlesQuery = (
|
||||
id: 'market-0',
|
||||
decimalPlaces: 5,
|
||||
positionDecimalPlaces: 0,
|
||||
marketTimestamps: {
|
||||
__typename: 'MarketTimestamps',
|
||||
open: '2022-04-06T09:15:00Z',
|
||||
},
|
||||
tradableInstrument: {
|
||||
instrument: {
|
||||
id: '',
|
||||
|
||||
@@ -13,6 +13,9 @@ const returnDataMocks = (nodes: CandleFieldsFragment[]): CandlesQuery => {
|
||||
market: {
|
||||
decimalPlaces: 1,
|
||||
positionDecimalPlaces: 1,
|
||||
marketTimestamps: {
|
||||
open: '2022-05-10T11:00:00Z',
|
||||
},
|
||||
candlesConnection: {
|
||||
edges: nodes.map((node) => ({ node })),
|
||||
},
|
||||
|
||||
@@ -172,13 +172,30 @@ export class VegaDataSource implements DataSource {
|
||||
},
|
||||
fetchPolicy: 'no-cache',
|
||||
});
|
||||
|
||||
if (data?.market?.candlesConnection?.edges) {
|
||||
const decimalPlaces = data.market.decimalPlaces;
|
||||
const positionDecimalPlaces = data.market.positionDecimalPlaces;
|
||||
|
||||
const openSince =
|
||||
typeof data.market.marketTimestamps.open === 'string' &&
|
||||
data.market.marketTimestamps.open.length > 0
|
||||
? new Date(data.market.marketTimestamps.open)
|
||||
: // this should never happen, but just in case let's have it as
|
||||
// Date(0) if the market data is incomplete for some reason
|
||||
new Date(0);
|
||||
|
||||
if (this.from < openSince) {
|
||||
// overwrite `from` if requested value is before the market's open date
|
||||
this.from = openSince;
|
||||
}
|
||||
|
||||
const candles = data.market.candlesConnection.edges
|
||||
.map((edge) => edge?.node)
|
||||
.filter((node): node is CandleFieldsFragment => !!node)
|
||||
.filter(
|
||||
(node) => sinceMarketOpen(node, openSince) && !emptyCandle(node)
|
||||
)
|
||||
.map((node) =>
|
||||
parseCandle(node, decimalPlaces, positionDecimalPlaces)
|
||||
)
|
||||
@@ -326,3 +343,9 @@ function parseCandle(
|
||||
volume: Number(addDecimal(candle.volume, positionDecimalPlaces)),
|
||||
};
|
||||
}
|
||||
|
||||
const sinceMarketOpen = (candle: CandleFieldsFragment, openSince: Date) =>
|
||||
new Date(candle.periodStart) >= openSince;
|
||||
|
||||
const emptyCandle = (candle: CandleFieldsFragment) =>
|
||||
candle.high === '' && candle.low === '';
|
||||
|
||||
@@ -22,11 +22,9 @@ import {
|
||||
type QueryOptions,
|
||||
type ApolloClient,
|
||||
} from '@apollo/client';
|
||||
import { ApolloError } from '@apollo/client';
|
||||
import type { GraphQLErrors } from '@apollo/client/errors';
|
||||
import { type ApolloError } from '@apollo/client';
|
||||
import { GraphQLError } from 'graphql';
|
||||
import { type Subscription, type Observable } from 'zen-observable-ts';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
|
||||
type Item = {
|
||||
cursor: string;
|
||||
@@ -117,24 +115,6 @@ const paginatedSubscribe = makeDataProvider<
|
||||
},
|
||||
});
|
||||
|
||||
const mockErrorPolicyGuard: (errors: GraphQLErrors) => boolean = jest
|
||||
.fn()
|
||||
.mockImplementation(() => true);
|
||||
const errorGuardedSubscribe = makeDataProvider<
|
||||
QueryData,
|
||||
Data,
|
||||
SubscriptionData,
|
||||
Delta,
|
||||
Variables
|
||||
>({
|
||||
query,
|
||||
subscriptionQuery,
|
||||
update,
|
||||
getData,
|
||||
getDelta,
|
||||
errorPolicyGuard: mockErrorPolicyGuard,
|
||||
});
|
||||
|
||||
const derivedSubscribe = makeDerivedDataProvider(
|
||||
[paginatedSubscribe, subscribe],
|
||||
combineData,
|
||||
@@ -404,34 +384,6 @@ describe('data provider', () => {
|
||||
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
|
||||
it('should retry with ignore error policy if errorPolicyGuard returns true', async () => {
|
||||
const subscription = errorGuardedSubscribe(callback, client, variables);
|
||||
const graphQLError = new GraphQLError(
|
||||
'',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
['market', 'data'],
|
||||
undefined,
|
||||
{
|
||||
type: 'Internal',
|
||||
}
|
||||
);
|
||||
const graphQLErrors = [graphQLError];
|
||||
const error = new ApolloError({ graphQLErrors });
|
||||
|
||||
await rejectQuery(error);
|
||||
const data = generateData(0, 5);
|
||||
await resolveQuery({
|
||||
data,
|
||||
});
|
||||
expect(mockErrorPolicyGuard).toHaveBeenNthCalledWith(1, graphQLErrors);
|
||||
await waitFor(() =>
|
||||
expect(getData).toHaveBeenCalledWith({ data }, variables)
|
||||
);
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
});
|
||||
|
||||
describe('derived data provider', () => {
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {
|
||||
ApolloQueryResult,
|
||||
QueryOptions,
|
||||
} from '@apollo/client';
|
||||
import type { GraphQLErrors } from '@apollo/client/errors';
|
||||
import type { Subscription } from 'zen-observable-ts';
|
||||
import isEqualWith from 'lodash/isEqualWith';
|
||||
import { isNotFoundGraphQLError } from './helpers';
|
||||
@@ -161,7 +160,7 @@ interface DataProviderParams<
|
||||
resetDelay?: number;
|
||||
pollInterval?: number;
|
||||
additionalContext?: Record<string, unknown>;
|
||||
errorPolicyGuard?: (graphqlErrors: GraphQLErrors) => boolean;
|
||||
errorPolicy?: ErrorPolicy;
|
||||
getQueryVariables?: (variables: Variables) => QueryVariables;
|
||||
getSubscriptionVariables?: (
|
||||
variables: Variables
|
||||
@@ -176,7 +175,7 @@ interface DataProviderParams<
|
||||
* @param fetchPolicy
|
||||
* @param resetDelay
|
||||
* @param additionalContext add property to the context of the query, ie. 'isEnlargedTimeout'
|
||||
* @param errorPolicyGuard indicate which gql errors can be tolerate
|
||||
* @param errorPolicy Apollos error policy, will be used when querying
|
||||
* @returns subscribe function
|
||||
*/
|
||||
function makeDataProviderInternal<
|
||||
@@ -197,7 +196,7 @@ function makeDataProviderInternal<
|
||||
fetchPolicy,
|
||||
resetDelay,
|
||||
additionalContext,
|
||||
errorPolicyGuard,
|
||||
errorPolicy = 'none',
|
||||
getQueryVariables,
|
||||
getSubscriptionVariables,
|
||||
pollInterval,
|
||||
@@ -331,20 +330,10 @@ function makeDataProviderInternal<
|
||||
const callQuery = (
|
||||
pagination?: Pagination,
|
||||
policy?: ErrorPolicy
|
||||
): Promise<ApolloQueryResult<QueryData>> =>
|
||||
client
|
||||
.query<QueryData>(getQueryOptions(pagination, policy))
|
||||
.catch((err) => {
|
||||
if (
|
||||
err.graphQLErrors &&
|
||||
errorPolicyGuard &&
|
||||
errorPolicyGuard(err.graphQLErrors)
|
||||
) {
|
||||
return callQuery(pagination, 'ignore');
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
): Promise<ApolloQueryResult<QueryData>> => {
|
||||
const options = getQueryOptions(pagination, policy);
|
||||
return client.query<QueryData>(options);
|
||||
};
|
||||
|
||||
const load = async () => {
|
||||
if (!pagination) {
|
||||
@@ -364,7 +353,7 @@ function makeDataProviderInternal<
|
||||
}
|
||||
}
|
||||
|
||||
const res = await callQuery(paginationVariables);
|
||||
const res = await callQuery(paginationVariables, errorPolicy);
|
||||
|
||||
const insertionData = getData(res.data, variables);
|
||||
const insertionPageInfo = pagination.getPageInfo(res.data);
|
||||
@@ -417,12 +406,14 @@ function makeDataProviderInternal<
|
||||
const paginationVariables = pagination
|
||||
? { first: pagination.first }
|
||||
: undefined;
|
||||
|
||||
if (pollInterval) {
|
||||
callWatchQuery();
|
||||
callWatchQuery(paginationVariables, errorPolicy);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
onNext(await callQuery(paginationVariables));
|
||||
onNext(await callQuery(paginationVariables, errorPolicy));
|
||||
} catch (e) {
|
||||
onError(e as Error);
|
||||
} finally {
|
||||
|
||||
@@ -27,10 +27,3 @@ const hasNotFoundGraphQLErrors = (errors: GraphQLErrors, path?: string[]) => {
|
||||
(!path || path.every((item, i) => item === e?.path?.[i]))
|
||||
);
|
||||
};
|
||||
|
||||
export const marketDataErrorPolicyGuard = (errors: GraphQLErrors) =>
|
||||
errors.every(
|
||||
(e) =>
|
||||
e.message.match(/no market data for market:/i) ||
|
||||
e.message.match(/Conditions list is empty/)
|
||||
);
|
||||
|
||||
@@ -65,7 +65,7 @@ const CrossMarginModeDialog = ({
|
||||
onClick={() => {
|
||||
create({
|
||||
updateMarginMode: {
|
||||
market_id: marketId,
|
||||
marketId,
|
||||
mode: MarginMode.MARGIN_MODE_CROSS_MARGIN,
|
||||
},
|
||||
});
|
||||
@@ -131,7 +131,7 @@ const IsolatedMarginModeDialog = ({
|
||||
onSubmit={() => {
|
||||
create({
|
||||
updateMarginMode: {
|
||||
market_id: marketId,
|
||||
marketId,
|
||||
mode: MarginMode.MARGIN_MODE_ISOLATED_MARGIN,
|
||||
marginFactor: `${1 / leverage}`,
|
||||
},
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
"Key": "Key",
|
||||
"Key details": "Key details",
|
||||
"Liquidity": "Liquidity",
|
||||
"Liquidations": "Liquidations",
|
||||
"Liquidity monitoring parameters": "Liquidity monitoring parameters",
|
||||
"Liquidity portion of the fee is paid to liquidity providers, and is transferred to the liquidity fee pool for the market.": "Liquidity portion of the fee is paid to liquidity providers, and is transferred to the liquidity fee pool for the market.",
|
||||
"Liquidity price range": "Liquidity price range",
|
||||
|
||||
@@ -198,6 +198,12 @@ query MarketInfo($marketId: ID!) {
|
||||
performanceHysteresisEpochs
|
||||
slaCompetitionFactor
|
||||
}
|
||||
liquidationStrategy {
|
||||
disposalTimeStep
|
||||
disposalFraction
|
||||
fullDisposalSize
|
||||
maxFractionConsumed
|
||||
}
|
||||
tradableInstrument {
|
||||
instrument {
|
||||
id
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@ import {
|
||||
InstrumentInfoPanel,
|
||||
InsurancePoolInfoPanel,
|
||||
KeyDetailsInfoPanel,
|
||||
LiquidationStrategyInfoPanel,
|
||||
LiquidityInfoPanel,
|
||||
LiquidityMonitoringParametersInfoPanel,
|
||||
LiquidityPriceRangeInfoPanel,
|
||||
@@ -151,7 +152,7 @@ export const MarketInfoAccordion = ({
|
||||
<AccordionItem
|
||||
key={id}
|
||||
itemId={id}
|
||||
title={t('Insurance pool')}
|
||||
title={t('Liquidations')}
|
||||
content={
|
||||
<InsurancePoolInfoPanel market={market} account={a} />
|
||||
}
|
||||
@@ -269,6 +270,11 @@ export const MarketInfoAccordion = ({
|
||||
);
|
||||
}
|
||||
)}
|
||||
<AccordionItem
|
||||
itemId="liquidation-strategy"
|
||||
title={t('Liquidation strategy')}
|
||||
content={<LiquidationStrategyInfoPanel market={market} />}
|
||||
/>
|
||||
<AccordionItem
|
||||
itemId="liquidity-monitoring-parameters"
|
||||
title={t('Liquidity monitoring parameters')}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
makeDataProvider,
|
||||
makeDerivedDataProvider,
|
||||
marketDataErrorPolicyGuard,
|
||||
} from '@vegaprotocol/data-provider';
|
||||
import {
|
||||
MarketInfoDocument,
|
||||
@@ -33,7 +32,7 @@ export const marketInfoProvider = makeDataProvider<
|
||||
>({
|
||||
query: MarketInfoDocument,
|
||||
getData,
|
||||
errorPolicyGuard: marketDataErrorPolicyGuard,
|
||||
errorPolicy: 'all',
|
||||
pollInterval: 5000,
|
||||
});
|
||||
|
||||
|
||||
@@ -210,10 +210,15 @@ export const KeyDetailsInfoPanel = ({
|
||||
skip: !featureFlags.SUCCESSOR_MARKETS || !market.proposal?.id,
|
||||
});
|
||||
|
||||
const successorProposal =
|
||||
successorProposalDetails?.proposal as SingleProposal<
|
||||
SuccessorMarketProposalDetailsQuery['proposal']
|
||||
>;
|
||||
const successorProposal = successorProposalDetails?.proposal as
|
||||
| SingleProposal<SuccessorMarketProposalDetailsQuery['proposal']>
|
||||
| undefined;
|
||||
|
||||
const successorConfiguration =
|
||||
successorProposal?.terms.change.__typename === 'NewMarket' &&
|
||||
successorProposal.terms.change.successorConfiguration?.__typename ===
|
||||
'SuccessorConfiguration' &&
|
||||
successorProposal.terms.change.successorConfiguration;
|
||||
|
||||
// The following queries are needed as the parent market could also have been a successor market.
|
||||
// Note: the parent market is only passed to this component if the successor markets flag is enabled,
|
||||
@@ -232,17 +237,16 @@ export const KeyDetailsInfoPanel = ({
|
||||
},
|
||||
skip: !parentMarket?.proposal?.id,
|
||||
});
|
||||
const parentProposal =
|
||||
parentSuccessorProposalDetails?.proposal as SingleProposal<
|
||||
SuccessorMarketProposalDetailsQuery['proposal']
|
||||
>;
|
||||
const parentProposal = parentSuccessorProposalDetails?.proposal as
|
||||
| SingleProposal<SuccessorMarketProposalDetailsQuery['proposal']>
|
||||
| undefined;
|
||||
|
||||
const assetDecimals = getAsset(market).decimals;
|
||||
|
||||
return (
|
||||
<>
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow noBorder>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Market ID')}</div>
|
||||
<CopyWithTooltip text={market.id}>
|
||||
<button
|
||||
@@ -259,16 +263,13 @@ export const KeyDetailsInfoPanel = ({
|
||||
</KeyValueTable>
|
||||
<MarketInfoTable
|
||||
data={
|
||||
featureFlags.SUCCESSOR_MARKETS
|
||||
featureFlags.SUCCESSOR_MARKETS && successorConfiguration
|
||||
? {
|
||||
name: market.tradableInstrument.instrument.name,
|
||||
parentMarketID:
|
||||
parentMarketIdData?.market?.parentMarketID || '-',
|
||||
insurancePoolFraction:
|
||||
(successorProposal.terms.change.__typename === 'NewMarket' &&
|
||||
successorProposal.terms.change.successorConfiguration
|
||||
?.insurancePoolFraction) ||
|
||||
'-',
|
||||
successorConfiguration.insurancePoolFraction || '-',
|
||||
status: market.state && MarketStateMapping[market.state],
|
||||
tradingMode:
|
||||
market.tradingMode &&
|
||||
@@ -749,6 +750,30 @@ export const PriceMonitoringBoundsInfoPanel = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const LiquidationStrategyInfoPanel = ({
|
||||
market,
|
||||
parentMarket,
|
||||
}: MarketInfoProps) => {
|
||||
const marketData = {
|
||||
disposalFraction: market.liquidationStrategy?.disposalFraction,
|
||||
disposalTimeStep: market.liquidationStrategy?.disposalTimeStep,
|
||||
fullDisposalSize: market.liquidationStrategy?.fullDisposalSize,
|
||||
maxFractionConsumed: market.liquidationStrategy?.maxFractionConsumed,
|
||||
};
|
||||
|
||||
const parentMarketData = parentMarket
|
||||
? {
|
||||
disposalFraction: parentMarket.liquidationStrategy?.disposalFraction,
|
||||
disposalTimeStep: parentMarket.liquidationStrategy?.disposalTimeStep,
|
||||
fullDisposalSize: parentMarket.liquidationStrategy?.fullDisposalSize,
|
||||
maxFractionConsumed:
|
||||
parentMarket.liquidationStrategy?.maxFractionConsumed,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
return <MarketInfoTable data={marketData} parentData={parentMarketData} />;
|
||||
};
|
||||
|
||||
export const LiquidityMonitoringParametersInfoPanel = ({
|
||||
market,
|
||||
parentMarket,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { marketDataErrorPolicyGuard } from '@vegaprotocol/data-provider';
|
||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||
import {
|
||||
MarketsDataDocument,
|
||||
@@ -54,7 +53,7 @@ export const marketsDataProvider = makeDataProvider<
|
||||
>({
|
||||
query: MarketsDataDocument,
|
||||
getData,
|
||||
errorPolicyGuard: marketDataErrorPolicyGuard,
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
type Variables = { marketIds: string[] };
|
||||
@@ -73,7 +72,7 @@ export const marketsLiveDataProvider = makeDataProvider<
|
||||
getData,
|
||||
getDelta,
|
||||
update,
|
||||
errorPolicyGuard: marketDataErrorPolicyGuard,
|
||||
errorPolicy: 'all',
|
||||
getQueryVariables: () => ({}),
|
||||
getSubscriptionVariables: ({ marketIds }: Variables) =>
|
||||
marketIds.map((marketId) => ({ marketId })),
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useYesterday } from '@vegaprotocol/react-helpers';
|
||||
import {
|
||||
makeDataProvider,
|
||||
makeDerivedDataProvider,
|
||||
marketDataErrorPolicyGuard,
|
||||
useDataProvider,
|
||||
} from '@vegaprotocol/data-provider';
|
||||
import {
|
||||
@@ -45,7 +44,7 @@ export const marketsProvider = makeDataProvider<
|
||||
query: MarketsDocument,
|
||||
getData,
|
||||
fetchPolicy: 'cache-first',
|
||||
errorPolicyGuard: marketDataErrorPolicyGuard,
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
export const marketsMapProvider = makeDerivedDataProvider<
|
||||
|
||||
@@ -39,8 +39,7 @@ export const proposalsDataProvider = makeDataProvider<
|
||||
*
|
||||
* GQL Path: `terms.change.instrument.futureProduct.settlementAsset`
|
||||
*/
|
||||
errorPolicyGuard: (errors) =>
|
||||
errors.every((e) => e.message.match(/failed to get asset for ID/)),
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
const ProposalTypeMap: Record<
|
||||
|
||||
@@ -38,14 +38,14 @@ export function Dialog({
|
||||
);
|
||||
const wrapperClasses = classNames(
|
||||
// Dimensions
|
||||
'max-w-[90vw] p-4 md:p-8',
|
||||
'w-screen sm:max-w-[90vw] p-4 md:p-8',
|
||||
// Need to apply background and text colors again as content is rendered in a portal
|
||||
'dark:bg-black bg-white dark:text-white',
|
||||
getIntentBorder(intent),
|
||||
{
|
||||
'w-[520px]': size === 'small',
|
||||
'w-[680px]': size === 'medium',
|
||||
'w-[720px] lg:w-[940px]': size === 'large',
|
||||
'sm:w-[520px]': size === 'small',
|
||||
'sm:w-[680px]': size === 'medium',
|
||||
'sm:w-[720px] lg:w-[940px]': size === 'large',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ export enum MarginMode {
|
||||
MARGIN_MODE_ISOLATED_MARGIN,
|
||||
}
|
||||
export interface UpdateMarginMode {
|
||||
market_id: string;
|
||||
marketId: string;
|
||||
mode: MarginMode;
|
||||
marginFactor?: string;
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ const CancelOrderDetails = ({
|
||||
const MarginModeDetails = ({ data }: { data: UpdateMarginMode }) => {
|
||||
const t = useT();
|
||||
const { data: markets } = useMarketsMapProvider();
|
||||
const marketId = data.market_id;
|
||||
const { marketId } = data;
|
||||
const market = marketId && markets?.[marketId];
|
||||
if (!market) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user