fix pnl
This commit is contained in:
parent
c44105e4cd
commit
3a57263452
|
@ -15,16 +15,11 @@ const calculatePNL = (tradeHistory, prices, mangoGroup) => {
|
|||
if (!prices.length) return '-'
|
||||
|
||||
const assetIndex = {
|
||||
'BTC/USDT': 0,
|
||||
'BTC/WUSDT': 0,
|
||||
'ETH/USDT': 1,
|
||||
'ETH/WUSDT': 1,
|
||||
'SOL/USDT': 2,
|
||||
'SOL/WUSDT': 2,
|
||||
'SRM/USDT': 3,
|
||||
'SRM/WUSDT': 3,
|
||||
USDT: 2,
|
||||
WUSDT: 2,
|
||||
'BTC/USDC': 0,
|
||||
'ETH/USDC': 1,
|
||||
'SOL/USDC': 2,
|
||||
'SRM/USDC': 3,
|
||||
USDC: 4,
|
||||
}
|
||||
|
||||
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 =
|
||||
current.side === 'sell'
|
||||
? parseInt(current.nativeQuantityReleased)
|
||||
|
@ -44,9 +39,9 @@ const calculatePNL = (tradeHistory, prices, mangoGroup) => {
|
|||
return usdtAmount + acc
|
||||
}, 0)
|
||||
|
||||
profitAndLoss['USDT'] = nativeToUi(
|
||||
totalNativeUsdt,
|
||||
mangoGroup.mintDecimals[2]
|
||||
profitAndLoss['USDC'] = nativeToUi(
|
||||
totalNativeUSDC,
|
||||
mangoGroup.mintDecimals[assetIndex['USDC']]
|
||||
)
|
||||
|
||||
let total = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const PageBodyContainer = ({ children }) => (
|
||||
<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}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue