Skip to content

Commit

Permalink
Fix: Show correct amount in the live trade history
Browse files Browse the repository at this point in the history
  • Loading branch information
LeifuChen authored Jul 21, 2023
2 parents 428c5df + 4617ffb commit bda871a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kwenta",
"version": "7.4.6",
"version": "7.4.7",
"description": "Kwenta",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kwenta/app",
"version": "7.4.6",
"version": "7.4.7",
"scripts": {
"dev": "next",
"build": "next build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TradesHistoryTable: FC<TradesHistoryTableProps> = ({ mobile, display }) =>
.map((trade) => {
return {
value: Number(trade?.price),
amount: Number(trade?.size),
amount: trade?.size,
time: Number(trade?.timestamp),
id: trade?.txnHash,
orderType: trade?.orderType,
Expand Down Expand Up @@ -118,16 +118,13 @@ const TradesHistoryTable: FC<TradesHistoryTableProps> = ({ mobile, display }) =>
header: () => <TableHeader>{t('futures.market.history.amount-label')}</TableHeader>,
accessorKey: TableColumnAccessor.Amount,
cell: (cellProps) => {
const numValue = Math.abs(cellProps.row.original.amount / 1e18)
const numDecimals = numValue === 0 ? 2 : numValue < 1 ? 4 : numValue >= 100000 ? 0 : 2

const normal = cellProps.row.original.orderType === 'Liquidation'
const negative = cellProps.row.original.amount > 0
const negative = cellProps.getValue() > 0

return (
<DirectionalValue negative={negative} normal={normal}>
{formatNumber(numValue, {
minDecimals: numDecimals,
{formatNumber(cellProps.getValue().abs(), {
suggestDecimals: true,
truncateOver: 1e6,
})}{' '}
{normal ? '💀' : ''}
Expand Down

0 comments on commit bda871a

Please sign in to comment.