yarn format

This commit is contained in:
Tyler Shipe 2022-01-16 11:12:59 -06:00
parent a0f6f3da0b
commit c307571624
3 changed files with 25 additions and 48 deletions

View File

@ -5,9 +5,7 @@ import { Table, Td, Th, TrBody, TrHead } from '../TableElements'
import { useTranslation } from 'next-i18next'
import { isEmpty } from 'lodash'
import usePagination from '../../hooks/usePagination'
import {
numberCompactFormatter,
} from '../../utils/'
import { numberCompactFormatter } from '../../utils/'
import Pagination from '../Pagination'
import Chart from '../Chart'
@ -46,24 +44,19 @@ const AccountPerformance = () => {
}, [mangoAccount])
const exportPerformanceDataToCSV = () => {
const dataToExport = hourlyPerformanceStats.map((row) => {
const timestamp = new Date(row.time)
return {
timestamp: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`,
account_equity: row.account_equity,
pnl: row.pnl
pnl: row.pnl,
}
})
const title = `${
mangoAccount.name || mangoAccount.publicKey
}-Performance-${new Date().toLocaleDateString()}`
const headers = [
'Timestamp',
'Account Equity',
'PNL'
]
const headers = ['Timestamp', 'Account Equity', 'PNL']
exportDataToCSV(dataToExport, title, headers, t)
}
@ -75,7 +68,6 @@ const AccountPerformance = () => {
}, [hourlyPerformanceStats])
useEffect(() => {
const fetchHourlyPerformanceStats = async () => {
setLoading(true)
const response = await fetch(
@ -181,16 +173,8 @@ const AccountPerformance = () => {
return (
<TrBody index={index} key={stat.time}>
<Td>{dayjs(utc).format('DD/MM/YY, h:mma')}</Td>
<Td>
{stat.account_equity.toFixed(
6 + 1
)}
</Td>
<Td>
{stat.pnl.toFixed(
6 + 1
)}
</Td>
<Td>{stat.account_equity.toFixed(6 + 1)}</Td>
<Td>{stat.pnl.toFixed(6 + 1)}</Td>
</TrBody>
)
})}

View File

@ -41,7 +41,14 @@ export async function getStaticProps({ locale }) {
}
}
const TABS = ['Portfolio', 'Orders', 'History', 'Interest', 'Funding', 'Performance']
const TABS = [
'Portfolio',
'Orders',
'History',
'Interest',
'Funding',
'Performance',
]
export default function Account() {
const { t } = useTranslation('common')

View File

@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
@ -19,16 +15,6 @@
"isolatedModules": true,
"incremental": true
},
"exclude": [
"node_modules",
".next",
"out",
"public/datafeeds"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.js"
]
"exclude": ["node_modules", ".next", "out", "public/datafeeds"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"]
}