diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 463c3d16b..7f49456f4 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -20,6 +20,7 @@ const MARKET_QUERY = gql` tradingMode state decimalPlaces + positionDecimalPlaces data { market { id diff --git a/apps/trading/pages/markets/__generated__/Market.ts b/apps/trading/pages/markets/__generated__/Market.ts index 683136706..30ee4dfdb 100644 --- a/apps/trading/pages/markets/__generated__/Market.ts +++ b/apps/trading/pages/markets/__generated__/Market.ts @@ -144,6 +144,12 @@ export interface Market_market { * GBX (pence) 1 4 GBP 0.000001 ( 0.0001p) */ decimalPlaces: number; + /** + * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes. + * 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market. + */ + positionDecimalPlaces: number; /** * marketData for the given market */ diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index c59d44373..a3f70a56e 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -11,7 +11,7 @@ import { TradesContainer } from '@vegaprotocol/trades'; import { PositionsContainer } from '@vegaprotocol/positions'; import { OrderbookContainer } from '@vegaprotocol/market-depth'; import type { Market_market } from './__generated__/Market'; -import { formatNumber, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; import { AccountsContainer } from '@vegaprotocol/accounts'; import { DepthChartContainer } from '@vegaprotocol/market-depth'; import { CandlesChartContainer } from '@vegaprotocol/candles-chart'; @@ -89,7 +89,10 @@ export const TradeMarketHeader = ({ Volume {market.data && market.data.indicativeVolume !== '0' - ? formatNumber(market.data.indicativeVolume) + ? addDecimalsFormatNumber( + market.data.indicativeVolume, + market.positionDecimalPlaces + ) : '-'}