feat(trading): Changes to market info for mark price, funding, and settlement (#5967)
This commit is contained in:
parent
b89523efb2
commit
3e2e3c3970
@ -199,6 +199,9 @@ describe('Closed', () => {
|
||||
|
||||
it('renders correctly formatted and filtered rows', async () => {
|
||||
await renderComponent([marketsMock, marketsDataMock, oracleDataMock]);
|
||||
await waitFor(() => {
|
||||
expect(screen.getAllByRole('gridcell').length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
const assetSymbol = getAsset(market).symbol;
|
||||
|
||||
|
@ -37,16 +37,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)
|
||||
|
||||
|
||||
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%"],
|
||||
@ -58,7 +61,8 @@ def test_market_info_current_fees(page: Page):
|
||||
|
||||
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"],
|
||||
@ -67,7 +71,8 @@ def test_market_info_market_price(page: Page):
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
#TODO: remove skip once volume is fixed
|
||||
|
||||
# TODO: remove skip once volume is fixed
|
||||
""" 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()
|
||||
@ -97,14 +102,16 @@ def test_market_info_liquidation_strategy(page: Page):
|
||||
|
||||
def test_market_info_liquidation(page: Page):
|
||||
# 6002-MDET-104
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Liquidations").click()
|
||||
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)
|
||||
|
||||
|
||||
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 = [
|
||||
@ -131,26 +138,24 @@ def test_market_info_instrument(page: Page):
|
||||
validate_info_section(page, fields)
|
||||
|
||||
|
||||
# @pytest.mark.skip("oracle test to be fixed")
|
||||
|
||||
|
||||
def test_market_info_oracle(page: Page):
|
||||
# 6002-MDET-203
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Oracle").click()
|
||||
expect(
|
||||
page.locator('[data-state="open"]').get_by_test_id("accordion-content")
|
||||
).to_contain_text("No oracle proof for settlement data")
|
||||
expect(page.get_by_test_id("oracle-spec-links")).to_have_text(
|
||||
"View settlement data specification"
|
||||
)
|
||||
# expect(page.get_by_test_id("oracle-spec-links")).to_have_attribute(
|
||||
# "href", re.compile(rf'(\/oracles\/{vega.find_market_id("BTC:DAI_2023")})')
|
||||
# )
|
||||
def test_market_info_mark_price(page: Page):
|
||||
page.get_by_test_id(market_title_test_id).get_by_text("Mark Price").click()
|
||||
fields = [
|
||||
["Composite Price Type", "Last Trade"],
|
||||
["Staleness tolerance", "-"],
|
||||
["Decay weight", "0"],
|
||||
["Decay power", "0"],
|
||||
["Staleness tolerance", "-"],
|
||||
["Cash amount", "0.00 tDAI"],
|
||||
["Staleness tolerance", "-"],
|
||||
]
|
||||
validate_info_section(page, fields)
|
||||
|
||||
|
||||
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 = [
|
||||
@ -204,7 +209,8 @@ def test_market_info_margin_scaling_factors(page: Page):
|
||||
|
||||
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"],
|
||||
@ -224,7 +230,8 @@ 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"],
|
||||
@ -274,14 +281,17 @@ 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")
|
||||
|
||||
@ -292,10 +302,12 @@ def test_market_info_proposal(page: Page, vega: VegaServiceNull):
|
||||
|
||||
|
||||
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})")
|
||||
)
|
||||
|
@ -10,10 +10,15 @@
|
||||
"All fees are paid by price takers and are a % of the trade notional value. Fees are not paid during auction uncrossing.": "All fees are paid by price takers and are a % of the trade notional value. Fees are not paid during auction uncrossing.",
|
||||
"Auction extension duration in seconds, should the price breach its theoretical level over the specified horizon at the specified probability level.": "Auction extension duration in seconds, should the price breach its theoretical level over the specified horizon at the specified probability level.",
|
||||
"Block explorer": "Block explorer",
|
||||
"Book price": "Book price",
|
||||
"Cash amount": "Cash amount",
|
||||
"Composite Price Type": "Composite Price Type",
|
||||
"Conditions": "Conditions",
|
||||
"Could not load market": "Could not load market",
|
||||
"Current fees": "Current fees",
|
||||
"Data about the sector. Example: 'automotive' for a market based on value of Tesla shares.": "Data about the sector. Example: 'automotive' for a market based on value of Tesla shares.",
|
||||
"Decay power": "Decay power",
|
||||
"Decay weight": "Decay weight",
|
||||
"Details": "Details",
|
||||
"Determines how the probability of trading is scaled from the risk model, and is used to measure the relative competitiveness of an LP's supplied volume. This is a network parameter.": "Determines how the probability of trading is scaled from the risk model, and is used to measure the relative competitiveness of an LP's supplied volume. This is a network parameter.",
|
||||
"Ethereum Oracle": "Ethereum Oracle",
|
||||
@ -27,9 +32,11 @@
|
||||
"How big the smallest order / position on the market can be.": "How big the smallest order / position on the market can be.",
|
||||
"How long an epoch is. LP rewards from liquidity fees are paid out once per epoch. How much they receive depends on whether they met the liquidity SLA and their previous performance in recent epochs. This is a network parameter.": "How long an epoch is. LP rewards from liquidity fees are paid out once per epoch. How much they receive depends on whether they met the liquidity SLA and their previous performance in recent epochs. This is a network parameter.",
|
||||
"How often the quality of liquidity supplied by each liquidity provider is evaluated and the fees arising from that period are earmarked for specific providers. This is a market parameter. ": "How often the quality of liquidity supplied by each liquidity provider is evaluated and the fees arising from that period are earmarked for specific providers. This is a market parameter. ",
|
||||
"Index Price": "Index Price",
|
||||
"Instrument": "Instrument",
|
||||
"Insurance pool": "Insurance pool",
|
||||
"Insurance Pool Balance": "Insurance Pool Balance",
|
||||
"Internal composite price": "Internal composite price",
|
||||
"Internal conditions": "Internal conditions",
|
||||
"Invalid data source": "Invalid data source",
|
||||
"involvedInMarkets_one": "Involved in {{count}} market",
|
||||
@ -37,6 +44,7 @@
|
||||
"involvedInMarkets": "Involved in {{count}} markets",
|
||||
"Key": "Key",
|
||||
"Key details": "Key details",
|
||||
"Last Trade": "Last Trade",
|
||||
"Liquidity": "Liquidity",
|
||||
"Liquidations": "Liquidations",
|
||||
"Liquidity monitoring parameters": "Liquidity monitoring parameters",
|
||||
@ -46,6 +54,7 @@
|
||||
"Lower bound for the funding-rate such that the funding-rate will never be lower than this value.": "Lower bound for the funding-rate such that the funding-rate will never be lower than this value.",
|
||||
"Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).": "Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).",
|
||||
"Margin scaling factors": "Margin scaling factors",
|
||||
"Mark price": "Mark price",
|
||||
"Market": "Market",
|
||||
"Market data": "Market data",
|
||||
"Market governance": "Market governance",
|
||||
@ -56,6 +65,8 @@
|
||||
"Maximum fraction of an LP's accrued fees that an LP would lose to liquidity providers that achieved a higher SLA performance than them. This is a market parameter.": "Maximum fraction of an LP's accrued fees that an LP would lose to liquidity providers that achieved a higher SLA performance than them. This is a market parameter.",
|
||||
"Maximum value that a proposed fee amount can be, which is submitted as part of the LP commitment transaction. Note that a value of 0.05 = 5%. This is a network parameter.": "Maximum value that a proposed fee amount can be, which is submitted as part of the LP commitment transaction. Note that a value of 0.05 = 5%. This is a network parameter.",
|
||||
"Metadata": "Metadata",
|
||||
"Median": "Median",
|
||||
"Median price": "Median price",
|
||||
"moreProofs_one": "And {{count}} more proof",
|
||||
"moreProofs_other": "And {{count}} more proofs",
|
||||
"moreProofs": "And {{count}} more proofs",
|
||||
@ -69,12 +80,14 @@
|
||||
"Number of epochs over which past performance will continue to affect rewards. This is a market parameter.": "Number of epochs over which past performance will continue to affect rewards. This is a market parameter.",
|
||||
"Oracle": "Oracle",
|
||||
"Oracle repository": "Oracle repository",
|
||||
"Oracle specification": "Oracle specification",
|
||||
"Oracle status for this market is <0>{{status}}</0>. {{description}} <1>Show more</1>": "Oracle status for this market is <0>{{status}}</0>. {{description}} <1>Show more</1>",
|
||||
"Oracle status: {{status}}. {{description}}": "Oracle status: {{status}}. {{description}}",
|
||||
"oracleInMarkets_one": "Oracle in {{count}} market",
|
||||
"oracleInMarkets_other": "Oracle in {{count}} markets",
|
||||
"oracleInMarkets": "Oracle in {{count}} markets",
|
||||
"Price monitoring bounds {{index}}": "Price monitoring bounds {{index}}",
|
||||
"Price oracle {{index}}": "Price oracle {{index}}",
|
||||
"Probability level for price projection, e.g. value of 0.95 will result in a price range such that over the specified projection horizon, the prices observed in the market should be in that range 95% of the time.": "Probability level for price projection, e.g. value of 0.95 will result in a price range such that over the specified projection horizon, the prices observed in the market should be in that range 95% of the time.",
|
||||
"Probability level used in <0>Expected Shortfall</0> calculation when obtaining Risk Factor Long and Risk Factor Short": "Probability level used in <0>Expected Shortfall</0> calculation when obtaining Risk Factor Long and Risk Factor Short",
|
||||
"Projection horizon measured as a year fraction used in <0>Expected Shortfall</0> calculation when obtaining Risk Factor Long and Risk Factor Short": "Projection horizon measured as a year fraction used in <0>Expected Shortfall</0> calculation when obtaining Risk Factor Long and Risk Factor Short",
|
||||
@ -97,7 +110,10 @@
|
||||
"Specifies the minimum fraction of time LPs must spend 'on the book' providing their committed liquidity. This is a market parameter.": "Specifies the minimum fraction of time LPs must spend 'on the book' providing their committed liquidity. This is a market parameter.",
|
||||
"Status": "Status",
|
||||
"Succession line": "Succession line",
|
||||
"Source Weight": "Source Weight",
|
||||
"Staleness tolerance": "Staleness tolerance",
|
||||
"Termination": "Termination",
|
||||
"Termination & Settlement": "Termination & Settlement",
|
||||
"Termination oracle": "Termination oracle",
|
||||
"The aggregated volume being bid at the best bid price on the market.": "The aggregated volume being bid at the best bid price on the market.",
|
||||
"The aggregated volume being bid at the best static bid price on the market.": "The aggregated volume being bid at the best static bid price on the market.",
|
||||
@ -134,6 +150,7 @@
|
||||
"This public key's proofs have been verified.": "This public key's proofs have been verified.",
|
||||
"This public key's proofs have not been verified yet, or no proofs have been provided yet.": "This public key's proofs have not been verified yet, or no proofs have been provided yet.",
|
||||
"Time horizon of the price projection in seconds.": "Time horizon of the price projection in seconds.",
|
||||
"Trade price": "Trade price",
|
||||
"Updated": "Updated",
|
||||
"Upper bound for the funding-rate such that the funding-rate will never be higher than this value.": "Upper bound for the funding-rate such that the funding-rate will never be higher than this value.",
|
||||
"Used to calculate the penalty to liquidity providers when they cannot support their open position with the assets in their margin and general accounts. This is a network parameter.": "Used to calculate the penalty to liquidity providers when they cannot support their open position with the assets in their margin and general accounts. This is a network parameter.",
|
||||
@ -147,6 +164,8 @@
|
||||
"View on {{chainLabel}}": "View on {{chainLabel}}",
|
||||
"View settlement data specification": "View settlement data specification",
|
||||
"View settlement schedule specification": "View settlement schedule specification",
|
||||
"View specification": "View specification",
|
||||
"View termination specification": "View termination specification",
|
||||
"Within {{horizonSecs}} seconds": "Within {{horizonSecs}} seconds"
|
||||
"Within {{horizonSecs}} seconds": "Within {{horizonSecs}} seconds",
|
||||
"Weighted": "Weighted"
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
8
libs/markets/src/lib/__generated__/markets.ts
generated
8
libs/markets/src/lib/__generated__/markets.ts
generated
File diff suppressed because one or more lines are too long
@ -10,82 +10,102 @@ fragment DataSourceFilter on Filter {
|
||||
}
|
||||
}
|
||||
|
||||
fragment SourceType on DataSourceKind {
|
||||
... on DataSourceDefinitionExternal {
|
||||
sourceType {
|
||||
... on EthCallSpec {
|
||||
abi
|
||||
address
|
||||
args
|
||||
method
|
||||
requiredConfirmations
|
||||
normalisers {
|
||||
name
|
||||
expression
|
||||
}
|
||||
trigger {
|
||||
trigger {
|
||||
... on EthTimeTrigger {
|
||||
initial
|
||||
every
|
||||
until
|
||||
}
|
||||
}
|
||||
}
|
||||
filters {
|
||||
key {
|
||||
name
|
||||
type
|
||||
numberDecimalPlaces
|
||||
}
|
||||
conditions {
|
||||
value
|
||||
operator
|
||||
}
|
||||
}
|
||||
}
|
||||
... on DataSourceSpecConfiguration {
|
||||
signers {
|
||||
signer {
|
||||
... on PubKey {
|
||||
key
|
||||
}
|
||||
... on ETHAddress {
|
||||
address
|
||||
}
|
||||
}
|
||||
}
|
||||
filters {
|
||||
...DataSourceFilter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
... on DataSourceDefinitionInternal {
|
||||
sourceType {
|
||||
... on DataSourceSpecConfigurationTime {
|
||||
conditions {
|
||||
operator
|
||||
value
|
||||
}
|
||||
}
|
||||
... on DataSourceSpecConfigurationTimeTrigger {
|
||||
__typename
|
||||
triggers {
|
||||
initial
|
||||
every
|
||||
}
|
||||
conditions {
|
||||
operator
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment PriceConfiguration on CompositePriceConfiguration {
|
||||
decayWeight
|
||||
decayPower
|
||||
cashAmount
|
||||
SourceWeights
|
||||
SourceStalenessTolerance
|
||||
CompositePriceType
|
||||
dataSourcesSpec {
|
||||
sourceType {
|
||||
...SourceType
|
||||
}
|
||||
}
|
||||
dataSourcesSpecBinding {
|
||||
priceSourceProperty
|
||||
}
|
||||
}
|
||||
|
||||
fragment DataSource on DataSourceSpec {
|
||||
id
|
||||
data {
|
||||
sourceType {
|
||||
... on DataSourceDefinitionExternal {
|
||||
sourceType {
|
||||
... on EthCallSpec {
|
||||
abi
|
||||
address
|
||||
args
|
||||
method
|
||||
requiredConfirmations
|
||||
normalisers {
|
||||
name
|
||||
expression
|
||||
}
|
||||
trigger {
|
||||
trigger {
|
||||
... on EthTimeTrigger {
|
||||
initial
|
||||
every
|
||||
until
|
||||
}
|
||||
}
|
||||
}
|
||||
filters {
|
||||
key {
|
||||
name
|
||||
type
|
||||
numberDecimalPlaces
|
||||
}
|
||||
conditions {
|
||||
value
|
||||
operator
|
||||
}
|
||||
}
|
||||
sourceChainId
|
||||
}
|
||||
... on DataSourceSpecConfiguration {
|
||||
signers {
|
||||
signer {
|
||||
... on PubKey {
|
||||
key
|
||||
}
|
||||
... on ETHAddress {
|
||||
address
|
||||
}
|
||||
}
|
||||
}
|
||||
filters {
|
||||
...DataSourceFilter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
... on DataSourceDefinitionInternal {
|
||||
sourceType {
|
||||
... on DataSourceSpecConfigurationTime {
|
||||
conditions {
|
||||
operator
|
||||
value
|
||||
}
|
||||
}
|
||||
... on DataSourceSpecConfigurationTimeTrigger {
|
||||
__typename
|
||||
triggers {
|
||||
initial
|
||||
every
|
||||
}
|
||||
conditions {
|
||||
operator
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
...SourceType
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -133,6 +153,9 @@ fragment Perpetual on Perpetual {
|
||||
settlementDataProperty
|
||||
settlementScheduleProperty
|
||||
}
|
||||
internalCompositePriceConfig {
|
||||
...PriceConfiguration
|
||||
}
|
||||
}
|
||||
|
||||
query MarketInfoMainnet($marketId: ID!) {
|
||||
@ -274,11 +297,13 @@ query MarketInfo($marketId: ID!) {
|
||||
linearSlippageFactor
|
||||
parentMarketID
|
||||
successorMarketID
|
||||
proposal {
|
||||
id
|
||||
rationale {
|
||||
title
|
||||
description
|
||||
marketProposal {
|
||||
... on Proposal {
|
||||
id
|
||||
rationale {
|
||||
title
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
marketTimestamps {
|
||||
@ -287,6 +312,9 @@ query MarketInfo($marketId: ID!) {
|
||||
open
|
||||
close
|
||||
}
|
||||
markPriceConfiguration {
|
||||
...PriceConfiguration
|
||||
}
|
||||
openingAuction {
|
||||
durationSecs
|
||||
volume
|
||||
|
File diff suppressed because one or more lines are too long
@ -37,21 +37,18 @@ import {
|
||||
MarketPriceInfoPanel,
|
||||
MarketVolumeInfoPanel,
|
||||
MetadataInfoPanel,
|
||||
OracleInfoPanel,
|
||||
PriceConfigurationPanel,
|
||||
PriceMonitoringBoundsInfoPanel,
|
||||
RiskFactorsInfoPanel,
|
||||
RiskModelInfoPanel,
|
||||
SettlementAssetInfoPanel,
|
||||
SuccessionLineInfoPanel,
|
||||
TerminationAndSettlementPanel,
|
||||
} from './market-info-panels';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import {
|
||||
getDataSourceSpecForSettlementSchedule,
|
||||
getDataSourceSpecForSettlementData,
|
||||
getDataSourceSpecForTradingTermination,
|
||||
isPerpetual,
|
||||
isFuture,
|
||||
getSigners,
|
||||
} from '../../product';
|
||||
import { useT } from '../../use-t';
|
||||
|
||||
@ -104,27 +101,9 @@ export const MarketInfoAccordion = ({
|
||||
);
|
||||
|
||||
const { product } = market.tradableInstrument.instrument;
|
||||
const settlementDataSource = getDataSourceSpecForSettlementData(product);
|
||||
const terminationDataSource = getDataSourceSpecForTradingTermination(product);
|
||||
const settlementScheduleDataSource =
|
||||
getDataSourceSpecForSettlementSchedule(product);
|
||||
|
||||
const showOneOracleSection =
|
||||
(isFuture(product) &&
|
||||
settlementDataSource &&
|
||||
terminationDataSource &&
|
||||
isEqual(
|
||||
getSigners(settlementDataSource),
|
||||
getSigners(terminationDataSource)
|
||||
)) ||
|
||||
(isPerpetual(product) &&
|
||||
settlementDataSource &&
|
||||
settlementScheduleDataSource &&
|
||||
isEqual(
|
||||
getSigners(settlementDataSource),
|
||||
getSigners(settlementScheduleDataSource)
|
||||
));
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="mb-8">
|
||||
@ -176,6 +155,16 @@ export const MarketInfoAccordion = ({
|
||||
title={t('Instrument')}
|
||||
content={<InstrumentInfoPanel market={market} />}
|
||||
/>
|
||||
<AccordionItem
|
||||
itemId="mark-price"
|
||||
title={t('Mark price')}
|
||||
content={
|
||||
<PriceConfigurationPanel
|
||||
market={market}
|
||||
priceConfiguration={market.markPriceConfiguration}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{settlementScheduleDataSource && (
|
||||
<AccordionItem
|
||||
itemId="funding"
|
||||
@ -188,45 +177,24 @@ export const MarketInfoAccordion = ({
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{showOneOracleSection ? (
|
||||
{isPerpetual(product) && product.internalCompositePriceConfig && (
|
||||
<AccordionItem
|
||||
itemId="oracles"
|
||||
title={t('Oracle')}
|
||||
itemId="internal-composite-price"
|
||||
title={t('Internal composite price')}
|
||||
content={
|
||||
<OracleInfoPanel market={market} type="settlementData" />
|
||||
<PriceConfigurationPanel
|
||||
market={market}
|
||||
priceConfiguration={product.internalCompositePriceConfig}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<AccordionItem
|
||||
itemId="settlement-oracle"
|
||||
title={t('Settlement oracle')}
|
||||
content={
|
||||
<OracleInfoPanel market={market} type="settlementData" />
|
||||
}
|
||||
/>
|
||||
{isPerpetual(product) && (
|
||||
<AccordionItem
|
||||
itemId="settlement-schedule-oracle"
|
||||
title={t('Settlement schedule oracle')}
|
||||
content={
|
||||
<OracleInfoPanel
|
||||
market={market}
|
||||
type="settlementSchedule"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{isFuture(product) && (
|
||||
<AccordionItem
|
||||
itemId="termination-oracle"
|
||||
title={t('Termination oracle')}
|
||||
content={
|
||||
<OracleInfoPanel market={market} type="termination" />
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{isFuture(product) && (
|
||||
<AccordionItem
|
||||
itemId="termination-and-settlement"
|
||||
title={t('Termination & Settlement')}
|
||||
content={<TerminationAndSettlementPanel market={market} />}
|
||||
/>
|
||||
)}
|
||||
<AccordionItem
|
||||
itemId="settlement-asset"
|
||||
@ -330,55 +298,61 @@ export const MarketInfoAccordion = ({
|
||||
/>
|
||||
</Accordion>
|
||||
</div>
|
||||
{VEGA_TOKEN_URL && market.proposal?.id && (
|
||||
<div>
|
||||
<h3 className={headerClassName}>{t('Market governance')}</h3>
|
||||
<Accordion>
|
||||
<AccordionItem
|
||||
itemId="proposal"
|
||||
title={t('Proposal')}
|
||||
content={
|
||||
<>
|
||||
<ExternalLink
|
||||
className="mb-2 w-full"
|
||||
href={generatePath(TokenStaticLinks.PROPOSAL_PAGE, {
|
||||
tokenUrl: VEGA_TOKEN_URL,
|
||||
proposalId: market.proposal?.id || '',
|
||||
})}
|
||||
title={
|
||||
market.proposal?.rationale.title ||
|
||||
market.proposal?.rationale.description ||
|
||||
''
|
||||
}
|
||||
>
|
||||
{t('View governance proposal')}
|
||||
</ExternalLink>
|
||||
<ExternalLink
|
||||
className="w-full"
|
||||
href={generatePath(TokenStaticLinks.UPDATE_PROPOSAL_PAGE, {
|
||||
tokenUrl: VEGA_TOKEN_URL,
|
||||
})}
|
||||
title={
|
||||
market.proposal?.rationale.title ||
|
||||
market.proposal?.rationale.description ||
|
||||
''
|
||||
}
|
||||
>
|
||||
{t('Propose a change to market')}
|
||||
</ExternalLink>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
{featureFlags.SUCCESSOR_MARKETS && (
|
||||
{VEGA_TOKEN_URL &&
|
||||
market.marketProposal?.__typename === 'Proposal' &&
|
||||
market.marketProposal.id && (
|
||||
<div>
|
||||
<h3 className={headerClassName}>{t('Market governance')}</h3>
|
||||
|
||||
<Accordion>
|
||||
<AccordionItem
|
||||
itemId="succession-line"
|
||||
title={t('Succession line')}
|
||||
content={<SuccessionLineInfoPanel market={market} />}
|
||||
itemId="proposal"
|
||||
title={t('Proposal')}
|
||||
content={
|
||||
<>
|
||||
<ExternalLink
|
||||
className="mb-2 w-full"
|
||||
href={generatePath(TokenStaticLinks.PROPOSAL_PAGE, {
|
||||
tokenUrl: VEGA_TOKEN_URL,
|
||||
proposalId: market.marketProposal.id,
|
||||
})}
|
||||
title={
|
||||
market.marketProposal.rationale.title ||
|
||||
market.marketProposal.rationale.description ||
|
||||
''
|
||||
}
|
||||
>
|
||||
{t('View governance proposal')}
|
||||
</ExternalLink>
|
||||
<ExternalLink
|
||||
className="w-full"
|
||||
href={generatePath(
|
||||
TokenStaticLinks.UPDATE_PROPOSAL_PAGE,
|
||||
{
|
||||
tokenUrl: VEGA_TOKEN_URL,
|
||||
}
|
||||
)}
|
||||
title={
|
||||
market.marketProposal.rationale.title ||
|
||||
market.marketProposal.rationale.description ||
|
||||
''
|
||||
}
|
||||
>
|
||||
{t('Propose a change to market')}
|
||||
</ExternalLink>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Accordion>
|
||||
</div>
|
||||
)}
|
||||
{featureFlags.SUCCESSOR_MARKETS && (
|
||||
<AccordionItem
|
||||
itemId="succession-line"
|
||||
title={t('Succession line')}
|
||||
content={<SuccessionLineInfoPanel market={market} />}
|
||||
/>
|
||||
)}
|
||||
</Accordion>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -44,6 +44,7 @@ import type {
|
||||
SignerKind,
|
||||
} from '@vegaprotocol/types';
|
||||
import {
|
||||
CompositePriceType,
|
||||
ConditionOperatorMapping,
|
||||
LiquidityFeeMethodMapping,
|
||||
LiquidityFeeMethodMappingDescription,
|
||||
@ -79,7 +80,10 @@ import {
|
||||
NetworkParams,
|
||||
useNetworkParams,
|
||||
} from '@vegaprotocol/network-parameters';
|
||||
import type { DataSourceFragment } from './__generated__/MarketInfo';
|
||||
import type {
|
||||
DataSourceFragment,
|
||||
PriceConfigurationFragment,
|
||||
} from './__generated__/MarketInfo';
|
||||
import { formatDuration } from 'date-fns';
|
||||
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
||||
import { useT } from '../../use-t';
|
||||
@ -244,13 +248,22 @@ export const KeyDetailsInfoPanel = ({
|
||||
},
|
||||
skip: !featureFlags.SUCCESSOR_MARKETS,
|
||||
});
|
||||
const proposalId =
|
||||
(market.marketProposal?.__typename === 'Proposal' &&
|
||||
market.marketProposal.id) ||
|
||||
'';
|
||||
|
||||
const { data: successorProposalDetails } =
|
||||
useSuccessorMarketProposalDetailsQuery({
|
||||
variables: {
|
||||
proposalId: market.proposal?.id || '',
|
||||
proposalId,
|
||||
},
|
||||
skip: !featureFlags.SUCCESSOR_MARKETS || !market.proposal?.id,
|
||||
skip:
|
||||
!featureFlags.SUCCESSOR_MARKETS ||
|
||||
!(
|
||||
market.marketProposal?.__typename === 'Proposal' &&
|
||||
market.marketProposal?.id
|
||||
),
|
||||
});
|
||||
|
||||
let successorConfiguration: SuccessorConfiguration | false = false;
|
||||
@ -288,9 +301,9 @@ export const KeyDetailsInfoPanel = ({
|
||||
const { data: parentSuccessorProposalDetails } =
|
||||
useSuccessorMarketProposalDetailsQuery({
|
||||
variables: {
|
||||
proposalId: parentMarket?.proposal?.id || '',
|
||||
proposalId,
|
||||
},
|
||||
skip: !parentMarket?.proposal?.id,
|
||||
skip: !proposalId,
|
||||
});
|
||||
|
||||
let parentSuccessorConfig: SuccessorConfiguration | undefined = undefined;
|
||||
@ -1207,6 +1220,9 @@ export const FundingInfoPanel = ({
|
||||
minutes,
|
||||
});
|
||||
const { product } = market.tradableInstrument.instrument;
|
||||
const indexPrice = (
|
||||
<DataSourceLinks {...getDataSourceSpec(product, 'settlementData')} />
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<p
|
||||
@ -1228,6 +1244,85 @@ export const FundingInfoPanel = ({
|
||||
rateUpperBound: isPerpetual(product) && product.fundingRateUpperBound,
|
||||
}}
|
||||
/>
|
||||
{indexPrice && (
|
||||
<>
|
||||
<div className="my-1">{t('Index Price')}</div>
|
||||
{indexPrice}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const DataSourceLinks = ({
|
||||
dataSourceSpec,
|
||||
dataSourceSpecId,
|
||||
}: ReturnType<typeof getDataSourceSpec>) => {
|
||||
const t = useT();
|
||||
const { VEGA_EXPLORER_URL } = useEnvironment();
|
||||
const address = dataSourceSpec &&
|
||||
dataSourceSpec.sourceType.__typename === 'DataSourceDefinitionExternal' &&
|
||||
dataSourceSpec.sourceType.sourceType?.__typename === 'EthCallSpec' && (
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Address')}</div>
|
||||
<CopyWithTooltip text={dataSourceSpec.sourceType.sourceType.address}>
|
||||
<button
|
||||
data-testid="copy-eth-oracle-address"
|
||||
className="text-right uppercase"
|
||||
>
|
||||
<span className="flex gap-1">
|
||||
{truncateMiddle(dataSourceSpec.sourceType.sourceType.address)}
|
||||
<VegaIcon name={VegaIconNames.COPY} size={16} />
|
||||
</span>
|
||||
</button>
|
||||
</CopyWithTooltip>
|
||||
</KeyValueTableRow>
|
||||
);
|
||||
const explorerLink = dataSourceSpecId && (
|
||||
<ExternalLink
|
||||
data-testid="oracle-spec-links"
|
||||
href={`${VEGA_EXPLORER_URL}/oracles/${dataSourceSpecId}`}
|
||||
className="text-xs my-1"
|
||||
>
|
||||
{t('View specification')}
|
||||
</ExternalLink>
|
||||
);
|
||||
return address || explorerLink ? (
|
||||
<KeyValueTable>
|
||||
{address}
|
||||
{explorerLink}
|
||||
</KeyValueTable>
|
||||
) : null;
|
||||
};
|
||||
|
||||
export const TerminationAndSettlementPanel = ({
|
||||
market,
|
||||
}: {
|
||||
market: MarketInfo;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const { product } = market.tradableInstrument.instrument;
|
||||
const settlement = (
|
||||
<DataSourceLinks {...getDataSourceSpec(product, 'settlementData')} />
|
||||
);
|
||||
const termination = (
|
||||
<DataSourceLinks {...getDataSourceSpec(product, 'termination')} />
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{settlement && (
|
||||
<>
|
||||
<div className="my-1">{t('Settlement')}</div>
|
||||
{settlement}
|
||||
</>
|
||||
)}
|
||||
{termination && (
|
||||
<>
|
||||
<div className="my-1">{t('Termination')}</div>
|
||||
{termination}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@ -1548,3 +1643,252 @@ const OracleProfile = (props: {
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const getSourceWeight = (
|
||||
priceConfiguration: PriceConfigurationFragment,
|
||||
index: number
|
||||
) =>
|
||||
priceConfiguration.CompositePriceType ===
|
||||
CompositePriceType.COMPOSITE_PRICE_TYPE_WEIGHTED &&
|
||||
priceConfiguration.SourceWeights
|
||||
? Number(priceConfiguration.SourceWeights[index]) * 100
|
||||
: undefined;
|
||||
|
||||
const getStalenessTolerance = (
|
||||
priceConfiguration: PriceConfigurationFragment,
|
||||
index: number
|
||||
) => {
|
||||
return (priceConfiguration.SourceStalenessTolerance[index] || '-').replace(
|
||||
/0s$/,
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
const SourceWeight = ({ sourceWeight }: { sourceWeight?: number }) => {
|
||||
const t = useT();
|
||||
return (
|
||||
sourceWeight && (
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Source Weight')}</div>
|
||||
<div>{sourceWeight.toFixed(2)}%</div>
|
||||
</KeyValueTableRow>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
const StalenessTolerance = ({
|
||||
priceConfiguration,
|
||||
index,
|
||||
}: {
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
index: number;
|
||||
}) => {
|
||||
const t = useT();
|
||||
return (
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Staleness tolerance')}</div>
|
||||
<div>{getStalenessTolerance(priceConfiguration, index)}</div>
|
||||
</KeyValueTableRow>
|
||||
);
|
||||
};
|
||||
|
||||
export const PriceConfigurationTradePricePanel = ({
|
||||
market,
|
||||
priceConfiguration,
|
||||
}: {
|
||||
market: MarketInfo;
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const sourceWeight = getSourceWeight(priceConfiguration, 0);
|
||||
return (
|
||||
sourceWeight !== 0 && (
|
||||
<>
|
||||
<div className="my-1">{t('Trade price')}</div>
|
||||
<KeyValueTable>
|
||||
<SourceWeight sourceWeight={sourceWeight} />
|
||||
<StalenessTolerance
|
||||
priceConfiguration={priceConfiguration}
|
||||
index={0}
|
||||
/>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Decay weight')}</div>
|
||||
<div>{market.markPriceConfiguration.decayWeight}</div>
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Decay power')}</div>
|
||||
<div>{market.markPriceConfiguration.decayPower}</div>
|
||||
</KeyValueTableRow>
|
||||
</KeyValueTable>
|
||||
</>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export const PriceConfigurationBookPricePanel = ({
|
||||
market,
|
||||
priceConfiguration,
|
||||
}: {
|
||||
market: MarketInfo;
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const asset = getAsset(market);
|
||||
const sourceWeight = getSourceWeight(priceConfiguration, 1);
|
||||
return (
|
||||
sourceWeight !== 0 && (
|
||||
<>
|
||||
<div className="my-1">{t('Book price')}</div>
|
||||
<KeyValueTable>
|
||||
<SourceWeight sourceWeight={sourceWeight} />
|
||||
<StalenessTolerance
|
||||
priceConfiguration={priceConfiguration}
|
||||
index={1}
|
||||
/>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Cash amount')}</div>
|
||||
<div>{`${addDecimalsFormatNumber(
|
||||
priceConfiguration.cashAmount,
|
||||
asset.decimals
|
||||
)} ${asset.symbol}`}</div>
|
||||
</KeyValueTableRow>
|
||||
</KeyValueTable>
|
||||
</>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export const PriceConfigurationOraclePanel = ({
|
||||
marketId,
|
||||
priceConfiguration,
|
||||
sourceIndex,
|
||||
}: {
|
||||
marketId: string;
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
sourceIndex: number;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const dataSourceSpec = priceConfiguration.dataSourcesSpec?.[sourceIndex];
|
||||
const sourceType =
|
||||
dataSourceSpec?.sourceType.__typename === 'DataSourceDefinitionExternal' &&
|
||||
dataSourceSpec?.sourceType.sourceType.__typename === 'EthCallSpec' &&
|
||||
dataSourceSpec?.sourceType.sourceType;
|
||||
const sourceWeight = getSourceWeight(priceConfiguration, sourceIndex + 2);
|
||||
const { VEGA_EXPLORER_URL } = useEnvironment();
|
||||
return (
|
||||
sourceType &&
|
||||
sourceWeight !== 0 && (
|
||||
<>
|
||||
<div className="my-1">
|
||||
{t('Price oracle {{index}}', {
|
||||
index:
|
||||
(priceConfiguration.dataSourcesSpec?.length ?? 0) > 1
|
||||
? sourceIndex + 1
|
||||
: '',
|
||||
})}
|
||||
</div>
|
||||
<KeyValueTable>
|
||||
<SourceWeight sourceWeight={sourceWeight} />
|
||||
<StalenessTolerance
|
||||
priceConfiguration={priceConfiguration}
|
||||
index={sourceIndex + 2}
|
||||
/>
|
||||
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Address')}</div>
|
||||
<CopyWithTooltip text={sourceType.address}>
|
||||
<button
|
||||
data-testid="copy-eth-oracle-address"
|
||||
className="text-right uppercase"
|
||||
>
|
||||
<span className="flex gap-1">
|
||||
{truncateMiddle(sourceType.address)}
|
||||
<VegaIcon name={VegaIconNames.COPY} size={16} />
|
||||
</span>
|
||||
</button>
|
||||
</CopyWithTooltip>
|
||||
</KeyValueTableRow>
|
||||
<ExternalLink
|
||||
data-testid="oracle-spec-links"
|
||||
href={`${VEGA_EXPLORER_URL}/market/${marketId}/oracles#${sourceType.address}`}
|
||||
className="text-xs my-1"
|
||||
>
|
||||
{t('Oracle specification')}
|
||||
</ExternalLink>
|
||||
</KeyValueTable>
|
||||
</KeyValueTable>
|
||||
</>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export const PriceConfigurationMedianPanel = ({
|
||||
priceConfiguration,
|
||||
}: {
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const sourceWeight = getSourceWeight(
|
||||
priceConfiguration,
|
||||
(priceConfiguration.SourceWeights?.length ?? 0) - 1
|
||||
);
|
||||
return (
|
||||
sourceWeight !== 0 && (
|
||||
<>
|
||||
<div className="my-1">{t('Median price')}</div>
|
||||
<KeyValueTable>
|
||||
<SourceWeight sourceWeight={sourceWeight} />
|
||||
<StalenessTolerance
|
||||
priceConfiguration={priceConfiguration}
|
||||
index={priceConfiguration.SourceStalenessTolerance.length - 1}
|
||||
/>
|
||||
</KeyValueTable>
|
||||
</>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export const PriceConfigurationPanel = ({
|
||||
market,
|
||||
priceConfiguration,
|
||||
}: {
|
||||
market: MarketInfo;
|
||||
priceConfiguration: PriceConfigurationFragment;
|
||||
}) => {
|
||||
const t = useT();
|
||||
const typeLabel: {
|
||||
[key in CompositePriceType]: string;
|
||||
} = {
|
||||
[CompositePriceType.COMPOSITE_PRICE_TYPE_WEIGHTED]: t('Weighted'),
|
||||
[CompositePriceType.COMPOSITE_PRICE_TYPE_MEDIAN]: t('Median'),
|
||||
[CompositePriceType.COMPOSITE_PRICE_TYPE_LAST_TRADE]: t('Last Trade'),
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow noBorder className="text-xs">
|
||||
<div>{t('Composite Price Type')}</div>
|
||||
<div>{typeLabel[priceConfiguration.CompositePriceType]}</div>
|
||||
</KeyValueTableRow>
|
||||
</KeyValueTable>
|
||||
<PriceConfigurationTradePricePanel
|
||||
market={market}
|
||||
priceConfiguration={priceConfiguration}
|
||||
/>
|
||||
<PriceConfigurationBookPricePanel
|
||||
market={market}
|
||||
priceConfiguration={priceConfiguration}
|
||||
/>
|
||||
{priceConfiguration.dataSourcesSpec?.map((spec, i) => (
|
||||
<PriceConfigurationOraclePanel
|
||||
key={i}
|
||||
marketId={market.id}
|
||||
priceConfiguration={priceConfiguration}
|
||||
sourceIndex={i}
|
||||
/>
|
||||
))}
|
||||
<PriceConfigurationMedianPanel priceConfiguration={priceConfiguration} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ export const marketInfoQuery = (
|
||||
state: Schema.MarketState.STATE_ACTIVE,
|
||||
tradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||
tickSize: '1',
|
||||
proposal: {
|
||||
marketProposal: {
|
||||
__typename: 'Proposal',
|
||||
id: 'market-0',
|
||||
rationale: {
|
||||
@ -24,6 +24,17 @@ export const marketInfoQuery = (
|
||||
description: '',
|
||||
},
|
||||
},
|
||||
markPriceConfiguration: {
|
||||
decayWeight: '',
|
||||
decayPower: 0,
|
||||
cashAmount: '',
|
||||
SourceWeights: null,
|
||||
SourceStalenessTolerance: [],
|
||||
CompositePriceType:
|
||||
Schema.CompositePriceType.COMPOSITE_PRICE_TYPE_MEDIAN,
|
||||
dataSourcesSpec: null,
|
||||
dataSourcesSpecBinding: null,
|
||||
},
|
||||
linearSlippageFactor: '0.01',
|
||||
marketTimestamps: {
|
||||
__typename: 'MarketTimestamps',
|
||||
|
@ -25,6 +25,7 @@ export const getMatchingOracleProvider = (
|
||||
|
||||
if (
|
||||
dataSourceSpec.sourceType.__typename === 'DataSourceDefinitionExternal' &&
|
||||
dataSourceSpec.sourceType.sourceType &&
|
||||
'signers' in dataSourceSpec.sourceType.sourceType
|
||||
) {
|
||||
return dataSourceSpec.sourceType.sourceType.signers?.some(
|
||||
|
@ -50,7 +50,6 @@ export const marketsProvider = makeDataProvider<
|
||||
? MarketsMainnetDocument
|
||||
: MarketsDocument,
|
||||
getData,
|
||||
fetchPolicy: 'cache-first',
|
||||
errorPolicy: 'all',
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import merge from 'lodash/merge';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type {
|
||||
@ -31,7 +32,7 @@ export const marketsQuery = (
|
||||
export const createMarketFragment = (
|
||||
override?: PartialDeep<MarketFieldsFragment>
|
||||
): MarketFieldsFragment => {
|
||||
const defaultFragment = {
|
||||
const defaultFragment: MarketFieldsFragment = {
|
||||
id: 'market-0',
|
||||
decimalPlaces: 5,
|
||||
positionDecimalPlaces: 0,
|
||||
@ -82,7 +83,7 @@ export const createMarketFragment = (
|
||||
},
|
||||
dataSourceSpecForTradingTermination: {
|
||||
__typename: 'DataSourceSpec',
|
||||
id: 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f',
|
||||
id: '871f467e06f91029df8fba3edc0a0aad0259445f2bb144cb79a4113fe5be95bf',
|
||||
data: {
|
||||
__typename: 'DataSourceDefinition',
|
||||
sourceType: {
|
||||
@ -149,12 +150,12 @@ export const createMarketFragment = (
|
||||
},
|
||||
},
|
||||
dataSourceSpecBinding: {
|
||||
__typename: 'DataSourceSpecBinding',
|
||||
__typename: 'DataSourceSpecToFutureBinding',
|
||||
tradingTerminationProperty: 'trading-termination-property',
|
||||
settlementDataProperty: 'settlement-data-property',
|
||||
},
|
||||
quoteName: 'DAI',
|
||||
} as const,
|
||||
},
|
||||
__typename: 'Instrument',
|
||||
},
|
||||
__typename: 'TradableInstrument',
|
||||
@ -162,7 +163,7 @@ export const createMarketFragment = (
|
||||
__typename: 'Market',
|
||||
};
|
||||
|
||||
return merge(defaultFragment, override);
|
||||
return merge(cloneDeep(defaultFragment), override);
|
||||
};
|
||||
|
||||
const marketFieldsFragments: MarketFieldsFragment[] = [
|
||||
|
Loading…
Reference in New Issue
Block a user