feat(trading): use instrument code instead of name in positions, fills and accounts breakdown tables (#4478)
This commit is contained in:
parent
2e11cf4dfa
commit
9cc8f5a377
@ -53,7 +53,7 @@ describe('fills', { tags: '@regression' }, () => {
|
|||||||
cy.getByTestId(tabFills).contains('Market');
|
cy.getByTestId(tabFills).contains('Market');
|
||||||
cy.getByTestId(tabFills)
|
cy.getByTestId(tabFills)
|
||||||
.get(
|
.get(
|
||||||
'[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]'
|
'[role="gridcell"][col-id="market.tradableInstrument.instrument.code"]'
|
||||||
)
|
)
|
||||||
.each(($marketSymbol) => {
|
.each(($marketSymbol) => {
|
||||||
cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
|
cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
|
||||||
|
@ -142,22 +142,22 @@ describe('positions', { tags: '@regression', testIsolation: true }, () => {
|
|||||||
it('sorting by Market', () => {
|
it('sorting by Market', () => {
|
||||||
visitAndClickPositions();
|
visitAndClickPositions();
|
||||||
const marketsSortedDefault = [
|
const marketsSortedDefault = [
|
||||||
'ACTIVE MARKET',
|
'AAPL.MF21',
|
||||||
'Apple Monthly (30 Jun 2022)',
|
'BTCUSD.MF21',
|
||||||
'ETHBTC Quarterly (30 Jun 2022)',
|
'ETHBTC.QM21',
|
||||||
'SUSPENDED MARKET',
|
'SOLUSD',
|
||||||
];
|
];
|
||||||
const marketsSortedAsc = [
|
const marketsSortedAsc = [
|
||||||
'ACTIVE MARKET',
|
'AAPL.MF21',
|
||||||
'Apple Monthly (30 Jun 2022)',
|
'BTCUSD.MF21',
|
||||||
'ETHBTC Quarterly (30 Jun 2022)',
|
'ETHBTC.QM21',
|
||||||
'SUSPENDED MARKET',
|
'SOLUSD',
|
||||||
];
|
];
|
||||||
const marketsSortedDesc = [
|
const marketsSortedDesc = [
|
||||||
'SUSPENDED MARKET',
|
'SOLUSD',
|
||||||
'ETHBTC Quarterly (30 Jun 2022)',
|
'ETHBTC.QM21',
|
||||||
'Apple Monthly (30 Jun 2022)',
|
'BTCUSD.MF21',
|
||||||
'ACTIVE MARKET',
|
'AAPL.MF21',
|
||||||
];
|
];
|
||||||
cy.getByTestId(positions).click();
|
cy.getByTestId(positions).click();
|
||||||
// 7004-POSI-003
|
// 7004-POSI-003
|
||||||
@ -310,7 +310,7 @@ function validatePositionsDisplayed(multiKey = false) {
|
|||||||
cy.getByTestId('tab-positions').should('be.visible');
|
cy.getByTestId('tab-positions').should('be.visible');
|
||||||
cy.getByTestId('tab-positions')
|
cy.getByTestId('tab-positions')
|
||||||
.get('.ag-center-cols-container .ag-row')
|
.get('.ag-center-cols-container .ag-row')
|
||||||
.first()
|
.eq(multiKey ? 3 : 1)
|
||||||
.within(() => {
|
.within(() => {
|
||||||
cy.get('[col-id="marketName"]')
|
cy.get('[col-id="marketName"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
|
@ -23,6 +23,7 @@ const singleRow = {
|
|||||||
instrument: {
|
instrument: {
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
name: 'BTCUSD Monthly (30 Jun 2022)',
|
name: 'BTCUSD Monthly (30 Jun 2022)',
|
||||||
|
code: 'BTCUSD.MF21',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
|
id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35',
|
||||||
@ -57,7 +58,7 @@ describe('BreakdownTable', () => {
|
|||||||
});
|
});
|
||||||
const cells = await screen.findAllByRole('gridcell');
|
const cells = await screen.findAllByRole('gridcell');
|
||||||
const expectedValues = [
|
const expectedValues = [
|
||||||
'BTCUSD Monthly (30 Jun 2022)',
|
'BTCUSD.MF21',
|
||||||
'Margin',
|
'Margin',
|
||||||
'1,256.00 (50%)',
|
'1,256.00 (50%)',
|
||||||
'1,256.00',
|
'1,256.00',
|
||||||
@ -118,6 +119,7 @@ describe('BreakdownTable', () => {
|
|||||||
instrument: {
|
instrument: {
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
name: 'BTCUSD Monthly (30 Jun 2022)',
|
name: 'BTCUSD Monthly (30 Jun 2022)',
|
||||||
|
code: 'BTCUSD.MF21',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -31,12 +31,12 @@ const BreakdownTable = forwardRef<AgGridReact, BreakdownTableProps>(
|
|||||||
const defs: ColDef[] = [
|
const defs: ColDef[] = [
|
||||||
{
|
{
|
||||||
headerName: t('Market'),
|
headerName: t('Market'),
|
||||||
field: 'market.tradableInstrument.instrument.name',
|
field: 'market.tradableInstrument.instrument.code',
|
||||||
valueFormatter: ({
|
valueFormatter: ({
|
||||||
value,
|
value,
|
||||||
}: VegaValueFormatterParams<
|
}: VegaValueFormatterParams<
|
||||||
AccountFields,
|
AccountFields,
|
||||||
'market.tradableInstrument.instrument.name'
|
'market.tradableInstrument.instrument.code'
|
||||||
>) => {
|
>) => {
|
||||||
if (!value) return 'None';
|
if (!value) return 'None';
|
||||||
return value;
|
return value;
|
||||||
|
@ -20,7 +20,7 @@ describe('FillsTable', () => {
|
|||||||
positionDecimalPlaces: 5,
|
positionDecimalPlaces: 5,
|
||||||
tradableInstrument: {
|
tradableInstrument: {
|
||||||
instrument: {
|
instrument: {
|
||||||
name: 'test market',
|
code: 'test market',
|
||||||
product: {
|
product: {
|
||||||
settlementAsset: {
|
settlementAsset: {
|
||||||
decimals: 2,
|
decimals: 2,
|
||||||
@ -71,7 +71,7 @@ describe('FillsTable', () => {
|
|||||||
render(<FillsTable partyId={partyId} rowData={[{ ...buyerFill }]} />);
|
render(<FillsTable partyId={partyId} rowData={[{ ...buyerFill }]} />);
|
||||||
const cells = screen.getAllByRole('gridcell');
|
const cells = screen.getAllByRole('gridcell');
|
||||||
const expectedValues = [
|
const expectedValues = [
|
||||||
buyerFill.market?.tradableInstrument.instrument.name || '',
|
buyerFill.market?.tradableInstrument.instrument.code || '',
|
||||||
'+3.00',
|
'+3.00',
|
||||||
'1.00 BTC',
|
'1.00 BTC',
|
||||||
'3.00 BTC',
|
'3.00 BTC',
|
||||||
@ -106,7 +106,7 @@ describe('FillsTable', () => {
|
|||||||
|
|
||||||
const cells = screen.getAllByRole('gridcell');
|
const cells = screen.getAllByRole('gridcell');
|
||||||
const expectedValues = [
|
const expectedValues = [
|
||||||
buyerFill.market?.tradableInstrument.instrument.name || '',
|
buyerFill.market?.tradableInstrument.instrument.code || '',
|
||||||
'-3.00',
|
'-3.00',
|
||||||
'1.00 BTC',
|
'1.00 BTC',
|
||||||
'3.00 BTC',
|
'3.00 BTC',
|
||||||
@ -141,7 +141,7 @@ describe('FillsTable', () => {
|
|||||||
|
|
||||||
const cells = screen.getAllByRole('gridcell');
|
const cells = screen.getAllByRole('gridcell');
|
||||||
const expectedValues = [
|
const expectedValues = [
|
||||||
buyerFill.market?.tradableInstrument.instrument.name || '',
|
buyerFill.market?.tradableInstrument.instrument.code || '',
|
||||||
'-3.00',
|
'-3.00',
|
||||||
'1.00 BTC',
|
'1.00 BTC',
|
||||||
'3.00 BTC',
|
'3.00 BTC',
|
||||||
|
@ -47,7 +47,7 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
|
|||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
headerName: t('Market'),
|
headerName: t('Market'),
|
||||||
field: 'market.tradableInstrument.instrument.name',
|
field: 'market.tradableInstrument.instrument.code',
|
||||||
cellRenderer: 'MarketNameCell',
|
cellRenderer: 'MarketNameCell',
|
||||||
cellRendererParams: { idPath: 'market.id', onMarketClick },
|
cellRendererParams: { idPath: 'market.id', onMarketClick },
|
||||||
},
|
},
|
||||||
|
@ -113,6 +113,7 @@ const marketsData = [
|
|||||||
instrument: {
|
instrument: {
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
name: 'AAVEDAI Monthly (30 Jun 2022)',
|
||||||
|
code: 'AAVEDAI.MF21',
|
||||||
product: {
|
product: {
|
||||||
settlementAsset: {
|
settlementAsset: {
|
||||||
symbol: 'tDAI',
|
symbol: 'tDAI',
|
||||||
@ -142,6 +143,7 @@ const marketsData = [
|
|||||||
instrument: {
|
instrument: {
|
||||||
__typename: 'Instrument',
|
__typename: 'Instrument',
|
||||||
name: 'UNIDAI Monthly (30 Jun 2022)',
|
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||||
|
code: 'UNIDAI.MF21',
|
||||||
product: {
|
product: {
|
||||||
settlementAsset: {
|
settlementAsset: {
|
||||||
symbol: 'tDAI',
|
symbol: 'tDAI',
|
||||||
@ -183,7 +185,7 @@ describe('getMetrics && rejoinPositionData', () => {
|
|||||||
expect(metrics[0].marketId).toEqual(
|
expect(metrics[0].marketId).toEqual(
|
||||||
'5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8'
|
'5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8'
|
||||||
);
|
);
|
||||||
expect(metrics[0].marketName).toEqual('AAVEDAI Monthly (30 Jun 2022)');
|
expect(metrics[0].marketName).toEqual('AAVEDAI.MF21');
|
||||||
expect(metrics[0].marketTradingMode).toEqual(
|
expect(metrics[0].marketTradingMode).toEqual(
|
||||||
'TRADING_MODE_MONITORING_AUCTION'
|
'TRADING_MODE_MONITORING_AUCTION'
|
||||||
);
|
);
|
||||||
@ -208,7 +210,7 @@ describe('getMetrics && rejoinPositionData', () => {
|
|||||||
expect(metrics[1].marketId).toEqual(
|
expect(metrics[1].marketId).toEqual(
|
||||||
'10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e'
|
'10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e'
|
||||||
);
|
);
|
||||||
expect(metrics[1].marketName).toEqual('UNIDAI Monthly (30 Jun 2022)');
|
expect(metrics[1].marketName).toEqual('UNIDAI.MF21');
|
||||||
expect(metrics[1].marketTradingMode).toEqual('TRADING_MODE_CONTINUOUS');
|
expect(metrics[1].marketTradingMode).toEqual('TRADING_MODE_CONTINUOUS');
|
||||||
expect(metrics[1].notional).toEqual('86976200');
|
expect(metrics[1].notional).toEqual('86976200');
|
||||||
expect(metrics[1].openVolume).toEqual('-100');
|
expect(metrics[1].openVolume).toEqual('-100');
|
||||||
|
@ -121,7 +121,7 @@ export const getMetrics = (
|
|||||||
marginAccountBalance: marginAccount?.balance ?? '0',
|
marginAccountBalance: marginAccount?.balance ?? '0',
|
||||||
marketDecimalPlaces,
|
marketDecimalPlaces,
|
||||||
marketId: market.id,
|
marketId: market.id,
|
||||||
marketName: market.tradableInstrument.instrument.name,
|
marketName: market.tradableInstrument.instrument.code,
|
||||||
marketTradingMode: market.tradingMode,
|
marketTradingMode: market.tradingMode,
|
||||||
markPrice: marketData ? marketData.markPrice : undefined,
|
markPrice: marketData ? marketData.markPrice : undefined,
|
||||||
notional: notional
|
notional: notional
|
||||||
|
Loading…
Reference in New Issue
Block a user