add fee to perp activity debit

This commit is contained in:
saml33 2023-04-04 22:26:59 +10:00
parent 86dc1580d5
commit 5b1589797b
1 changed files with 4 additions and 3 deletions

View File

@ -176,17 +176,18 @@ const getCreditAndDebit = (activity: any, mangoAccountAddress: string) => {
: taker_side === 'bid'
? 'ask'
: 'bid'
const fee = taker === mangoAccountAddress ? taker_fee : maker_fee
const feeRatio = taker === mangoAccountAddress ? taker_fee : maker_fee
const notional = quantity * price
const fee = feeRatio * notional
if (side === 'bid') {
credit = { value: quantity, symbol: perp_market_name }
debit = {
value: formatNumericValue(notional + fee * notional * -1),
value: formatNumericValue((notional + fee) * -1),
symbol: 'USDC',
}
} else {
credit = {
value: formatNumericValue(notional - fee * notional),
value: formatNumericValue(notional - fee),
symbol: 'USDC',
}
debit = { value: `-${quantity}`, symbol: perp_market_name }