Skip to content

Commit

Permalink
fixed total amount decimals in order book and added token symbol to o…
Browse files Browse the repository at this point in the history
…rderbook header
  • Loading branch information
lzhabo committed Feb 21, 2024
1 parent 4ecea64 commit 21473de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion spark-frontend/src/entity/SpotMarketOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ export class SpotMarketOrder {
this.quoteSize = new BN(order.baseSize)
.abs()
.times(order.orderPrice)
.times(this.quoteToken.decimals)
.times(Math.pow(10, this.quoteToken.decimals))
.div(Math.pow(10, this.baseToken.decimals) * this.priceScale);

this.quoteSizeUnits = BN.formatUnits(this.quoteSize, this.quoteToken.decimals);
this.price = new BN(order.orderPrice);
this.priceUnits = BN.formatUnits(order.orderPrice, this.priceDecimals);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useMedia } from "@src/hooks/useMedia";
import { media } from "@src/themes/breakpoints";
import BN from "@src/utils/BN";
import hexToRgba from "@src/utils/hexToRgb";
import { useStores } from "@stores";

import { ORDER_MODE, ORDER_TYPE, useCreateOrderSpotVM } from "../../LeftBlock/CreateOrderSpot/CreateOrderSpotVM";

Expand All @@ -35,6 +36,8 @@ const SpotOrderBookImpl: React.FC<IProps> = observer(() => {
const orderSpotVm = useCreateOrderSpotVM();
const media = useMedia();
const theme = useTheme();
const { tradeStore } = useStores();
const market = tradeStore.market;

const [isSettingsOpen, openSettings, closeSettings] = useFlag();

Expand Down Expand Up @@ -132,10 +135,9 @@ const SpotOrderBookImpl: React.FC<IProps> = observer(() => {
{renderSettingsIcons()}
</SettingsContainer>
<OrderBookHeader>
{/*todo добавить описание в каком токене столбец (например Amount BTC | Total USDC | Price USDC)*/}
<Text type={TEXT_TYPES.SUPPORTING}>Amount </Text>
<Text type={TEXT_TYPES.SUPPORTING}>Total </Text>
<Text type={TEXT_TYPES.SUPPORTING}>Price </Text>
<Text type={TEXT_TYPES.SUPPORTING}>{`Amount ${market?.baseToken.symbol}`}</Text>
<Text type={TEXT_TYPES.SUPPORTING}>{`Total ${market?.quoteToken.symbol}`}</Text>
<Text type={TEXT_TYPES.SUPPORTING}>{`Price ${market?.quoteToken.symbol}`}</Text>
</OrderBookHeader>
<Container fitContent={vm.orderFilter === 1 || vm.orderFilter === 2} reverse={vm.orderFilter === 1}>
{vm.orderFilter === 0 && (
Expand Down

0 comments on commit 21473de

Please sign in to comment.