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
This commit is contained in:
Art 2022-09-07 20:37:39 +02:00 committed by GitHub
parent 9f6376c1b2
commit c83b5bf93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 325 additions and 208 deletions

View File

@ -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
);
}
});

View File

@ -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',

View File

@ -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: {

View File

@ -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',

View File

@ -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 };

View File

@ -179,7 +179,7 @@ export const DealTicketSteps = ({
ItemRenderer={MarketNameRenderer}
/>
),
value: market.name,
value: market.tradableInstrument.instrument.name,
},
{
label: t('Select Direction'),

View File

@ -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
*/

View File

@ -14,11 +14,11 @@ export const MARKETS_QUERY = gql`
query SimpleMarkets($CandleSince: String!) {
markets {
id
name
state
tradableInstrument {
instrument {
code
name
metadata {
tags
}

View File

@ -17,7 +17,9 @@ const MarketNameRenderer = ({ market, isMobile }: Props) => {
)}
/>
<div className="col-span-2 uppercase justify-start text-black dark:text-white text-ui-small md:text-market self-end">
{isMobile ? market.tradableInstrument.instrument.code : market.name}{' '}
{isMobile
? market.tradableInstrument.instrument.code
: market.tradableInstrument.instrument.name}{' '}
<SimpleMarketExpires
tags={market.tradableInstrument.instrument.metadata.tags}
/>

View File

@ -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 }) => (
<MarketNameRenderer market={data} isMobile={isMobile} />

View File

@ -465,10 +465,6 @@ export interface MarketsQuery_markets {
* Market ID
*/
id: string;
/**
* Market full name
*/
name: string;
/**
* Fees related data
*/

View File

@ -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) => (
<React.Fragment key={m.id}>
<SubHeading data-testid="markets-header">{m.name}</SubHeading>
<SubHeading data-testid="markets-header">
{m.tradableInstrument.instrument.name}
</SubHeading>
<SyntaxHighlighter data={m} />
</React.Fragment>
))

View File

@ -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', () => {

View File

@ -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')

View File

@ -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();

View File

@ -22,7 +22,11 @@ const fills = [
infrastructureFee: '5000',
},
market: {
tradableInstrument: {
instrument: {
name: 'Apples Daily v3',
},
},
positionDecimalPlaces: 2,
},
}),
@ -37,8 +41,12 @@ const fills = [
id: '3',
aggressor: Side.SIDE_SELL,
market: {
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');
});

View File

@ -29,7 +29,13 @@ export const generateAccounts = (
balance: '100000000',
market: {
id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13',
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',
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
__typename: 'Instrument',
name: '',
},
},
id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376',
},
asset: {
@ -61,7 +73,13 @@ export const generateAccounts = (
balance: '1000',
market: {
__typename: 'Market',
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
__typename: 'Instrument',
name: '',
},
},
id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d',
},
asset: {

View File

@ -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',

View File

@ -23,7 +23,11 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
infrastructureFee: '5000',
},
market: {
tradableInstrument: {
instrument: {
name: 'Apples Daily v3',
},
},
positionDecimalPlaces: 2,
},
}),
@ -38,8 +42,12 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
id: '3',
aggressor: Side.SIDE_SELL,
market: {
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: {

View File

@ -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,

View File

@ -12,7 +12,6 @@ export const generateMarket = (override?: PartialDeep<Market>): 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>): Market => {
tradableInstrument: {
instrument: {
id: 'BTCUSD.MF21',
name: 'BTCUSD Monthly',
name: 'ACTIVE MARKET',
code: 'BTCUSD.MF21',
metadata: {
tags: [

View File

@ -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,

View File

@ -19,7 +19,6 @@ export const generateOrders = (override?: PartialDeep<Orders>): 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>): Orders => {
id: '',
__typename: 'Instrument',
code: 'AAVEDAI.MF21',
name: 'AAVEDAI Monthly (30 Jun 2022)',
},
},
},
@ -49,7 +49,6 @@ export const generateOrders = (override?: PartialDeep<Orders>): 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>): Orders => {
id: '',
__typename: 'Instrument',
code: 'TSLA.QM21',
name: 'Tesla Quarterly (30 Jun 2022)',
},
},
},
@ -79,7 +79,7 @@ export const generateOrders = (override?: PartialDeep<Orders>): 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>): Orders => {
id: '',
__typename: 'Instrument',
code: 'BTCUSD.MF21',
name: 'BTCUSD Monthly (30 Jun 2022)',
},
},
},
@ -109,7 +110,6 @@ export const generateOrders = (override?: PartialDeep<Orders>): 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>): Orders => {
id: '',
__typename: 'Instrument',
code: 'UNIDAI.MF21',
name: 'UNIDAI Monthly (30 Jun 2022)',
},
},
},
@ -139,7 +140,6 @@ export const generateOrders = (override?: PartialDeep<Orders>): 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>): Orders => {
id: '',
__typename: 'Instrument',
code: 'UNIDAI.MF21',
name: 'UNIDAI Monthly (30 Jun 2022)',
},
},
},

View File

@ -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',

View File

@ -22,7 +22,11 @@ export const mockTradingPage = (
'Market',
generateMarket({
market: {
tradableInstrument: {
instrument: {
name: `${state.toUpperCase()} MARKET`,
},
},
state: state,
},
})

View File

@ -16,7 +16,6 @@ const MARKET_QUERY = gql`
query Market($marketId: ID!, $interval: Interval!, $since: String!) {
market(id: $marketId) {
id
name
tradingMode
state
decimalPlaces

View File

@ -187,10 +187,6 @@ export interface Market_market {
* Market ID
*/
id: string;
/**
* Market full name
*/
name: string;
/**
* Current mode of execution of the market
*/

View File

@ -141,7 +141,10 @@ export const TradeMarketHeader = ({ market }: TradeMarketHeaderProps) => {
<header className="w-screen xl:px-4 pt-4 border-b border-neutral-300 dark:border-neutral-700">
<div className="xl:flex xl:gap-4 items-start">
<div className="px-4 mb-2 xl:mb-0">
<SelectMarketPopover marketName={market.name} onSelect={onSelect} />
<SelectMarketPopover
marketName={market.tradableInstrument.instrument.name}
onSelect={onSelect}
/>
</div>
<div
data-testid="market-summary"

View File

@ -9,6 +9,22 @@ import { AccountType } from "@vegaprotocol/types";
// GraphQL fragment: AccountFields
// ====================================================
export interface AccountFields_market_tradableInstrument_instrument {
__typename: "Instrument";
/**
* Full and fairly descriptive name for the instrument
*/
name: string;
}
export interface AccountFields_market_tradableInstrument {
__typename: "TradableInstrument";
/**
* An instance of, or reference to, a fully specified instrument.
*/
instrument: AccountFields_market_tradableInstrument_instrument;
}
export interface AccountFields_market {
__typename: "Market";
/**
@ -16,9 +32,9 @@ export interface AccountFields_market {
*/
id: string;
/**
* Market full name
* An instance of, or reference to, a tradable instrument.
*/
name: string;
tradableInstrument: AccountFields_market_tradableInstrument;
}
export interface AccountFields_asset {

View File

@ -9,6 +9,22 @@ import { AccountType } from "@vegaprotocol/types";
// GraphQL subscription operation: AccountSubscribe
// ====================================================
export interface AccountSubscribe_accounts_market_tradableInstrument_instrument {
__typename: "Instrument";
/**
* Full and fairly descriptive name for the instrument
*/
name: string;
}
export interface AccountSubscribe_accounts_market_tradableInstrument {
__typename: "TradableInstrument";
/**
* An instance of, or reference to, a fully specified instrument.
*/
instrument: AccountSubscribe_accounts_market_tradableInstrument_instrument;
}
export interface AccountSubscribe_accounts_market {
__typename: "Market";
/**
@ -16,9 +32,9 @@ export interface AccountSubscribe_accounts_market {
*/
id: string;
/**
* Market full name
* An instance of, or reference to, a tradable instrument.
*/
name: string;
tradableInstrument: AccountSubscribe_accounts_market_tradableInstrument;
}
export interface AccountSubscribe_accounts_asset {

View File

@ -9,6 +9,22 @@ import { AccountType } from "@vegaprotocol/types";
// GraphQL query operation: Accounts
// ====================================================
export interface Accounts_party_accounts_market_tradableInstrument_instrument {
__typename: "Instrument";
/**
* Full and fairly descriptive name for the instrument
*/
name: string;
}
export interface Accounts_party_accounts_market_tradableInstrument {
__typename: "TradableInstrument";
/**
* An instance of, or reference to, a fully specified instrument.
*/
instrument: Accounts_party_accounts_market_tradableInstrument_instrument;
}
export interface Accounts_party_accounts_market {
__typename: "Market";
/**
@ -16,9 +32,9 @@ export interface Accounts_party_accounts_market {
*/
id: string;
/**
* Market full name
* An instance of, or reference to, a tradable instrument.
*/
name: string;
tradableInstrument: Accounts_party_accounts_market_tradableInstrument;
}
export interface Accounts_party_accounts_asset {

View File

@ -17,8 +17,12 @@ const ACCOUNTS_FRAGMENT = gql`
balance
market {
id
tradableInstrument {
instrument {
name
}
}
}
asset {
id
symbol

View File

@ -9,7 +9,13 @@ const singleRow: Accounts_party_accounts = {
balance: '125600000',
market: {
__typename: 'Market',
tradableInstrument: {
__typename: 'TradableInstrument',
instrument: {
__typename: 'Instrument',
name: 'BTCUSD Monthly (30 Jun 2022)',
},
},
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
},
asset: {

View File

@ -151,7 +151,7 @@ export const AccountsTable = forwardRef<AgGridReact, AccountsTableProps>(
/>
<AgGridColumn
headerName={t('Market')}
field="market.name"
field="market.tradableInstrument.instrument.name"
valueFormatter="value || '—'"
/>
<AgGridColumn

View File

@ -9,6 +9,7 @@ query DealTicketQuery($marketId: ID!) {
tradableInstrument {
instrument {
id
name
product {
... on Future {
quoteName

View File

@ -1,7 +1,6 @@
query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) {
market(id: $marketId) {
id
name
decimalPlaces
positionDecimalPlaces
state

View File

@ -1,11 +1,11 @@
query MarketNames {
markets {
id
name
state
tradableInstrument {
instrument {
code
name
metadata {
tags
}

View File

@ -8,7 +8,7 @@ export type DealTicketQueryQueryVariables = Types.Exact<{
}>;
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

View File

@ -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<string> | 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<string> | 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

View File

@ -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<string> | 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<string> | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null };
export const MarketNamesDocument = gql`
query MarketNames {
markets {
id
name
state
tradableInstrument {
instrument {
code
name
metadata {
tags
}

View File

@ -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)

View File

@ -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
*/

View File

@ -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

View File

@ -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<MarketNames_markets[]>([]);
const [showPane, setShowPane] = useState(false);
const [lookup, setLookup] = useState(market.name || '');
const [lookup, setLookup] = useState(
market.tradableInstrument.instrument.name || ''
);
const [dialogContent, setDialogContent] = useState<React.ReactNode | null>(
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 ? <ItemRenderer market={market} /> : market.name}
{ItemRenderer ? (
<ItemRenderer market={market} />
) : (
market.tradableInstrument.instrument.name
)}
</div>
))}
</div>
@ -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]);

View File

@ -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)

View File

@ -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

View File

@ -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: (
<MarketInfoTable
data={{
...keyDetails,
name: market.tradableInstrument.instrument.name,
marketID: market.id,
tradingMode:
keyDetails.tradingMode &&

View File

@ -91,6 +91,10 @@ export interface FillFields_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;
/**
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
*/
@ -111,10 +115,6 @@ export interface FillFields_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)

View File

@ -91,6 +91,10 @@ export interface Fills_party_tradesConnection_edges_node_market_tradableInstrume
* 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;
/**
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
*/
@ -111,10 +115,6 @@ export interface Fills_party_tradesConnection_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)

View File

@ -91,6 +91,10 @@ export interface FillsSub_trades_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;
/**
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
*/
@ -111,10 +115,6 @@ export interface FillsSub_trades_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)

View File

@ -41,13 +41,13 @@ const FILL_FRAGMENT = gql`
}
market {
id
name
decimalPlaces
positionDecimalPlaces
tradableInstrument {
instrument {
id
code
name
product {
... on Future {
settlementAsset {

View File

@ -28,11 +28,11 @@ describe('FillsTable', () => {
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',

View File

@ -44,7 +44,10 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
getRowId={({ data }) => data?.id}
{...props}
>
<AgGridColumn headerName={t('Market')} field="market.name" />
<AgGridColumn
headerName={t('Market')}
field="market.tradableInstrument.instrument.name"
/>
<AgGridColumn
headerName={t('Size')}
type="rightAligned"

View File

@ -23,7 +23,11 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
infrastructureFee: '5000',
},
market: {
tradableInstrument: {
instrument: {
name: 'Apples Daily v3',
},
},
positionDecimalPlaces: 2,
},
}),
@ -38,8 +42,12 @@ export const generateFills = (override?: PartialDeep<Fills>): Fills => {
id: '3',
aggressor: Side.SIDE_SELL,
market: {
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: {

View File

@ -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)

View File

@ -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',

View File

@ -46,7 +46,6 @@ export const MARKET_LIST_QUERY = gql`
query MarketList($interval: Interval!, $since: String!) {
markets {
id
name
decimalPlaces
positionDecimalPlaces
state

View File

@ -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)',
},
},
},

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -19,13 +19,13 @@ const ORDER_FRAGMENT = gql`
id
market {
id
name
decimalPlaces
positionDecimalPlaces
tradableInstrument {
instrument {
id
code
name
}
}
}

View File

@ -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]

View File

@ -29,7 +29,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => {
{order.market && (
<div>
<p className={labelClass}>{t(`Market`)}</p>
<p>{t(`${order.market.name}`)}</p>
<p>{t(`${order.market.tradableInstrument.instrument.name}`)}</p>
</div>
)}
<div>

View File

@ -53,7 +53,7 @@ export const OrderEditDialog = ({
{order.market && (
<div>
<p className={headerClassName}>{t(`Market`)}</p>
<p>{t(`${order.market.name}`)}</p>
<p>{t(`${order.market.tradableInstrument.instrument.name}`)}</p>
</div>
)}
{order.type === OrderType.TYPE_LIMIT && order.market && (

View File

@ -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)

View File

@ -18,7 +18,11 @@ export const ORDER_EVENT_SUB = gql`
side
market {
id
tradableInstrument {
instrument {
name
}
}
decimalPlaces
positionDecimalPlaces
}

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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(),