2022-12-06 18:47:03 -08:00
|
|
|
|
import { useTranslation } from 'next-i18next'
|
|
|
|
|
import MarketLogos from '@components/trade/MarketLogos'
|
|
|
|
|
import { Table, Td, Th, TrBody, TrHead } from '@components/shared/TableElements'
|
2023-03-27 04:25:23 -07:00
|
|
|
|
import {
|
|
|
|
|
formatFunding,
|
|
|
|
|
usePerpFundingRate,
|
|
|
|
|
} from '@components/trade/PerpFundingRate'
|
2023-05-31 18:50:00 -07:00
|
|
|
|
import { ChevronDownIcon, ChevronRightIcon } from '@heroicons/react/20/solid'
|
2023-01-24 16:54:24 -08:00
|
|
|
|
import FormatNumericValue from '@components/shared/FormatNumericValue'
|
2023-05-31 18:50:00 -07:00
|
|
|
|
import { getDecimalCount, numberCompacter } from 'utils/numbers'
|
2023-02-09 21:05:07 -08:00
|
|
|
|
import Tooltip from '@components/shared/Tooltip'
|
2023-10-17 04:28:43 -07:00
|
|
|
|
import { useRouter } from 'next/router'
|
2023-05-01 19:01:14 -07:00
|
|
|
|
import SimpleAreaChart from '@components/shared/SimpleAreaChart'
|
2023-05-31 18:50:00 -07:00
|
|
|
|
import { Disclosure, Transition } from '@headlessui/react'
|
|
|
|
|
import { LinkButton } from '@components/shared/Button'
|
2023-06-14 17:43:33 -07:00
|
|
|
|
import SoonBadge from '@components/shared/SoonBadge'
|
2023-07-21 05:03:44 -07:00
|
|
|
|
import MarketChange from '@components/shared/MarketChange'
|
2023-07-21 11:50:06 -07:00
|
|
|
|
import useThemeWrapper from 'hooks/useThemeWrapper'
|
2023-07-24 05:14:45 -07:00
|
|
|
|
import useListedMarketsWithMarketData, {
|
|
|
|
|
PerpMarketWithMarketData,
|
|
|
|
|
} from 'hooks/useListedMarketsWithMarketData'
|
|
|
|
|
import { sortPerpMarkets } from 'utils/markets'
|
2023-10-03 22:05:16 -07:00
|
|
|
|
import { useViewport } from 'hooks/useViewport'
|
|
|
|
|
import { breakpoints } from 'utils/theme'
|
|
|
|
|
import ContentBox from '@components/shared/ContentBox'
|
|
|
|
|
import { COLORS } from 'styles/colors'
|
2023-10-17 04:28:43 -07:00
|
|
|
|
import { goToPerpMarketDetails } from '@components/stats/perps/PerpMarketDetailsTable'
|
2023-04-11 20:38:21 -07:00
|
|
|
|
|
2023-10-03 22:05:16 -07:00
|
|
|
|
const PerpMarketsTable = () => {
|
2022-12-06 18:47:03 -08:00
|
|
|
|
const { t } = useTranslation(['common', 'trade'])
|
2023-07-21 11:50:06 -07:00
|
|
|
|
const { theme } = useThemeWrapper()
|
2022-12-06 18:47:03 -08:00
|
|
|
|
const { width } = useViewport()
|
|
|
|
|
const showTableView = width ? width > breakpoints.md : false
|
2022-12-14 03:01:15 -08:00
|
|
|
|
const rate = usePerpFundingRate()
|
2023-04-11 20:38:21 -07:00
|
|
|
|
const router = useRouter()
|
2023-12-17 20:39:47 -08:00
|
|
|
|
const { perpMarketsWithData, isLoading } = useListedMarketsWithMarketData()
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ContentBox hideBorder hidePadding>
|
|
|
|
|
{showTableView ? (
|
2024-01-14 18:09:34 -08:00
|
|
|
|
<div className="thin-scroll overflow-x-auto">
|
|
|
|
|
<Table>
|
|
|
|
|
<thead>
|
|
|
|
|
<TrHead>
|
|
|
|
|
<Th className="text-left">{t('market')}</Th>
|
|
|
|
|
<Th className="text-right">{t('price')}</Th>
|
|
|
|
|
<Th className="text-right">{t('rolling-change')}</Th>
|
|
|
|
|
<Th className="text-right"></Th>
|
|
|
|
|
<Th className="text-right">{t('trade:24h-volume')}</Th>
|
|
|
|
|
<Th className="text-right">{t('trade:funding-rate')}</Th>
|
|
|
|
|
<Th className="text-right">{t('trade:open-interest')}</Th>
|
|
|
|
|
<Th />
|
|
|
|
|
</TrHead>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
{sortPerpMarkets(perpMarketsWithData, 'quote_volume_24h').map(
|
|
|
|
|
(market) => {
|
|
|
|
|
const symbol = market.name.split('-')[0]
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
const priceHistory = market?.marketData?.price_history
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
const volumeData = market?.marketData?.quote_volume_24h
|
2023-07-21 05:03:44 -07:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
const volume = volumeData ? volumeData : 0
|
2023-05-31 18:50:00 -07:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
let fundingRate
|
|
|
|
|
let fundingRateApr
|
|
|
|
|
if (rate.isSuccess) {
|
|
|
|
|
const marketRate = rate?.data?.find(
|
|
|
|
|
(r) => r.market_index === market.perpMarketIndex,
|
2023-07-24 05:14:45 -07:00
|
|
|
|
)
|
2024-01-14 18:09:34 -08:00
|
|
|
|
if (marketRate) {
|
|
|
|
|
fundingRate = formatFunding.format(
|
|
|
|
|
marketRate.funding_rate_hourly,
|
|
|
|
|
)
|
|
|
|
|
fundingRateApr = formatFunding.format(
|
|
|
|
|
marketRate.funding_rate_hourly * 8760,
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
fundingRate = '–'
|
|
|
|
|
fundingRateApr = '–'
|
|
|
|
|
}
|
2023-07-24 05:14:45 -07:00
|
|
|
|
} else {
|
|
|
|
|
fundingRate = '–'
|
|
|
|
|
fundingRateApr = '–'
|
|
|
|
|
}
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
const openInterest = market.baseLotsToUi(market.openInterest)
|
|
|
|
|
const isComingSoon = market.oracleLastUpdatedSlot == 0
|
|
|
|
|
const isUp =
|
|
|
|
|
priceHistory && priceHistory.length
|
|
|
|
|
? market.uiPrice >= priceHistory[0].price
|
|
|
|
|
: false
|
2023-02-01 19:41:32 -08:00
|
|
|
|
|
2024-01-14 18:09:34 -08:00
|
|
|
|
return (
|
|
|
|
|
<TrBody
|
|
|
|
|
className="default-transition md:hover:cursor-pointer md:hover:bg-th-bkg-2"
|
|
|
|
|
key={market.publicKey.toString()}
|
|
|
|
|
onClick={() => goToPerpMarketDetails(market.name, router)}
|
|
|
|
|
>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<MarketLogos market={market} size="large" />
|
|
|
|
|
<p className="mr-2 whitespace-nowrap font-body">
|
|
|
|
|
{market.name}
|
2023-06-14 17:43:33 -07:00
|
|
|
|
</p>
|
2024-01-14 18:09:34 -08:00
|
|
|
|
{isComingSoon ? <SoonBadge /> : null}
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex flex-col text-right">
|
|
|
|
|
<p>
|
|
|
|
|
{market.uiPrice ? (
|
2023-07-24 05:14:45 -07:00
|
|
|
|
<FormatNumericValue
|
2024-01-14 18:09:34 -08:00
|
|
|
|
value={market.uiPrice}
|
|
|
|
|
isUsd
|
2023-07-24 05:14:45 -07:00
|
|
|
|
/>
|
2024-01-14 18:09:34 -08:00
|
|
|
|
) : (
|
|
|
|
|
'–'
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex flex-col items-end">
|
|
|
|
|
<MarketChange market={market} />
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
{!isLoading ? (
|
|
|
|
|
priceHistory && priceHistory?.length ? (
|
|
|
|
|
<div className="h-10 w-24">
|
|
|
|
|
<SimpleAreaChart
|
|
|
|
|
color={
|
|
|
|
|
isUp ? COLORS.UP[theme] : COLORS.DOWN[theme]
|
|
|
|
|
}
|
|
|
|
|
data={priceHistory.concat([
|
|
|
|
|
{
|
|
|
|
|
time: new Date().toString(),
|
|
|
|
|
price: market.uiPrice,
|
|
|
|
|
},
|
|
|
|
|
])}
|
|
|
|
|
name={symbol}
|
|
|
|
|
xKey="time"
|
|
|
|
|
yKey="price"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
) : symbol === 'USDC' || symbol === 'USDT' ? null : (
|
|
|
|
|
<p className="mb-0 text-th-fgd-4">
|
|
|
|
|
{t('unavailable')}
|
2023-07-24 05:14:45 -07:00
|
|
|
|
</p>
|
2024-01-14 18:09:34 -08:00
|
|
|
|
)
|
2023-07-24 05:14:45 -07:00
|
|
|
|
) : (
|
2024-01-14 18:09:34 -08:00
|
|
|
|
<div className="h-10 w-[104px] animate-pulse rounded bg-th-bkg-3" />
|
2023-07-24 05:14:45 -07:00
|
|
|
|
)}
|
2024-01-14 18:09:34 -08:00
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex flex-col text-right">
|
|
|
|
|
<p>
|
|
|
|
|
{volume
|
|
|
|
|
? `$${numberCompacter.format(volume)}`
|
|
|
|
|
: '$0'}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex items-center justify-end">
|
|
|
|
|
{fundingRate !== '–' ? (
|
|
|
|
|
<Tooltip
|
|
|
|
|
content={
|
|
|
|
|
<>
|
|
|
|
|
{fundingRateApr ? (
|
|
|
|
|
<div className="">
|
|
|
|
|
The 1hr rate as an APR is{' '}
|
|
|
|
|
<span className="font-mono text-th-fgd-2">
|
|
|
|
|
{fundingRateApr}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
<div className="mt-2">
|
|
|
|
|
Funding is paid continuously. The 1hr rate
|
|
|
|
|
displayed is a rolling average of the past
|
|
|
|
|
60 mins.
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-2">
|
|
|
|
|
When positive, longs will pay shorts and
|
|
|
|
|
when negative shorts pay longs.
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<p className="tooltip-underline">{fundingRate}</p>
|
|
|
|
|
</Tooltip>
|
|
|
|
|
) : (
|
|
|
|
|
<p>–</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex flex-col text-right">
|
|
|
|
|
{openInterest ? (
|
|
|
|
|
<>
|
|
|
|
|
<p>
|
|
|
|
|
<FormatNumericValue
|
|
|
|
|
value={openInterest}
|
|
|
|
|
decimals={getDecimalCount(
|
|
|
|
|
market.minOrderSize,
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
</p>
|
|
|
|
|
<p className="text-th-fgd-4">
|
|
|
|
|
$
|
|
|
|
|
{numberCompacter.format(
|
|
|
|
|
openInterest * market.uiPrice,
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<p>–</p>
|
|
|
|
|
<p className="text-th-fgd-4">–</p>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
<Td>
|
|
|
|
|
<div className="flex justify-end">
|
|
|
|
|
<ChevronRightIcon className="h-5 w-5 text-th-fgd-3" />
|
|
|
|
|
</div>
|
|
|
|
|
</Td>
|
|
|
|
|
</TrBody>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
)}
|
|
|
|
|
</tbody>
|
|
|
|
|
</Table>
|
|
|
|
|
</div>
|
2022-12-06 18:47:03 -08:00
|
|
|
|
) : (
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<div className="border-b border-th-bkg-3">
|
2023-07-24 05:14:45 -07:00
|
|
|
|
{sortPerpMarkets(perpMarketsWithData, 'quote_volume_24h').map(
|
|
|
|
|
(market) => {
|
|
|
|
|
return (
|
|
|
|
|
<MobilePerpMarketItem
|
|
|
|
|
key={market.publicKey.toString()}
|
2023-12-17 20:39:47 -08:00
|
|
|
|
loadingMarketData={isLoading}
|
2023-07-24 05:14:45 -07:00
|
|
|
|
market={market}
|
|
|
|
|
/>
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
)}
|
2022-12-06 18:47:03 -08:00
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</ContentBox>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 22:05:16 -07:00
|
|
|
|
export default PerpMarketsTable
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2023-07-24 05:14:45 -07:00
|
|
|
|
const MobilePerpMarketItem = ({
|
|
|
|
|
market,
|
|
|
|
|
loadingMarketData,
|
|
|
|
|
}: {
|
|
|
|
|
market: PerpMarketWithMarketData
|
|
|
|
|
loadingMarketData: boolean
|
|
|
|
|
}) => {
|
2022-12-06 18:47:03 -08:00
|
|
|
|
const { t } = useTranslation('common')
|
2023-07-21 11:50:06 -07:00
|
|
|
|
const { theme } = useThemeWrapper()
|
2023-04-11 20:38:21 -07:00
|
|
|
|
const router = useRouter()
|
2023-05-31 18:50:00 -07:00
|
|
|
|
const rate = usePerpFundingRate()
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2023-07-24 05:14:45 -07:00
|
|
|
|
const priceHistory = market?.marketData?.price_history
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
2023-07-24 05:14:45 -07:00
|
|
|
|
const volumeData = market?.marketData?.quote_volume_24h
|
2023-07-21 05:03:44 -07:00
|
|
|
|
|
2023-07-24 05:14:45 -07:00
|
|
|
|
const volume = volumeData ? volumeData : 0
|
2023-07-21 05:03:44 -07:00
|
|
|
|
|
|
|
|
|
const symbol = market.name.split('-')[0]
|
2023-05-31 18:50:00 -07:00
|
|
|
|
|
|
|
|
|
const openInterest = market.baseLotsToUi(market.openInterest)
|
2023-06-14 17:43:33 -07:00
|
|
|
|
const isComingSoon = market.oracleLastUpdatedSlot == 0
|
2023-07-21 05:03:44 -07:00
|
|
|
|
const isUp =
|
|
|
|
|
priceHistory && priceHistory.length
|
|
|
|
|
? market.uiPrice >= priceHistory[0].price
|
|
|
|
|
: false
|
2023-05-31 18:50:00 -07:00
|
|
|
|
|
|
|
|
|
let fundingRate: string
|
|
|
|
|
let fundingRateApr: string
|
|
|
|
|
if (rate.isSuccess) {
|
|
|
|
|
const marketRate = rate?.data?.find(
|
2023-07-21 11:47:53 -07:00
|
|
|
|
(r) => r.market_index === market.perpMarketIndex,
|
2023-05-31 18:50:00 -07:00
|
|
|
|
)
|
|
|
|
|
if (marketRate) {
|
|
|
|
|
fundingRate = formatFunding.format(marketRate.funding_rate_hourly)
|
|
|
|
|
fundingRateApr = formatFunding.format(
|
2023-07-21 11:47:53 -07:00
|
|
|
|
marketRate.funding_rate_hourly * 8760,
|
2023-05-31 18:50:00 -07:00
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
fundingRate = '–'
|
|
|
|
|
fundingRateApr = '–'
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
fundingRate = '–'
|
|
|
|
|
fundingRateApr = '–'
|
|
|
|
|
}
|
2022-12-06 18:47:03 -08:00
|
|
|
|
|
|
|
|
|
return (
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<Disclosure>
|
|
|
|
|
{({ open }) => (
|
|
|
|
|
<>
|
|
|
|
|
<Disclosure.Button
|
|
|
|
|
className={`w-full border-t border-th-bkg-3 p-4 text-left first:border-t-0 focus:outline-none`}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div className="flex items-center">
|
2024-01-11 01:19:31 -08:00
|
|
|
|
<div className="flex shrink-0 items-center">
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<MarketLogos market={market} />
|
|
|
|
|
</div>
|
2023-06-14 17:43:33 -07:00
|
|
|
|
<p className="mr-2 leading-none text-th-fgd-1">{market.name}</p>
|
|
|
|
|
{isComingSoon ? <SoonBadge /> : null}
|
2023-05-31 18:50:00 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center space-x-3">
|
2023-07-21 05:03:44 -07:00
|
|
|
|
{!loadingMarketData ? (
|
|
|
|
|
priceHistory && priceHistory.length ? (
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<div className="ml-4 h-10 w-20">
|
|
|
|
|
<SimpleAreaChart
|
2023-07-21 05:03:44 -07:00
|
|
|
|
color={isUp ? COLORS.UP[theme] : COLORS.DOWN[theme]}
|
|
|
|
|
data={priceHistory.concat([
|
|
|
|
|
{
|
|
|
|
|
time: new Date().toString(),
|
|
|
|
|
price: market.uiPrice,
|
|
|
|
|
},
|
|
|
|
|
])}
|
|
|
|
|
name={symbol}
|
|
|
|
|
xKey="time"
|
2023-05-31 18:50:00 -07:00
|
|
|
|
yKey="price"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
) : symbol === 'USDC' || symbol === 'USDT' ? null : (
|
|
|
|
|
<p className="mb-0 text-th-fgd-4">{t('unavailable')}</p>
|
|
|
|
|
)
|
|
|
|
|
) : (
|
|
|
|
|
<div className="h-10 w-[104px] animate-pulse rounded bg-th-bkg-3" />
|
|
|
|
|
)}
|
2024-01-14 18:09:34 -08:00
|
|
|
|
<div className="flex flex-col items-end">
|
|
|
|
|
<p className="font-mono text-th-fgd-2">
|
|
|
|
|
{market.uiPrice ? (
|
|
|
|
|
<FormatNumericValue value={market.uiPrice} isUsd />
|
|
|
|
|
) : (
|
|
|
|
|
'–'
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
<MarketChange market={market} />
|
|
|
|
|
</div>
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<ChevronDownIcon
|
|
|
|
|
className={`${
|
2024-01-11 01:19:31 -08:00
|
|
|
|
open ? 'rotate-180' : 'rotate-0'
|
|
|
|
|
} h-6 w-6 shrink-0 text-th-fgd-3`}
|
2023-02-10 04:55:06 -08:00
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-05-31 18:50:00 -07:00
|
|
|
|
</div>
|
|
|
|
|
</Disclosure.Button>
|
|
|
|
|
<Transition
|
|
|
|
|
enter="transition ease-in duration-200"
|
|
|
|
|
enterFrom="opacity-0"
|
|
|
|
|
enterTo="opacity-100"
|
|
|
|
|
>
|
|
|
|
|
<Disclosure.Panel>
|
2024-01-14 18:09:34 -08:00
|
|
|
|
<div className="mx-4 grid grid-cols-2 gap-4 border-t border-th-bkg-3 py-4">
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<div className="col-span-1">
|
|
|
|
|
<p className="text-xs text-th-fgd-3">{t('price')}</p>
|
|
|
|
|
<p className="font-mono text-th-fgd-2">
|
2023-06-14 17:43:33 -07:00
|
|
|
|
{market.uiPrice ? (
|
|
|
|
|
<FormatNumericValue value={market.uiPrice} isUsd />
|
|
|
|
|
) : (
|
|
|
|
|
'–'
|
|
|
|
|
)}
|
2023-05-31 18:50:00 -07:00
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2023-06-04 18:12:54 -07:00
|
|
|
|
<div className="col-span-1">
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<p className="text-xs text-th-fgd-3">
|
|
|
|
|
{t('trade:24h-volume')}
|
|
|
|
|
</p>
|
|
|
|
|
<p className="font-mono text-th-fgd-2">
|
|
|
|
|
{volume ? (
|
|
|
|
|
<span>{numberCompacter.format(volume)}</span>
|
|
|
|
|
) : (
|
2023-07-21 05:20:12 -07:00
|
|
|
|
'$0'
|
2023-05-31 18:50:00 -07:00
|
|
|
|
)}
|
|
|
|
|
</p>
|
2023-06-04 18:12:54 -07:00
|
|
|
|
</div>
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<div className="col-span-1">
|
|
|
|
|
<p className="text-xs text-th-fgd-3">
|
|
|
|
|
{t('trade:funding-rate')}
|
|
|
|
|
</p>
|
2023-06-14 17:43:33 -07:00
|
|
|
|
{fundingRate !== '–' ? (
|
2023-05-31 18:50:00 -07:00
|
|
|
|
<Tooltip
|
|
|
|
|
content={
|
|
|
|
|
<>
|
|
|
|
|
{fundingRateApr ? (
|
|
|
|
|
<div className="">
|
|
|
|
|
The 1hr rate as an APR is{' '}
|
|
|
|
|
<span className="font-mono text-th-fgd-2">
|
|
|
|
|
{fundingRateApr}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
<div className="mt-2">
|
|
|
|
|
Funding is paid continuously. The 1hr rate displayed
|
|
|
|
|
is a rolling average of the past 60 mins.
|
|
|
|
|
</div>
|
|
|
|
|
<div className="mt-2">
|
|
|
|
|
When positive, longs will pay shorts and when
|
|
|
|
|
negative shorts pay longs.
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
2023-06-14 17:43:33 -07:00
|
|
|
|
<span className="tooltip-underline font-mono text-th-fgd-2">
|
2023-05-31 18:50:00 -07:00
|
|
|
|
{fundingRate}
|
|
|
|
|
</span>
|
|
|
|
|
</Tooltip>
|
2023-06-14 17:43:33 -07:00
|
|
|
|
) : (
|
|
|
|
|
<p className="text-th-fgd-2">–</p>
|
|
|
|
|
)}
|
2023-05-31 18:50:00 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div className="col-span-1">
|
|
|
|
|
<p className="text-xs text-th-fgd-3">
|
|
|
|
|
{t('trade:open-interest')}
|
|
|
|
|
</p>
|
2023-06-14 17:43:33 -07:00
|
|
|
|
{openInterest ? (
|
|
|
|
|
<p className="font-mono text-th-fgd-2">
|
|
|
|
|
<FormatNumericValue
|
|
|
|
|
value={openInterest}
|
|
|
|
|
decimals={getDecimalCount(market.minOrderSize)}
|
|
|
|
|
/>
|
|
|
|
|
<span className="mx-1 text-th-fgd-4">|</span>$
|
|
|
|
|
{numberCompacter.format(openInterest * market.uiPrice)}
|
|
|
|
|
</p>
|
|
|
|
|
) : (
|
|
|
|
|
<p className="text-th-fgd-2">–</p>
|
|
|
|
|
)}
|
2023-05-31 18:50:00 -07:00
|
|
|
|
</div>
|
|
|
|
|
<div className="col-span-1">
|
|
|
|
|
<LinkButton
|
|
|
|
|
className="flex items-center"
|
2023-10-17 04:28:43 -07:00
|
|
|
|
onClick={() => goToPerpMarketDetails(market.name, router)}
|
2023-05-31 18:50:00 -07:00
|
|
|
|
>
|
|
|
|
|
{t('token:token-stats', { token: market.name })}
|
|
|
|
|
<ChevronRightIcon className="ml-2 h-5 w-5" />
|
|
|
|
|
</LinkButton>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Disclosure.Panel>
|
|
|
|
|
</Transition>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Disclosure>
|
2022-12-06 18:47:03 -08:00
|
|
|
|
)
|
|
|
|
|
}
|