rename positions table; fix rounding issues
This commit is contained in:
parent
b9fee21da7
commit
9c1f8edf20
|
@ -5,7 +5,7 @@ import { notify } from '../utils/notifications'
|
|||
import { Table, Thead, Tbody, Tr, Th, Td } from 'react-super-responsive-table'
|
||||
import { InformationCircleIcon } from '@heroicons/react/outline'
|
||||
import Tooltip from './Tooltip'
|
||||
import { sleep } from '../utils'
|
||||
import { floorToDecimal, sleep } from '../utils'
|
||||
import { Market } from '@project-serum/serum'
|
||||
import {
|
||||
getTokenBySymbol,
|
||||
|
@ -159,7 +159,8 @@ const BalancesTable = () => {
|
|||
className={`px-6 py-3 whitespace-nowrap text-sm text-th-fgd-1`}
|
||||
>
|
||||
{+balance.marginDeposits > 0
|
||||
? balance.marginDeposits.toFixed(
|
||||
? floorToDecimal(
|
||||
balance.marginDeposits.toNumber(),
|
||||
tokenConfig.decimals
|
||||
)
|
||||
: 0}
|
||||
|
|
|
@ -2,7 +2,12 @@ import { useCallback, useMemo, useState } from 'react'
|
|||
import FloatingElement from './FloatingElement'
|
||||
import { ElementTitle } from './styles'
|
||||
import useMangoStore, { mangoClient } from '../stores/useMangoStore'
|
||||
import { i80f48ToPercent, tokenPrecision, formatUsdValue } from '../utils/index'
|
||||
import {
|
||||
ceilToDecimal,
|
||||
floorToDecimal,
|
||||
i80f48ToPercent,
|
||||
formatUsdValue,
|
||||
} from '../utils/index'
|
||||
import DepositModal from './DepositModal'
|
||||
import WithdrawModal from './WithdrawModal'
|
||||
import Button from './Button'
|
||||
|
@ -17,7 +22,7 @@ import {
|
|||
ZERO_BN,
|
||||
} from '@blockworks-foundation/mango-client'
|
||||
import useTradeHistory from '../hooks/useTradeHistory'
|
||||
import { getAvgEntryPrice, getBreakEvenPrice } from './PositionsTable'
|
||||
import { getAvgEntryPrice, getBreakEvenPrice } from './PerpPositionsTable'
|
||||
import { notify } from '../utils/notifications'
|
||||
|
||||
const handleSettlePnl = async (
|
||||
|
@ -225,14 +230,19 @@ export default function MarketPosition() {
|
|||
</div>
|
||||
<div className={`text-th-fgd-1`}>
|
||||
{mangoAccount
|
||||
? mangoAccount
|
||||
? floorToDecimal(
|
||||
mangoAccount
|
||||
.getUiDeposit(
|
||||
mangoGroupCache.rootBankCache[tokenIndex],
|
||||
mangoGroup,
|
||||
tokenIndex
|
||||
)
|
||||
.toFixed(tokenPrecision[symbol])
|
||||
: (0).toFixed(tokenPrecision[symbol])}
|
||||
.toNumber(),
|
||||
mangoGroup.tokens[tokenIndex].decimals
|
||||
)
|
||||
: (0).toFixed(
|
||||
mangoGroup.tokens[tokenIndex].decimals
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="pb-3">
|
||||
|
@ -241,14 +251,19 @@ export default function MarketPosition() {
|
|||
</div>
|
||||
<div className={`text-th-fgd-1`}>
|
||||
{mangoAccount
|
||||
? mangoAccount
|
||||
? ceilToDecimal(
|
||||
mangoAccount
|
||||
.getUiBorrow(
|
||||
mangoGroupCache.rootBankCache[tokenIndex],
|
||||
mangoGroup,
|
||||
tokenIndex
|
||||
)
|
||||
.toFixed(tokenPrecision[symbol])
|
||||
: (0).toFixed(tokenPrecision[symbol])}
|
||||
.toNumber(),
|
||||
mangoGroup.tokens[tokenIndex].decimals
|
||||
)
|
||||
: (0).toFixed(
|
||||
mangoGroup.tokens[tokenIndex].decimals
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
@ -239,7 +239,7 @@ const TradeHistoryTable = () => {
|
|||
</div>
|
||||
) : (
|
||||
<div className="w-full text-center py-6 bg-th-bkg-1 text-th-fgd-3 rounded-md">
|
||||
No {marketConfig.name} trade history
|
||||
No trade history
|
||||
{asPath === '/account' ? (
|
||||
<Link href={'/'}>
|
||||
<a className="inline-flex ml-2 py-0">Make a trade</a>
|
||||
|
|
|
@ -2,7 +2,7 @@ import { useState } from 'react'
|
|||
import FloatingElement from './FloatingElement'
|
||||
import OpenOrdersTable from './OpenOrdersTable'
|
||||
import BalancesTable from './BalancesTable'
|
||||
import PositionsTable from './PositionsTable'
|
||||
import PositionsTable from './PerpPositionsTable'
|
||||
import TradeHistoryTable from './TradeHistoryTable'
|
||||
// import { Position } from '../public/charting_library/charting_library'
|
||||
// import FeeDiscountsTable from './FeeDiscountsTable'
|
||||
|
|
|
@ -32,7 +32,7 @@ import { Market } from '@project-serum/serum'
|
|||
import SideBadge from '../SideBadge'
|
||||
import Button, { LinkButton } from '../Button'
|
||||
import Switch from '../Switch'
|
||||
import PositionsTable from '../PositionsTable'
|
||||
import PositionsTable from '../PerpPositionsTable'
|
||||
import DepositModal from '../DepositModal'
|
||||
import WithdrawModal from '../WithdrawModal'
|
||||
|
||||
|
|
Loading…
Reference in New Issue