yarn format
This commit is contained in:
parent
d648fcc1ac
commit
b7bf1cdda5
|
@ -101,6 +101,7 @@ const BalancesTable = ({ showZeroBalances = false }) => {
|
|||
const spotMarkets = Object.values(markets).filter(
|
||||
(mkt) => mkt instanceof Market
|
||||
) as Market[]
|
||||
|
||||
const txids: TransactionSignature[] = await mangoClient.settleAll(
|
||||
mangoGroup,
|
||||
mangoAccount,
|
||||
|
|
|
@ -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 {
|
||||
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(
|
||||
|
@ -85,12 +77,12 @@ const AccountPerformance = () => {
|
|||
const entries: any = Object.entries(parsedResponse)
|
||||
|
||||
const stats = entries
|
||||
.map(([key, value]) => {
|
||||
return { ...value, time: key }
|
||||
})
|
||||
.filter((x) => x)
|
||||
.reverse()
|
||||
|
||||
.map(([key, value]) => {
|
||||
return { ...value, time: key }
|
||||
})
|
||||
.filter((x) => x)
|
||||
.reverse()
|
||||
|
||||
setLoading(false)
|
||||
setHourlyPerformanceStats(stats)
|
||||
}
|
||||
|
@ -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>
|
||||
)
|
||||
})}
|
||||
|
|
|
@ -43,7 +43,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')
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
|
|
|
@ -30,7 +30,11 @@ export async function deposit({
|
|||
Number(amount)
|
||||
)
|
||||
} else {
|
||||
const existingAccounts = await mangoClient.getMangoAccountsForOwner(mangoGroup, wallet.publicKey, false);
|
||||
const existingAccounts = await mangoClient.getMangoAccountsForOwner(
|
||||
mangoGroup,
|
||||
wallet.publicKey,
|
||||
false
|
||||
)
|
||||
return await mangoClient.createMangoAccountAndDeposit(
|
||||
mangoGroup,
|
||||
wallet,
|
||||
|
|
41
yarn.lock
41
yarn.lock
|
@ -1285,14 +1285,14 @@
|
|||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@blockworks-foundation/mango-client@git+https://github.com/blockworks-foundation/mango-client-v3.git#v3.3":
|
||||
version "3.2.15"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#fccb9d5e35c60f598f44fe382abc50c80fc71b02"
|
||||
version "3.2.25"
|
||||
resolved "git+https://github.com/blockworks-foundation/mango-client-v3.git#c420471d468ad9ba3af0a0e0f448835beacae8d9"
|
||||
dependencies:
|
||||
"@project-serum/anchor" "^0.16.2"
|
||||
"@project-serum/serum" "0.13.55"
|
||||
"@project-serum/sol-wallet-adapter" "^0.2.0"
|
||||
"@solana/spl-token" "^0.1.6"
|
||||
"@solana/web3.js" "1.21.0"
|
||||
"@solana/web3.js" "^1.31.0"
|
||||
big.js "^6.1.1"
|
||||
bn.js "^5.2.0"
|
||||
buffer-layout "^1.2.1"
|
||||
|
@ -2011,26 +2011,6 @@
|
|||
buffer-layout "^1.2.0"
|
||||
dotenv "10.0.0"
|
||||
|
||||
"@solana/web3.js@1.21.0":
|
||||
version "1.21.0"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.21.0.tgz#4f98edea38d4cb3ae4d2ea49a050b0ec09508023"
|
||||
integrity sha512-x1NXlF92tEjxuTxS0u4n9JV17UKk0Dn2L+qSWGvKOb4iWhzApDj6wicJsrGdSbGdxnZ7eciQ/SNn3zB4ydUllA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.12.5"
|
||||
"@solana/buffer-layout" "^3.0.0"
|
||||
bn.js "^5.0.0"
|
||||
borsh "^0.4.0"
|
||||
bs58 "^4.0.1"
|
||||
buffer "6.0.1"
|
||||
crypto-hash "^1.2.2"
|
||||
jayson "^3.4.4"
|
||||
js-sha3 "^0.8.0"
|
||||
node-fetch "^2.6.1"
|
||||
rpc-websockets "^7.4.2"
|
||||
secp256k1 "^4.0.2"
|
||||
superstruct "^0.14.2"
|
||||
tweetnacl "^1.0.0"
|
||||
|
||||
"@solana/web3.js@^1.17.0", "@solana/web3.js@^1.21.0", "@solana/web3.js@^1.31.0", "@solana/web3.js@~1.31.0":
|
||||
version "1.31.0"
|
||||
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.31.0.tgz#7a313d4c1a90b77f27ddbfe845a10d6883e06452"
|
||||
|
@ -2282,9 +2262,9 @@
|
|||
integrity sha512-qVCiT93utxN0cawScyQuNx8H82vBvZXSClZfgOu3l3dRRlRO6FjKEZlaPgXG9XUFjIAOsA4kAJY101vobHeJLQ==
|
||||
|
||||
"@types/express-serve-static-core@^4.17.9":
|
||||
version "4.17.27"
|
||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.27.tgz#7a776191e47295d2a05962ecbb3a4ce97e38b401"
|
||||
integrity sha512-e/sVallzUTPdyOTiqi8O8pMdBBphscvI6E4JYaKlja4Lm+zh7UFSSdW5VMkRbhDtmrONqOUHOXRguPsDckzxNA==
|
||||
version "4.17.28"
|
||||
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.28.tgz#c47def9f34ec81dc6328d0b1b5303d1ec98d86b8"
|
||||
integrity sha512-P1BJAEAW3E2DJUlkgq4tOL3RyMunoWXqbSCygWo5ZIWTjUgN1YnaXWW4VWl/oc8vs/XoYibEGBKP0uZyF4AHig==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
"@types/qs" "*"
|
||||
|
@ -2979,16 +2959,11 @@ bl@^4.0.3:
|
|||
inherits "^2.0.4"
|
||||
readable-stream "^3.4.0"
|
||||
|
||||
bn.js@5.1.3, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@~5.2.0:
|
||||
bn.js@5.1.3, bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9, bn.js@^5.0.0, bn.js@^5.1.0, bn.js@^5.1.1, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@~5.2.0:
|
||||
version "5.1.3"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b"
|
||||
integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==
|
||||
|
||||
bn.js@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002"
|
||||
integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==
|
||||
|
||||
boolbase@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||
|
@ -3672,7 +3647,7 @@ crypto-browserify@3.12.0:
|
|||
randombytes "^2.0.0"
|
||||
randomfill "^1.0.3"
|
||||
|
||||
crypto-hash@^1.2.2, crypto-hash@^1.3.0:
|
||||
crypto-hash@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-1.3.0.tgz#b402cb08f4529e9f4f09346c3e275942f845e247"
|
||||
integrity sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==
|
||||
|
|
Loading…
Reference in New Issue