This commit is contained in:
Tyler Shipe 2021-06-07 13:01:41 -04:00
parent c44105e4cd
commit 3a57263452
2 changed files with 10 additions and 15 deletions

View File

@ -15,16 +15,11 @@ const calculatePNL = (tradeHistory, prices, mangoGroup) => {
if (!prices.length) return '-' if (!prices.length) return '-'
const assetIndex = { const assetIndex = {
'BTC/USDT': 0, 'BTC/USDC': 0,
'BTC/WUSDT': 0, 'ETH/USDC': 1,
'ETH/USDT': 1, 'SOL/USDC': 2,
'ETH/WUSDT': 1, 'SRM/USDC': 3,
'SOL/USDT': 2, USDC: 4,
'SOL/WUSDT': 2,
'SRM/USDT': 3,
'SRM/WUSDT': 3,
USDT: 2,
WUSDT: 2,
} }
groupedTrades.forEach((val, key) => { groupedTrades.forEach((val, key) => {
@ -35,7 +30,7 @@ const calculatePNL = (tradeHistory, prices, mangoGroup) => {
) )
}) })
const totalNativeUsdt = tradeHistory.reduce((acc, current) => { const totalNativeUSDC = tradeHistory.reduce((acc, current) => {
const usdtAmount = const usdtAmount =
current.side === 'sell' current.side === 'sell'
? parseInt(current.nativeQuantityReleased) ? parseInt(current.nativeQuantityReleased)
@ -44,9 +39,9 @@ const calculatePNL = (tradeHistory, prices, mangoGroup) => {
return usdtAmount + acc return usdtAmount + acc
}, 0) }, 0)
profitAndLoss['USDT'] = nativeToUi( profitAndLoss['USDC'] = nativeToUi(
totalNativeUsdt, totalNativeUSDC,
mangoGroup.mintDecimals[2] mangoGroup.mintDecimals[assetIndex['USDC']]
) )
let total = 0 let total = 0

View File

@ -1,6 +1,6 @@
const PageBodyContainer = ({ children }) => ( const PageBodyContainer = ({ children }) => (
<div className="min-h-screen grid grid-cols-12 gap-4 pb-10"> <div className="min-h-screen grid grid-cols-12 gap-4 pb-10">
<div className="col-span-12 px-6 lg:col-start-2 lg:col-span-10 2xl:col-start-5 2xl:col-span-6"> <div className="col-span-12 px-6 xl:col-start-2 xl:col-span-10 2xl:col-start-3 2xl:col-span-8">
{children} {children}
</div> </div>
</div> </div>