fix pnl
This commit is contained in:
parent
c44105e4cd
commit
3a57263452
|
@ -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
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue