fix perp stats funding rate

This commit is contained in:
saml33 2022-12-14 22:01:15 +11:00
parent d379cc1a75
commit c87f8b19b8
2 changed files with 7 additions and 6 deletions

View File

@ -25,9 +25,7 @@ const PerpMarketsTable = () => {
const { theme } = useTheme()
const { width } = useViewport()
const showTableView = width ? width > breakpoints.md : false
// const bids = mangoStore((s) => s.selectedMarket.bidsAccount)
// const asks = mangoStore((s) => s.selectedMarket.asksAccount)
const rates = usePerpFundingRate()
const rate = usePerpFundingRate()
return (
<ContentBox hideBorder hidePadding>
@ -63,11 +61,13 @@ const PerpMarketsTable = () => {
const chartData = coingeckoData ? coingeckoData.prices : undefined
let fundingRate
if (rates.isSuccess && rates.data) {
const marketRate = rates.data.find(
if (rate.isSuccess && market instanceof PerpMarket) {
const marketRate = rate?.data?.find(
(r) => r.market_index === market.perpMarketIndex
)
fundingRate = `${marketRate?.funding_apr?.toFixed(2)}%`
fundingRate = marketRate
? `${marketRate.funding_rate_hourly.toFixed(4)}%`
: ''
} else {
fundingRate = ''
}

View File

@ -10,6 +10,7 @@ export async function getStaticProps({ locale }: { locale: string }) {
'onboarding',
'profile',
'token',
'trade',
])),
},
}