diff --git a/components/account/ActivityFeedTable.tsx b/components/account/ActivityFeedTable.tsx
index df9d6000..db8a7341 100644
--- a/components/account/ActivityFeedTable.tsx
+++ b/components/account/ActivityFeedTable.tsx
@@ -275,8 +275,9 @@ export const getValue = (activity: any, mangoAccountAddress: string) => {
value = isTaker ? notional + fee : notional - fee
}
if (activity_type === 'openbook_trade') {
- const { price, size } = activity.activity_details
- value = price * size
+ const { price, side, size } = activity.activity_details
+ const flip = side === 'sell' ? -1 : 1
+ value = price * size * flip
}
if (activity_type === 'loan_origination_fee') {
const { price, fee } = activity.activity_details
@@ -534,7 +535,13 @@ const SharedTableBody = ({
{value > 0 && activity_type !== 'swap' && !isOpenbook && !isExpandable
? '+'
: ''}
-
+
+ {isOpenbook && fee.symbol !== 'USDC' ? (
+ {fee.symbol}
+ ) : null}
>
)
diff --git a/components/account/SpotTradeActivityDetails.tsx b/components/account/SpotTradeActivityDetails.tsx
index bd56a302..9ca202db 100644
--- a/components/account/SpotTradeActivityDetails.tsx
+++ b/components/account/SpotTradeActivityDetails.tsx
@@ -68,7 +68,13 @@ const SpotTradeActivityDetails = ({
{t('value')}
-
+
+ {quote_symbol !== 'USDC' ? (
+ {quote_symbol}
+ ) : null}
diff --git a/components/trade/TradeHistory.tsx b/components/trade/TradeHistory.tsx
index 91c190ff..f82a97be 100644
--- a/components/trade/TradeHistory.tsx
+++ b/components/trade/TradeHistory.tsx
@@ -21,7 +21,6 @@ import {
} from '@heroicons/react/20/solid'
import { useWallet } from '@solana/wallet-adapter-react'
import { PublicKey } from '@solana/web3.js'
-import mangoStore from '@store/mangoStore'
import dayjs from 'dayjs'
import useMangoAccount from 'hooks/useMangoAccount'
import useSelectedMarket from 'hooks/useSelectedMarket'
@@ -37,10 +36,11 @@ import TableMarketName from './TableMarketName'
import { useSortableData } from 'hooks/useSortableData'
import { useCallback } from 'react'
import { useHiddenMangoAccounts } from 'hooks/useHiddenMangoAccounts'
+import useMangoGroup from 'hooks/useMangoGroup'
const TradeHistory = ({ filterForMarket }: { filterForMarket?: boolean }) => {
const { t } = useTranslation(['common', 'trade'])
- const group = mangoStore.getState().group
+ const { group } = useMangoGroup()
const { selectedMarket } = useSelectedMarket()
const { mangoAccountAddress } = useMangoAccount()
const {
@@ -58,12 +58,23 @@ const TradeHistory = ({ filterForMarket }: { filterForMarket?: boolean }) => {
for (const trade of combinedTradeHistory) {
const marketName = trade.market.name
const value = trade.price * trade.size
+ // if (
+ // trade.market instanceof Serum3Market &&
+ // trade.market.quoteTokenIndex
+ // ) {
+ // const quotePrice = group?.getFirstBankByTokenIndex(
+ // trade.market.quoteTokenIndex,
+ // )?.uiPrice
+ // value = quotePrice ? value * quotePrice : 0
+ // }
const sortTime = trade?.time
? trade.time
: dayjs().format('YYYY-MM-DDTHH:mm:ss')
+
const data = { ...trade, marketName, value, sortTime }
formatted.push(data)
}
+
if (!filterForMarket) {
return formatted
} else {
@@ -154,6 +165,11 @@ const TradeHistory = ({ filterForMarket }: { filterForMarket?: boolean }) => {
const { side, price, market, size, feeCost, liquidity, value } =
trade
+ let quoteSymbol
+ if ('quote_symbol' in trade) {
+ quoteSymbol = trade.quote_symbol
+ }
+
let counterpartyAddress = ''
if ('taker' in trade) {
counterpartyAddress =
@@ -183,7 +199,17 @@ const TradeHistory = ({ filterForMarket }: { filterForMarket?: boolean }) => {
{price}
-
+
+ {quoteSymbol && quoteSymbol !== 'USDC' ? (
+
+ {' '}
+ {quoteSymbol}
+
+ ) : null}
|
|