diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index d07b5ca91..f9d86e935 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -131,7 +131,6 @@ describe('market info is displayed', { tags: '@smoke' }, () => { cy.get('p.col-span-1').contains('Within 43,200 seconds'); validateMarketDataRow(0, 'Highest Price', '7.97323 '); validateMarketDataRow(1, 'Lowest Price', '6.54701 '); - validateMarketDataRow(2, 'Reference Price', '7.22625 '); }); it('liquidity monitoring parameters displayed', () => { diff --git a/apps/trading-e2e/src/integration/trading-positions.cy.ts b/apps/trading-e2e/src/integration/trading-positions.cy.ts index bf2b93682..1d4c12b78 100644 --- a/apps/trading-e2e/src/integration/trading-positions.cy.ts +++ b/apps/trading-e2e/src/integration/trading-positions.cy.ts @@ -50,7 +50,6 @@ describe('positions', { tags: '@smoke' }, () => { const emptyCells = [ 'notional', 'markPrice', - 'liquidationPrice', 'currentLeverage', 'averageEntryPrice', ]; @@ -162,8 +161,6 @@ describe('positions', { tags: '@smoke' }, () => { cy.wrap($prices).invoke('text').should('not.be.empty'); }); - cy.get('[col-id="liquidationPrice"]').should('contain.text', '0'); // liquidation price - cy.get('[col-id="currentLeverage"]').should('contain.text', '2.846.1'); cy.get('[col-id="marginAccountBalance"]') // margin allocated diff --git a/libs/market-info/src/components/market-info/info-market.tsx b/libs/market-info/src/components/market-info/info-market.tsx index 2080f5545..0f9195a7e 100644 --- a/libs/market-info/src/components/market-info/info-market.tsx +++ b/libs/market-info/src/components/market-info/info-market.tsx @@ -322,9 +322,8 @@ export const Info = ({ market, onSelect }: InfoProps) => { data={{ highestPrice: bounds.maxValidPrice, lowestPrice: bounds.minValidPrice, - referencePrice: bounds.referencePrice, }} - decimalPlaces={assetDecimals} + decimalPlaces={market.decimalPlaces} assetSymbol={quoteUnit} /> )} diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index 798bb6734..2d6cdcd7e 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -213,7 +213,6 @@ describe('getMetrics && rejoinPositionData', () => { expect(metrics[0].marketDecimalPlaces).toEqual(5); expect(metrics[0].positionDecimalPlaces).toEqual(0); expect(metrics[0].decimals).toEqual(5); - expect(metrics[0].liquidationPrice).toEqual('169990'); expect(metrics[0].lowMarginLevel).toEqual(false); expect(metrics[0].markPrice).toEqual('9431775'); expect(metrics[0].marketId).toEqual( @@ -242,7 +241,6 @@ describe('getMetrics && rejoinPositionData', () => { expect(metrics[1].marketDecimalPlaces).toEqual(5); expect(metrics[1].positionDecimalPlaces).toEqual(0); expect(metrics[1].decimals).toEqual(5); - expect(metrics[1].liquidationPrice).toEqual('9830750'); expect(metrics[1].lowMarginLevel).toEqual(false); expect(metrics[1].markPrice).toEqual('869762'); expect(metrics[1].marketId).toEqual( diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index a75157763..a25e66892 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -67,7 +67,6 @@ export interface Position { positionDecimalPlaces: number; totalBalance: string; assetSymbol: string; - liquidationPrice: string | undefined; lowMarginLevel: boolean; marketId: string; marketTradingMode: Schema.MarketTradingMode; @@ -140,7 +139,6 @@ export const getMetrics = ( ? new BigNumber(0) : marginAccountBalance.dividedBy(totalBalance).multipliedBy(100); - const marginMaintenance = toBigNum(marginLevel.maintenanceLevel, decimals); const marginSearch = toBigNum(marginLevel.searchLevel, decimals); const marginInitial = toBigNum(marginLevel.initialLevel, decimals); @@ -151,17 +149,6 @@ export const getMetrics = ( .plus(markPrice) : undefined; - const liquidationPrice = markPrice - ? BigNumber.maximum( - 0, - marginMaintenance - .minus(marginAccountBalance) - .minus(generalAccountBalance) - .dividedBy(openVolume) - .plus(markPrice) - ) - : undefined; - const lowMarginLevel = marginAccountBalance.isLessThan( marginSearch.plus(marginInitial.minus(marginSearch).dividedBy(2)) @@ -180,9 +167,6 @@ export const getMetrics = ( market.tradableInstrument.instrument.product.settlementAsset.symbol, totalBalance: totalBalance.multipliedBy(10 ** decimals).toFixed(), lowMarginLevel, - liquidationPrice: liquidationPrice - ? liquidationPrice.multipliedBy(10 ** marketDecimalPlaces).toFixed(0) - : undefined, marketId: market.id, marketTradingMode: market.tradingMode, markPrice: marketData ? marketData.markPrice : undefined, diff --git a/libs/positions/src/lib/positions-table.spec.tsx b/libs/positions/src/lib/positions-table.spec.tsx index 2dde68a29..e5fa8cddb 100644 --- a/libs/positions/src/lib/positions-table.spec.tsx +++ b/libs/positions/src/lib/positions-table.spec.tsx @@ -17,7 +17,6 @@ const singleRow: Position = { decimals: 2, totalBalance: '123456', assetSymbol: 'BTC', - liquidationPrice: '83', lowMarginLevel: false, marketId: 'string', marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -50,7 +49,7 @@ it('render correct columns', async () => { }); const headers = screen.getAllByRole('columnheader'); - expect(headers).toHaveLength(12); + expect(headers).toHaveLength(11); expect( headers.map((h) => h.querySelector('[ref="eText"]')?.textContent?.trim()) ).toEqual([ @@ -60,7 +59,6 @@ it('render correct columns', async () => { 'Mark price', 'Settlement asset', 'Entry price', - 'Liquidation price (est)', 'Leverage', 'Margin allocated', 'Realised PNL', @@ -146,33 +144,12 @@ it('displays mark price', async () => { expect(cells[3].textContent).toEqual('-'); }); -it("displays properly entry, liquidation price and liquidation bar and it's intent", async () => { - let result: RenderResult; - await act(async () => { - result = render( - - ); - }); - let cells = screen.getAllByRole('gridcell'); - const entryPrice = cells[5].firstElementChild?.firstElementChild?.textContent; - expect(entryPrice).toEqual('13.3'); - await act(async () => { - result.rerender( - - ); - }); - cells = screen.getAllByRole('gridcell'); -}); - it('displays leverage', async () => { await act(async () => { render(); }); const cells = screen.getAllByRole('gridcell'); - expect(cells[7].textContent).toEqual('1.1'); + expect(cells[6].textContent).toEqual('1.1'); }); it('displays allocated margin', async () => { @@ -180,7 +157,7 @@ it('displays allocated margin', async () => { render(); }); const cells = screen.getAllByRole('gridcell'); - const cell = cells[8]; + const cell = cells[7]; expect(cell.textContent).toEqual('123,456.00'); }); @@ -189,8 +166,7 @@ it('displays realised and unrealised PNL', async () => { render(); }); const cells = screen.getAllByRole('gridcell'); - expect(cells[9].textContent).toEqual('1.23'); - expect(cells[10].textContent).toEqual('4.56'); + expect(cells[9].textContent).toEqual('4.56'); }); it('displays close button', async () => { @@ -206,7 +182,7 @@ it('displays close button', async () => { ); }); const cells = screen.getAllByRole('gridcell'); - expect(cells[12].textContent).toEqual('Close'); + expect(cells[11].textContent).toEqual('Close'); }); it('do not display close button if openVolume is zero', async () => { @@ -222,7 +198,7 @@ it('do not display close button if openVolume is zero', async () => { ); }); const cells = screen.getAllByRole('gridcell'); - expect(cells[12].textContent).toEqual(''); + expect(cells[11].textContent).toEqual(''); }); describe('PNLCell', () => { diff --git a/libs/positions/src/lib/positions-table.stories.tsx b/libs/positions/src/lib/positions-table.stories.tsx index 07b5044b4..0fcd1f2ae 100644 --- a/libs/positions/src/lib/positions-table.stories.tsx +++ b/libs/positions/src/lib/positions-table.stories.tsx @@ -9,7 +9,9 @@ export default { title: 'PositionsTable', } as Meta; -const Template: Story = (args) => ; +const Template: Story = (args) => ( + +); export const Primary = Template.bind({}); const longPosition: Position = { @@ -27,7 +29,6 @@ const longPosition: Position = { // leverageMaintenance: '0', // leverageRelease: '0', // leverageSearch: '0', - liquidationPrice: '1129935', lowMarginLevel: false, marginAccountBalance: new BigNumber('0').toString(), // marginMaintenance: '0', @@ -42,6 +43,8 @@ const longPosition: Position = { unrealisedPNL: '45', searchPrice: '1132123', updatedAt: '2022-07-27T15:02:58.400Z', + lossSocializationAmount: '0', + status: Schema.PositionStatus.POSITION_STATUS_UNSPECIFIED, }; const shortPosition: Position = { @@ -59,7 +62,6 @@ const shortPosition: Position = { // leverageMaintenance: '0', // leverageRelease: '0', // leverageSearch: '0', - liquidationPrice: '23734', lowMarginLevel: false, marginAccountBalance: new BigNumber('0').toString(), // marginMaintenance: '0', @@ -74,6 +76,8 @@ const shortPosition: Position = { unrealisedPNL: '0', searchPrice: '0', updatedAt: '2022-07-26T14:01:34.800Z', + lossSocializationAmount: '0', + status: Schema.PositionStatus.POSITION_STATUS_UNSPECIFIED, }; Primary.args = { diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 3167e1ef0..71a1da69d 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -249,40 +249,6 @@ export const PositionsTable = forwardRef( ); }} /> - { - return { - component: PriceFlashCell, - }; - }} - filter="agNumberColumnFilter" - valueGetter={({ - data, - }: VegaValueGetterParams) => { - return data?.liquidationPrice === undefined || !data - ? undefined - : toBigNum( - data.liquidationPrice, - data.marketDecimalPlaces - ).toNumber(); - }} - valueFormatter={({ - data, - }: VegaValueFormatterParams): - | string - | undefined => { - if (!data || data?.liquidationPrice === undefined) { - return undefined; - } - return addDecimalsFormatNumber( - data.liquidationPrice, - data.marketDecimalPlaces - ); - }} - />