From c83b5bf93c860d00cec93efa567fe443757ac939 Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Sep 2022 20:37:39 +0200 Subject: [PATCH] chore(#1259): replaced market name with tradable instrument name (#1269) * chore: replaced market name with tradable instrument name (1259) * removed lodash import that must have added itself magically * =aligned cypress tests with code changed * =aligned console lite cypress mocks to the code changes * changed cypress market info key details test * changed cypress market info key details test * generate markets for console lite --- .../src/integration/market-selector.test.ts | 12 +++--- .../src/support/mocks/commons.ts | 2 +- .../src/support/mocks/generate-deal-ticket.ts | 2 +- .../support/mocks/generate-market-names.ts | 10 ++--- .../src/support/mocks/generate-markets.ts | 39 +++++++++++-------- .../deal-ticket/deal-ticket-steps.tsx | 2 +- .../__generated__/SimpleMarkets.ts | 8 ++-- .../simple-market-list/data-provider.ts | 2 +- .../simple-market-renderer.tsx | 4 +- .../src/app/hooks/use-column-definitions.tsx | 2 +- .../markets/__generated__/MarketsQuery.ts | 4 -- .../explorer/src/app/routes/markets/index.tsx | 5 ++- .../src/integration/market-info.cy.ts | 15 ++----- .../src/integration/trading-accounts.cy.ts | 2 +- .../src/integration/trading-collateral.cy.ts | 3 +- .../src/integration/trading-fills.cy.ts | 16 ++++++-- .../src/support/mocks/generate-accounts.ts | 24 ++++++++++-- .../mocks/generate-deal-ticket-query.ts | 4 +- .../src/support/mocks/generate-fills.ts | 14 +++++-- .../mocks/generate-market-info-query.ts | 1 - .../src/support/mocks/generate-market.ts | 3 +- .../src/support/mocks/generate-markets.ts | 8 +--- .../src/support/mocks/generate-orders.ts | 11 +++--- .../src/support/mocks/generate-positions.ts | 3 -- apps/trading-e2e/src/support/trading.ts | 6 ++- .../trading/pages/markets/[marketId].page.tsx | 1 - .../pages/markets/__generated__/Market.ts | 4 -- apps/trading/pages/markets/trade-grid.tsx | 5 ++- .../src/lib/__generated__/AccountFields.ts | 20 +++++++++- .../src/lib/__generated__/AccountSubscribe.ts | 20 +++++++++- .../src/lib/__generated__/Accounts.ts | 20 +++++++++- .../src/lib/accounts-data-provider.ts | 6 ++- libs/accounts/src/lib/accounts-table.spec.tsx | 8 +++- libs/accounts/src/lib/accounts-table.tsx | 2 +- .../src/components/DealTicket.graphql | 1 + .../src/components/MarketInfo.graphql | 1 - .../src/components/MarketNames.graphql | 2 +- .../components/__generated___/DealTicket.ts | 3 +- .../components/__generated___/MarketInfo.ts | 3 +- .../components/__generated___/MarketNames.ts | 4 +- .../__generated__/DealTicketQuery.ts | 8 ++-- .../deal-ticket/__generated__/MarketNames.ts | 8 ++-- .../deal-ticket/deal-ticket-container.tsx | 2 +- .../deal-ticket/market-selector.tsx | 39 +++++++++++++------ .../__generated__/MarketInfoQuery.ts | 4 -- .../market-info/info-market-query.ts | 1 - .../components/market-info/info-market.tsx | 10 +---- .../fills/src/lib/__generated__/FillFields.ts | 8 ++-- libs/fills/src/lib/__generated__/Fills.ts | 8 ++-- libs/fills/src/lib/__generated__/FillsSub.ts | 8 ++-- libs/fills/src/lib/fills-data-provider.ts | 2 +- libs/fills/src/lib/fills-table.spec.tsx | 8 ++-- libs/fills/src/lib/fills-table.tsx | 5 ++- libs/fills/src/lib/test-helpers.ts | 14 +++++-- .../src/lib/__generated__/MarketList.ts | 4 -- .../lib/components/select-market-columns.tsx | 2 +- .../src/lib/markets-data-provider.ts | 1 - .../lib/components/mocks/generate-orders.ts | 8 ++-- .../__generated__/OrderFields.ts | 8 ++-- .../__generated__/OrderSub.ts | 8 ++-- .../__generated__/Orders.ts | 8 ++-- .../order-data-provider.ts | 2 +- .../order-feedback/order-feedback.spec.tsx | 2 +- .../order-feedback/order-feedback.tsx | 2 +- .../order-list/order-edit-dialog.tsx | 2 +- .../order-hooks/__generated__/OrderEvent.ts | 20 +++++++++- .../src/lib/order-hooks/order-event-query.ts | 6 ++- .../src/lib/__generated__/PositionFields.ts | 4 -- .../src/lib/__generated__/Positions.ts | 4 -- .../__generated__/PositionsSubscription.ts | 4 -- .../src/lib/positions-data-providers.spec.ts | 18 +++++++-- .../src/lib/positions-data-providers.ts | 3 +- 72 files changed, 325 insertions(+), 208 deletions(-) diff --git a/apps/console-lite-e2e/src/integration/market-selector.test.ts b/apps/console-lite-e2e/src/integration/market-selector.test.ts index fef2122c8..be2502964 100644 --- a/apps/console-lite-e2e/src/integration/market-selector.test.ts +++ b/apps/console-lite-e2e/src/integration/market-selector.test.ts @@ -39,7 +39,7 @@ describe('market selector', () => { connectVegaWallet(); cy.get('input[placeholder="Search"]').should( 'have.value', - markets[0].name + markets[0].tradableInstrument.instrument.name ); cy.getByTestId('arrow-button').click(); cy.getByTestId('market-pane').should('be.visible'); @@ -47,7 +47,7 @@ describe('market selector', () => { .children() .find('[role="button"]') .first() - .should('contain.text', markets[0].name); + .should('contain.text', markets[0].tradableInstrument.instrument.name); cy.getByTestId('market-pane') .children() .find('[role="button"]') @@ -69,7 +69,9 @@ describe('market selector', () => { cy.get('input[placeholder="Search"]').clear(); cy.get('input[placeholder="Search"]').type('aa'); const filtered = markets.filter( - (market) => market.state === 'STATE_ACTIVE' && market.name.match(/aa/i) + (market) => + market.state === 'STATE_ACTIVE' && + market.tradableInstrument.instrument.name.match(/aa/i) ); cy.getByTestId('market-pane') .children() @@ -86,7 +88,7 @@ describe('market selector', () => { ); cy.get('input[placeholder="Search"]').should( 'have.value', - filtered[filtered.length - 1].name + filtered[filtered.length - 1].tradableInstrument.instrument.name ); } }); @@ -129,7 +131,7 @@ describe('market selector', () => { cy.getByTestId('dialog-close').click(); cy.get('input[placeholder="Search"]').should( 'have.value', - markets[0].name + markets[0].tradableInstrument.instrument.name ); } }); diff --git a/apps/console-lite-e2e/src/support/mocks/commons.ts b/apps/console-lite-e2e/src/support/mocks/commons.ts index e0f67fb75..a80b9e4fe 100644 --- a/apps/console-lite-e2e/src/support/mocks/commons.ts +++ b/apps/console-lite-e2e/src/support/mocks/commons.ts @@ -75,11 +75,11 @@ const protoCandles = [ export const protoMarket = { id: 'first-btcusd-id', - name: 'AAVEDAI Monthly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:2839D9B2329C9E70', diff --git a/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts b/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts index e74c726e8..a99bd4603 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts @@ -2,13 +2,13 @@ export const generateDealTicket = () => { return { market: { id: 'first-btcusd-id', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, state: 'STATE_ACTIVE', tradingMode: 'Continuous', tradableInstrument: { instrument: { + name: 'AAVEDAI Monthly (30 Jun 2022)', product: { quoteName: 'DAI', settlementAsset: { diff --git a/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts b/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts index 9fd098070..07ad3bf48 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts @@ -6,11 +6,11 @@ export const generateMarketNames = () => { { ...protoMarket }, { id: '1d7ddf67dac4924db03f5bf58571a7bcb1908d70c66580467717aabc5345b68a', - name: 'Apple Monthly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'AAPL.MF21', + name: 'Apple Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:4899E01009F1A721', @@ -32,11 +32,11 @@ export const generateMarketNames = () => { }, { id: '87ae87cd3244fc1fab4b0e2dad2437879864192bb969f3109b69293421644c8b', - name: 'Tesla Quarterly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:5A86B190C384997F', @@ -58,11 +58,11 @@ export const generateMarketNames = () => { }, { id: '69205712a854f1bbfb69fa3d11b60e01a1e249bafb5ece88115e7451e8ef07b3', - name: 'BTCUSD Monthly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -83,11 +83,11 @@ export const generateMarketNames = () => { }, { id: 'ethbtc-quaterly', - name: 'ETHBTC Quarterly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'ETHBTC.QM21', + name: 'ETHBTC Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:1F0BB6EB5703B099', @@ -108,11 +108,11 @@ export const generateMarketNames = () => { }, { id: '3c62b2714c4332d1a689a5352bff090e6aabccfd6bd87ce018936b38372530c9', - name: 'UNIDAI Monthly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:3C58ED2A4A6C5D7E', diff --git a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts index 114af877a..18a3cdc42 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts @@ -6,11 +6,11 @@ export const generateSimpleMarkets = () => { { ...protoMarket }, { id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a', - name: 'CELUSD (June 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'CELUSD', + name: 'CELUSD (June 2022)', metadata: { tags: [ 'base:CEL', @@ -35,11 +35,11 @@ export const generateSimpleMarkets = () => { }, { id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255', - name: 'XMRUSD market', state: 'Suspended', tradableInstrument: { instrument: { code: 'XMRUSD', + name: 'XMRUSD market', metadata: { tags: [ 'base:monero', @@ -64,11 +64,11 @@ export const generateSimpleMarkets = () => { }, { id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f', - name: 'UNIDAI Monthly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:3C58ED2A4A6C5D7E', @@ -167,11 +167,11 @@ export const generateSimpleMarkets = () => { }, { id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4', - name: 'XMRUSD market', state: 'Pending', tradableInstrument: { instrument: { code: 'XMRUSD', + name: 'XMRUSD market', metadata: { tags: [ 'base:monero', @@ -269,11 +269,11 @@ export const generateSimpleMarkets = () => { }, { id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6', - name: 'ApeCoin (18 Jul 2022)', state: 'Closed', tradableInstrument: { instrument: { code: 'APE/USD', + name: 'ApeCoin (18 Jul 2022)', metadata: { tags: [ 'quote:USD', @@ -297,11 +297,11 @@ export const generateSimpleMarkets = () => { }, { id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Settled', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -327,11 +327,11 @@ export const generateSimpleMarkets = () => { }, { id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2', - name: 'Builders Club x ETHcc', state: 'Settled', tradableInstrument: { instrument: { code: 'LTCUSD', + name: 'Builders Club x ETHcc', metadata: { tags: [ 'base:litecoin', @@ -417,11 +417,11 @@ export const generateSimpleMarkets = () => { }, { id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Pending', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -447,11 +447,11 @@ export const generateSimpleMarkets = () => { }, { id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6', - name: 'ETHBTC Quarterly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'ETHBTC.QM21', + name: 'ETHBTC Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:1F0BB6EB5703B099', @@ -550,11 +550,11 @@ export const generateSimpleMarkets = () => { }, { id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850', - name: 'Apple Monthly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'AAPL.MF21', + name: 'Apple Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:4899E01009F1A721', @@ -654,11 +654,11 @@ export const generateSimpleMarkets = () => { }, { id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6', - name: 'Tesla Quarterly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:5A86B190C384997F', @@ -758,11 +758,11 @@ export const generateSimpleMarkets = () => { }, { id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a', - name: 'Go big or Go home', state: 'Active', tradableInstrument: { instrument: { code: 'LTCUSD', + name: 'Go big or Go home', metadata: { tags: [ 'base:litecoin', @@ -801,11 +801,11 @@ export const generateSimpleMarkets = () => { }, { id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f', - name: 'BTCUSD Monthly (08 Jul 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (08 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -831,11 +831,11 @@ export const generateSimpleMarkets = () => { }, { id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -866,11 +866,16 @@ export const generateSimpleMarkets = () => { export const generateLongListMarkets = (count: number) => { const markets = []; for (let i = 0; i < count; i++) { - const { id, name } = protoMarket; markets.push({ ...protoMarket, - id: id + i, - name: name + i, + id: protoMarket.id + i, + tradableInstrument: { + ...protoMarket.tradableInstrument, + instrument: { + ...protoMarket.tradableInstrument.instrument, + name: protoMarket.tradableInstrument.instrument.name + i, + }, + }, }); } return { markets }; diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx index adeafd80b..18b6f7c97 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx @@ -179,7 +179,7 @@ export const DealTicketSteps = ({ ItemRenderer={MarketNameRenderer} /> ), - value: market.name, + value: market.tradableInstrument.instrument.name, }, { label: t('Select Direction'), diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts index ac8761d5a..97dc42767 100644 --- a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts +++ b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts @@ -43,6 +43,10 @@ export interface SimpleMarkets_markets_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * Metadata for this instrument */ @@ -79,10 +83,6 @@ export interface SimpleMarkets_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current state of the market */ diff --git a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts index 2032149a1..5be5b70fe 100644 --- a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts +++ b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts @@ -14,11 +14,11 @@ export const MARKETS_QUERY = gql` query SimpleMarkets($CandleSince: String!) { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx index 0b68f24ea..9283f2972 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx @@ -17,7 +17,9 @@ const MarketNameRenderer = ({ market, isMobile }: Props) => { )} />
- {isMobile ? market.tradableInstrument.instrument.code : market.name}{' '} + {isMobile + ? market.tradableInstrument.instrument.code + : market.tradableInstrument.instrument.name}{' '} diff --git a/apps/console-lite/src/app/hooks/use-column-definitions.tsx b/apps/console-lite/src/app/hooks/use-column-definitions.tsx index 647b0e427..f5bbf8fcf 100644 --- a/apps/console-lite/src/app/hooks/use-column-definitions.tsx +++ b/apps/console-lite/src/app/hooks/use-column-definitions.tsx @@ -22,7 +22,7 @@ const useColumnDefinitions = ({ isMobile }: Props) => { headerName: t('Markets'), headerClass: 'uppercase', minWidth: isMobile ? 160 : 350, - field: 'name', + field: 'tradableInstrument.instrument.name', cellClass: 'overflow-visible', cellRenderer: ({ data }: { data: SimpleMarketsType }) => ( diff --git a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts index 8d6afc124..9896efed9 100644 --- a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts +++ b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts @@ -465,10 +465,6 @@ export interface MarketsQuery_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Fees related data */ diff --git a/apps/explorer/src/app/routes/markets/index.tsx b/apps/explorer/src/app/routes/markets/index.tsx index 5f8fe8f4d..22b7ad466 100644 --- a/apps/explorer/src/app/routes/markets/index.tsx +++ b/apps/explorer/src/app/routes/markets/index.tsx @@ -11,7 +11,6 @@ const MARKETS_QUERY = gql` query MarketsQuery { markets { id - name fees { factors { makerFee @@ -154,7 +153,9 @@ const Markets = () => { {data?.markets ? data.markets.map((m) => ( - {m.name} + + {m.tradableInstrument.instrument.name} + )) diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index c02477b1f..0cc3bda16 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -1,8 +1,4 @@ -import { - MarketState, - MarketStateMapping, - MarketTradingModeMapping, -} from '@vegaprotocol/types'; +import { MarketState, MarketTradingModeMapping } from '@vegaprotocol/types'; import { mockTradingPage } from '../support/trading'; const marketInfoBtn = 'Info'; @@ -52,16 +48,13 @@ describe('market info is displayed', () => { it('key details displayed', () => { cy.getByTestId(marketTitle).contains('Key details').click(); - validateMarketDataRow(0, 'Name', 'ETHBTC Quarterly (30 Jun 2022)'); - validateMarketDataRow(1, 'Decimal Places', '2'); - validateMarketDataRow(2, 'Position Decimal Places', '0'); + validateMarketDataRow(0, 'Name', 'BTCUSD Monthly (30 Jun 2022)'); + validateMarketDataRow(1, 'Market ID', 'market-0'); validateMarketDataRow( - 3, + 2, 'Trading Mode', MarketTradingModeMapping.TRADING_MODE_CONTINUOUS ); - validateMarketDataRow(4, 'State', MarketStateMapping.STATE_ACTIVE); - validateMarketDataRow(5, 'Market ID', 'market-0'); }); it('instrument displayed', () => { diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index 13a525745..727410080 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -33,7 +33,7 @@ describe('accounts', () => { cy.getByTestId('tab-accounts') .should('be.visible') .get(tradingAccountRowId) - .find('[col-id="market.name"]') + .find('[col-id="market.tradableInstrument.instrument.name"]') .should('have.text', '—'); cy.getByTestId('tab-accounts') diff --git a/apps/trading-e2e/src/integration/trading-collateral.cy.ts b/apps/trading-e2e/src/integration/trading-collateral.cy.ts index 229046660..292b3db8f 100644 --- a/apps/trading-e2e/src/integration/trading-collateral.cy.ts +++ b/apps/trading-e2e/src/integration/trading-collateral.cy.ts @@ -13,7 +13,8 @@ describe('collateral', () => { const collateralTab = 'Collateral'; const assetSymbolColumn = "[col-id='asset.symbol']"; const assetTypeColumn = "[col-id='type']"; - const assetMarketName = "[col-id='market.name']"; + const assetMarketName = + "[col-id='market.tradableInstrument.instrument.name']"; it('renders collateral', () => { connectVegaWallet(); cy.getByTestId(collateralTab).click(); diff --git a/apps/trading-e2e/src/integration/trading-fills.cy.ts b/apps/trading-e2e/src/integration/trading-fills.cy.ts index 9c78895e6..4467621c3 100644 --- a/apps/trading-e2e/src/integration/trading-fills.cy.ts +++ b/apps/trading-e2e/src/integration/trading-fills.cy.ts @@ -22,7 +22,11 @@ const fills = [ infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -37,7 +41,11 @@ const fills = [ id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: Cypress.env('VEGA_PUBLIC_KEY'), @@ -90,7 +98,9 @@ describe('fills', () => { cy.getByTestId('tab-fills').should('be.visible'); cy.getByTestId('tab-fills') - .get('[role="gridcell"][col-id="market.name"]') + .get( + '[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]' + ) .each(($marketSymbol) => { cy.wrap($marketSymbol).invoke('text').should('not.be.empty'); }); diff --git a/apps/trading-e2e/src/support/mocks/generate-accounts.ts b/apps/trading-e2e/src/support/mocks/generate-accounts.ts index 4639708a1..91b40d0cd 100644 --- a/apps/trading-e2e/src/support/mocks/generate-accounts.ts +++ b/apps/trading-e2e/src/support/mocks/generate-accounts.ts @@ -29,7 +29,13 @@ export const generateAccounts = ( balance: '100000000', market: { id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13', - name: 'AAVEDAI Monthly (30 Jun 2022)', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'AAVEDAI Monthly (30 Jun 2022)', + }, + }, __typename: 'Market', }, asset: { @@ -45,7 +51,13 @@ export const generateAccounts = ( balance: '1000', market: { __typename: 'Market', - name: '', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: '', + }, + }, id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', }, asset: { @@ -61,7 +73,13 @@ export const generateAccounts = ( balance: '1000', market: { __typename: 'Market', - name: '', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: '', + }, + }, id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', }, asset: { diff --git a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts index 55c162232..faa6ff55e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts @@ -10,7 +10,6 @@ export const generateDealTicketQuery = ( market: { __typename: 'Market', id: 'market-0', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, state: MarketState.STATE_ACTIVE, @@ -18,8 +17,9 @@ export const generateDealTicketQuery = ( tradableInstrument: { __typename: 'TradableInstrument', instrument: { - id: 'tBTC TEST', __typename: 'Instrument', + id: 'tBTC TEST', + name: 'ETHBTC Quarterly (30 Jun 2022)', product: { __typename: 'Future', quoteName: 'BTC', diff --git a/apps/trading-e2e/src/support/mocks/generate-fills.ts b/apps/trading-e2e/src/support/mocks/generate-fills.ts index 987e50653..192982fbc 100644 --- a/apps/trading-e2e/src/support/mocks/generate-fills.ts +++ b/apps/trading-e2e/src/support/mocks/generate-fills.ts @@ -23,7 +23,11 @@ export const generateFills = (override?: PartialDeep): Fills => { infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -38,7 +42,11 @@ export const generateFills = (override?: PartialDeep): Fills => { id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: Cypress.env('VEGA_PUBLIC_KEY'), @@ -108,7 +116,6 @@ export const generateFill = ( market: { __typename: 'Market', id: 'market-id', - name: 'UNIDAI Monthly (30 Jun 2022)', positionDecimalPlaces: 0, decimalPlaces: 5, tradableInstrument: { @@ -117,6 +124,7 @@ export const generateFill = ( __typename: 'Instrument', id: 'instrument-id', code: 'instrument-code', + name: 'UNIDAI Monthly (30 Jun 2022)', product: { __typename: 'Future', settlementAsset: { diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index 709075397..f11f8867e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -15,7 +15,6 @@ export const generateMarketInfoQuery = ( market: { __typename: 'Market', id: 'market-0', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 2, positionDecimalPlaces: 0, state: MarketState.STATE_ACTIVE, diff --git a/apps/trading-e2e/src/support/mocks/generate-market.ts b/apps/trading-e2e/src/support/mocks/generate-market.ts index 322bd3be4..06fb8abda 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market.ts @@ -12,7 +12,6 @@ export const generateMarket = (override?: PartialDeep): Market => { const defaultResult: Market = { market: { id: 'market-0', - name: 'ACTIVE MARKET', tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, state: MarketState.STATE_ACTIVE, decimalPlaces: 5, @@ -39,7 +38,7 @@ export const generateMarket = (override?: PartialDeep): Market => { tradableInstrument: { instrument: { id: 'BTCUSD.MF21', - name: 'BTCUSD Monthly', + name: 'ACTIVE MARKET', code: 'BTCUSD.MF21', metadata: { tags: [ diff --git a/apps/trading-e2e/src/support/mocks/generate-markets.ts b/apps/trading-e2e/src/support/mocks/generate-markets.ts index 4aa54b5fe..c4724aa7a 100644 --- a/apps/trading-e2e/src/support/mocks/generate-markets.ts +++ b/apps/trading-e2e/src/support/mocks/generate-markets.ts @@ -13,7 +13,6 @@ export const generateMarkets = ( const markets: MarketList_markets[] = [ { id: 'market-0', - name: 'ACTIVE MARKET', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -59,7 +58,7 @@ export const generateMarkets = ( instrument: { id: '', code: 'BTCUSD.MF21', - name: '', + name: 'ACTIVE MARKET', metadata: { __typename: 'InstrumentMetadata', tags: [], @@ -79,7 +78,6 @@ export const generateMarkets = ( }, { id: 'market-1', - name: 'SUSPENDED MARKET', decimalPlaces: 2, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -124,7 +122,7 @@ export const generateMarkets = ( tradableInstrument: { instrument: { id: 'SOLUSD', - name: 'SOL/USD', + name: 'SUSPENDED MARKET', code: 'SOLUSD', metadata: { __typename: 'InstrumentMetadata', @@ -145,7 +143,6 @@ export const generateMarkets = ( }, { id: 'market-2', - name: 'Apple Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, @@ -211,7 +208,6 @@ export const generateMarkets = ( }, { id: 'market-3', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, diff --git a/apps/trading-e2e/src/support/mocks/generate-orders.ts b/apps/trading-e2e/src/support/mocks/generate-orders.ts index b466ffb3e..ca65d3061 100644 --- a/apps/trading-e2e/src/support/mocks/generate-orders.ts +++ b/apps/trading-e2e/src/support/mocks/generate-orders.ts @@ -19,7 +19,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -28,6 +27,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', }, }, }, @@ -49,7 +49,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -58,6 +57,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', }, }, }, @@ -79,7 +79,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'c6f4337b31ed57a961969c3ba10297b369d01b9e75a4cbb96db4fc62886444e6', - name: 'BTCUSD Monthly (30 Jun 2022)', + decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -88,6 +88,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', }, }, }, @@ -109,7 +110,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'a316fa51dab97d76a1472c2f22906f4e461728e04355096788165d5b13999ed5', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -118,6 +118,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', }, }, }, @@ -139,7 +140,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'a316fa51dab97d76a1472c2f22906f4e461728e04355096788165d5b13999ed5', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -148,6 +148,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', }, }, }, diff --git a/apps/trading-e2e/src/support/mocks/generate-positions.ts b/apps/trading-e2e/src/support/mocks/generate-positions.ts index 5eca42b3f..cbe5665a0 100644 --- a/apps/trading-e2e/src/support/mocks/generate-positions.ts +++ b/apps/trading-e2e/src/support/mocks/generate-positions.ts @@ -42,7 +42,6 @@ export const generatePositions = ( }, market: { id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'UNIDAI Monthly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '17588787', @@ -96,7 +95,6 @@ export const generatePositions = ( }, market: { id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13', - name: 'AAVEDAI Monthly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '8649338', @@ -149,7 +147,6 @@ export const generatePositions = ( }, market: { id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '84377569', diff --git a/apps/trading-e2e/src/support/trading.ts b/apps/trading-e2e/src/support/trading.ts index 43f90041f..0b11bfeb1 100644 --- a/apps/trading-e2e/src/support/trading.ts +++ b/apps/trading-e2e/src/support/trading.ts @@ -22,7 +22,11 @@ export const mockTradingPage = ( 'Market', generateMarket({ market: { - name: `${state.toUpperCase()} MARKET`, + tradableInstrument: { + instrument: { + name: `${state.toUpperCase()} MARKET`, + }, + }, state: state, }, }) diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 50b36ef2a..2ec8f1d35 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -16,7 +16,6 @@ const MARKET_QUERY = gql` query Market($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name tradingMode state decimalPlaces diff --git a/apps/trading/pages/markets/__generated__/Market.ts b/apps/trading/pages/markets/__generated__/Market.ts index eb66c911f..ff2b98e79 100644 --- a/apps/trading/pages/markets/__generated__/Market.ts +++ b/apps/trading/pages/markets/__generated__/Market.ts @@ -187,10 +187,6 @@ export interface Market_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current mode of execution of the market */ diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index 60a5d88f6..ccd0df1fd 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -141,7 +141,10 @@ export const TradeMarketHeader = ({ market }: TradeMarketHeaderProps) => {
- +
( /> ; -export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; +export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; export const DealTicketQueryDocument = gql` @@ -23,6 +23,7 @@ export const DealTicketQueryDocument = gql` tradableInstrument { instrument { id + name product { ... on Future { quoteName diff --git a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts index 54dd4244d..db4847f58 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts @@ -10,14 +10,13 @@ export type MarketInfoQueryQueryVariables = Types.Exact<{ }>; -export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; +export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; export const MarketInfoQueryDocument = gql` query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/deal-ticket/src/components/__generated___/MarketNames.ts b/libs/deal-ticket/src/components/__generated___/MarketNames.ts index 2e9f19474..edd97bfea 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketNames.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketNames.ts @@ -6,18 +6,18 @@ const defaultOptions = {} as const; export type MarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null }; +export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null }; export const MarketNamesDocument = gql` query MarketNames { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts index 283cdaa4d..a1a6bf1d9 100644 --- a/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts +++ b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts @@ -43,6 +43,10 @@ export interface DealTicketQuery_market_tradableInstrument_instrument { * Uniquely identify an instrument across all instruments available on Vega (string) */ id: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) */ @@ -79,10 +83,6 @@ export interface DealTicketQuery_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts index 2247947f9..c91ec7e1f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts +++ b/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts @@ -31,6 +31,10 @@ export interface MarketNames_markets_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * Metadata for this instrument */ @@ -55,10 +59,6 @@ export interface MarketNames_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current state of the market */ diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx index 085481e7f..62682822f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx @@ -8,7 +8,6 @@ const DEAL_TICKET_QUERY = gql` query DealTicketQuery($marketId: ID!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state @@ -16,6 +15,7 @@ const DEAL_TICKET_QUERY = gql` tradableInstrument { instrument { id + name product { ... on Future { quoteName diff --git a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx index eef06a9d2..86aa8ecdc 100644 --- a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx @@ -33,11 +33,11 @@ export const MARKET_NAMES_QUERY = gql` query MarketNames { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } @@ -70,7 +70,9 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { const [skip, setSkip] = useState(true); const [results, setResults] = useState([]); const [showPane, setShowPane] = useState(false); - const [lookup, setLookup] = useState(market.name || ''); + const [lookup, setLookup] = useState( + market.tradableInstrument.instrument.name || '' + ); const [dialogContent, setDialogContent] = useState( null ); @@ -102,10 +104,13 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { ); const handleMarketSelect = useCallback( - ({ id, name }: { id: string; name: string }) => { - setLookup(name); + (market: { + id: string; + tradableInstrument: { instrument: { name: string } }; + }) => { + setLookup(market.tradableInstrument.instrument.name); setShowPane(false); - setMarket(id); + setMarket(market.id); inputRef.current?.focus(); }, [setLookup, setShowPane, setMarket, inputRef] @@ -142,7 +147,7 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { break; default: setShowPane(false); - setLookup(market.name); + setLookup(market.tradableInstrument.instrument.name); } }, [results, handleMarketSelect] @@ -159,7 +164,7 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { const handleOnBlur = useCallback(() => { if (!lookup && !showPane) { - setLookup(market.name); + setLookup(market.tradableInstrument.instrument.name); } }, [market, lookup, showPane, setLookup]); @@ -173,11 +178,17 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { (isOpen: boolean) => { setShowPane(isOpen); if (!isOpen) { - setLookup(lookup || market.name); + setLookup(lookup || market.tradableInstrument.instrument.name); inputRef.current?.focus(); } }, - [setShowPane, lookup, setLookup, market.name, inputRef] + [ + setShowPane, + lookup, + setLookup, + market.tradableInstrument.instrument.name, + inputRef, + ] ); const selectorContent = useMemo(() => { @@ -235,7 +246,11 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { onClick={() => handleMarketSelect(market)} onKeyDown={(e) => handleItemKeyDown(e, market, i)} > - {ItemRenderer ? : market.name} + {ItemRenderer ? ( + + ) : ( + market.tradableInstrument.instrument.name + )}
))}
@@ -262,7 +277,9 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { data?.markets?.filter( (item: MarketNames_markets) => item.state === MarketState.STATE_ACTIVE && - item.name.match(new RegExp(escapeRegExp(lookup), 'i')) + item.tradableInstrument.instrument.name.match( + new RegExp(escapeRegExp(lookup), 'i') + ) ) || [] ); }, [data, lookup]); diff --git a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts index 529fc790d..b564c331d 100644 --- a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts +++ b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts @@ -459,10 +459,6 @@ export interface MarketInfoQuery_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/deal-ticket/src/components/market-info/info-market-query.ts b/libs/deal-ticket/src/components/market-info/info-market-query.ts index 35f9d63d0..98afe6ef9 100644 --- a/libs/deal-ticket/src/components/market-info/info-market-query.ts +++ b/libs/deal-ticket/src/components/market-info/info-market-query.ts @@ -4,7 +4,6 @@ export const MARKET_INFO_QUERY = gql` query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/deal-ticket/src/components/market-info/info-market.tsx b/libs/deal-ticket/src/components/market-info/info-market.tsx index 89e65f22d..89e6711ae 100644 --- a/libs/deal-ticket/src/components/market-info/info-market.tsx +++ b/libs/deal-ticket/src/components/market-info/info-market.tsx @@ -155,13 +155,7 @@ export const Info = ({ market }: InfoProps) => { ]; const { VEGA_EXPLORER_URL } = useEnvironment(); const keyDetails = { - ...pick( - market, - 'name', - 'decimalPlaces', - 'positionDecimalPlaces', - 'tradingMode' - ), + ...pick(market, 'decimalPlaces', 'positionDecimalPlaces', 'tradingMode'), state: MarketStateMapping[market.state], }; const marketSpecPanels = [ @@ -170,7 +164,7 @@ export const Info = ({ market }: InfoProps) => { content: ( { price: '100', size: '300000', market: { - name: 'test market', decimalPlaces: 2, positionDecimalPlaces: 5, tradableInstrument: { instrument: { + name: 'test market', product: { settlementAsset: { decimals: 2, @@ -87,7 +87,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '+3.00000', '1.00 BTC', '3.00 BTC', @@ -124,7 +124,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '+3.00000', '1.00 BTC', '3.00 BTC', @@ -161,7 +161,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '-3.00000', '1.00 BTC', '3.00 BTC', diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 966d95c4f..70ada7875 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -44,7 +44,10 @@ export const FillsTable = forwardRef( getRowId={({ data }) => data?.id} {...props} > - + ): Fills => { infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -38,7 +42,11 @@ export const generateFills = (override?: PartialDeep): Fills => { id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: 'party-id', @@ -108,7 +116,6 @@ export const generateFill = ( market: { __typename: 'Market', id: 'market-id', - name: 'UNIDAI Monthly (30 Jun 2022)', positionDecimalPlaces: 0, decimalPlaces: 5, tradableInstrument: { @@ -117,6 +124,7 @@ export const generateFill = ( __typename: 'Instrument', id: 'instrument-id', code: 'instrument-code', + name: 'UNIDAI Monthly (30 Jun 2022)', product: { __typename: 'Future', settlementAsset: { diff --git a/libs/market-list/src/lib/__generated__/MarketList.ts b/libs/market-list/src/lib/__generated__/MarketList.ts index 5f56d3975..f147b3498 100644 --- a/libs/market-list/src/lib/__generated__/MarketList.ts +++ b/libs/market-list/src/lib/__generated__/MarketList.ts @@ -171,10 +171,6 @@ export interface MarketList_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/market-list/src/lib/components/select-market-columns.tsx b/libs/market-list/src/lib/components/select-market-columns.tsx index 7ae6cbf51..955a7bce6 100644 --- a/libs/market-list/src/lib/components/select-market-columns.tsx +++ b/libs/market-list/src/lib/components/select-market-columns.tsx @@ -315,7 +315,7 @@ export const columns = ( dataTestId: 'taker-fee', }, { - value: market.name, + value: market.tradableInstrument.instrument.name, className: `${cellClassNames} hidden xxl:block`, onlyOnDetailed: true, dataTestId: 'market-name', diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 4eff74ada..049521253 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -46,7 +46,6 @@ export const MARKET_LIST_QUERY = gql` query MarketList($interval: Interval!, $since: String!) { markets { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/orders/src/lib/components/mocks/generate-orders.ts b/libs/orders/src/lib/components/mocks/generate-orders.ts index 732cf4c00..e29e2614f 100644 --- a/libs/orders/src/lib/components/mocks/generate-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-orders.ts @@ -17,7 +17,6 @@ export const generateOrder = ( market: { __typename: 'Market', id: 'market-id', - name: 'market-name', decimalPlaces: 2, positionDecimalPlaces: 2, tradableInstrument: { @@ -26,6 +25,7 @@ export const generateOrder = ( id: 'instrument-id', __typename: 'Instrument', code: 'instrument-code', + name: 'instrument-market-name', }, }, }, @@ -67,7 +67,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -75,6 +74,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', }, }, }, @@ -92,7 +92,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -100,6 +99,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', }, }, }, @@ -117,7 +117,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: 'c6f4337b31ed57a961969c3ba10297b369d01b9e75a4cbb96db4fc62886444e6', - name: 'BTCUSD Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -125,6 +124,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', }, }, }, diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts index 664b1cc48..ebfd1865a 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts @@ -19,6 +19,10 @@ export interface OrderFields_market_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface OrderFields_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface OrderFields_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts index 421f926b2..d1d3128ea 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts @@ -19,6 +19,10 @@ export interface OrderSub_orders_market_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface OrderSub_orders_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface OrderSub_orders_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts index 78f1f1084..e1cde6308 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts @@ -19,6 +19,10 @@ export interface Orders_party_ordersConnection_edges_node_market_tradableInstrum * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface Orders_party_ordersConnection_edges_node_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts index fe4fbaebe..d9bd169b2 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts @@ -19,13 +19,13 @@ const ORDER_FRAGMENT = gql` id market { id - name decimalPlaces positionDecimalPlaces tradableInstrument { instrument { id code + name } } } diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx index 0cfaeb302..75fa521e9 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx @@ -74,7 +74,7 @@ describe('OrderFeedback', () => { ); expect(screen.getByText('Market').nextElementSibling).toHaveTextContent( // eslint-disable-next-line - order.market!.name + order.market!.tradableInstrument.instrument.name ); expect(screen.getByText('Status').nextElementSibling).toHaveTextContent( OrderStatusMapping[order.status] diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index 484f1e7aa..fc80c6b4d 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -29,7 +29,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => { {order.market && (

{t(`Market`)}

-

{t(`${order.market.name}`)}

+

{t(`${order.market.tradableInstrument.instrument.name}`)}

)}
diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index 4d397d6c1..70f07e3e2 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -53,7 +53,7 @@ export const OrderEditDialog = ({ {order.market && (

{t(`Market`)}

-

{t(`${order.market.name}`)}

+

{t(`${order.market.tradableInstrument.instrument.name}`)}

)} {order.type === OrderType.TYPE_LIMIT && order.market && ( diff --git a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts index df959703d..5226464bf 100644 --- a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts +++ b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts @@ -13,6 +13,22 @@ export interface OrderEvent_busEvents_event_TimeUpdate { __typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Trade" | "Account" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "Withdrawal" | "OracleSpec" | "LiquidityProvision"; } +export interface OrderEvent_busEvents_event_Order_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; +} + +export interface OrderEvent_busEvents_event_Order_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of, or reference to, a fully specified instrument. + */ + instrument: OrderEvent_busEvents_event_Order_market_tradableInstrument_instrument; +} + export interface OrderEvent_busEvents_event_Order_market { __typename: "Market"; /** @@ -20,9 +36,9 @@ export interface OrderEvent_busEvents_event_Order_market { */ id: string; /** - * Market full name + * An instance of, or reference to, a tradable instrument. */ - name: string; + tradableInstrument: OrderEvent_busEvents_event_Order_market_tradableInstrument; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/orders/src/lib/order-hooks/order-event-query.ts b/libs/orders/src/lib/order-hooks/order-event-query.ts index 33059f125..32b38193e 100644 --- a/libs/orders/src/lib/order-hooks/order-event-query.ts +++ b/libs/orders/src/lib/order-hooks/order-event-query.ts @@ -18,7 +18,11 @@ export const ORDER_EVENT_SUB = gql` side market { id - name + tradableInstrument { + instrument { + name + } + } decimalPlaces positionDecimalPlaces } diff --git a/libs/positions/src/lib/__generated__/PositionFields.ts b/libs/positions/src/lib/__generated__/PositionFields.ts index a5f25b523..7575fb799 100644 --- a/libs/positions/src/lib/__generated__/PositionFields.ts +++ b/libs/positions/src/lib/__generated__/PositionFields.ts @@ -109,10 +109,6 @@ export interface PositionFields_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/positions/src/lib/__generated__/Positions.ts b/libs/positions/src/lib/__generated__/Positions.ts index 69cc82a81..7dbb01dbf 100644 --- a/libs/positions/src/lib/__generated__/Positions.ts +++ b/libs/positions/src/lib/__generated__/Positions.ts @@ -109,10 +109,6 @@ export interface Positions_party_positionsConnection_edges_node_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/positions/src/lib/__generated__/PositionsSubscription.ts b/libs/positions/src/lib/__generated__/PositionsSubscription.ts index 93a61b32b..9fbfe6a9d 100644 --- a/libs/positions/src/lib/__generated__/PositionsSubscription.ts +++ b/libs/positions/src/lib/__generated__/PositionsSubscription.ts @@ -109,10 +109,6 @@ export interface PositionsSubscription_positions_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the market. (uint64) diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index b4b2b9d5d..67efe22d3 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -32,8 +32,14 @@ const accounts: Accounts = { balance: '33353727', market: { __typename: 'Market', - name: 'AAVEDAI Monthly (30 Jun 2022)', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'AAVEDAI Monthly (30 Jun 2022)', + }, + }, }, }, { @@ -48,8 +54,14 @@ const accounts: Accounts = { balance: '3274050', market: { __typename: 'Market', - name: 'UNIDAI Monthly (30 Jun 2022)', id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'UNIDAI Monthly (30 Jun 2022)', + }, + }, }, }, ], @@ -97,7 +109,6 @@ const data: Positions = { }, market: { __typename: 'Market', - name: 'AAVEDAI Monthly (30 Jun 2022)', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', decimalPlaces: 5, tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, @@ -155,7 +166,6 @@ const data: Positions = { market: { __typename: 'Market', id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, positionDecimalPlaces: 0, diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index bfaec808e..513423482 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -72,7 +72,6 @@ const POSITION_FIELDS = gql` } market { id - name decimalPlaces positionDecimalPlaces tradingMode @@ -202,7 +201,7 @@ export const getMetrics = ( ) && generalAccountBalance.isLessThan(marginInitial.minus(marginSearch)); metrics.push({ - marketName: market.name, + marketName: market.tradableInstrument.instrument.name, averageEntryPrice: position.node.averageEntryPrice, capitalUtilisation: Math.round(capitalUtilisation.toNumber()), currentLeverage: currentLeverage.toNumber(),