From f8acf23e579c611a09f7cf9af6c84d1e1f2682ff Mon Sep 17 00:00:00 2001 From: lq0-github <1441665200@qq.com> Date: Thu, 23 Jan 2025 16:19:23 +0800 Subject: [PATCH] Fix some bugs --- screens/Trading/components/Table.tsx | 6 ++-- .../Trading/components/Table/HistoryRow.tsx | 34 +++++++++++-------- .../Trading/components/Table/PositionRow.tsx | 28 +++++++-------- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/screens/Trading/components/Table.tsx b/screens/Trading/components/Table.tsx index 89c27b03..285f74bb 100644 --- a/screens/Trading/components/Table.tsx +++ b/screens/Trading/components/Table.tsx @@ -290,7 +290,7 @@ const TradingTable = ({ const sortList = { close_timestamp: "Close time", open_timestamp: "Opening time", - pnl: "PNL & ROE", + pnl: "PNL", }; return (
@@ -339,7 +339,7 @@ const TradingTable = ({ Entry Price Index Price Liq. Price - PNL & ROE + PNL
handleSort("open_ts")} @@ -438,7 +438,7 @@ const TradingTable = ({ Fee handleSortChange("pnl")}>
- PNL & ROE + PNL { return !isMobile ? ( - {`${getSymbolById(assetP.token_id, assetP.metadata?.symbol)}/${getSymbolById( - assetD.token_id, - assetD.metadata?.symbol, - )}`} + {record.trend === "long" + ? `${getSymbolById(assetP.token_id, assetP.metadata?.symbol)}/${getSymbolById( + assetD.token_id, + assetD.metadata?.symbol, + )}` + : `${getSymbolById(assetD.token_id, assetD.metadata?.symbol)}/${getSymbolById( + assetP.token_id, + assetP.metadata?.symbol, + )}`}
{ ), ) : null} + + {record.trend === "long" + ? `${getSymbolById(assetP.token_id, assetP.metadata?.symbol)}` + : `${getSymbolById(assetD.token_id, assetD.metadata?.symbol)}`} + {beautifyPrice( @@ -74,17 +84,11 @@ const HistoryRow = ({ key, index, record, assetP, assetD, assetC }) => { ) : ( "-" )} -

- {getSymbolById(assetC.token_id, assetC.metadata?.symbol)} -

{record.price !== "0" ? {beautifyPrice(Number(record.price))} : "-"} -

- {getSymbolById(assetC.token_id, assetC.metadata?.symbol)} -

@@ -104,9 +108,6 @@ const HistoryRow = ({ key, index, record, assetP, assetD, assetC }) => { {record.pnl !== "0" ? beautifyPrice(Math.abs(record.pnl * record.c_token_price), false, 3, 3) : ""} - {/*

- {getSymbolById(assetC.token_id, assetC.metadata?.symbol)} -

*/}
@@ -194,6 +195,11 @@ const HistoryRow = ({ key, index, record, assetP, assetD, assetC }) => { ), ) : null} + + {record.trend === "long" + ? `${getSymbolById(assetP.token_id, assetP.metadata?.symbol)}` + : `${getSymbolById(assetD.token_id, assetD.metadata?.symbol)}`} +

@@ -267,7 +273,7 @@ const HistoryRow = ({ key, index, record, assetP, assetD, assetC }) => {

{record.close_type}

- PNL & ROE + PNL

0 ? "text-green-150" : record.pnl < 0 ? "text-red-150" : "" diff --git a/screens/Trading/components/Table/PositionRow.tsx b/screens/Trading/components/Table/PositionRow.tsx index 772f3b63..c0521abb 100644 --- a/screens/Trading/components/Table/PositionRow.tsx +++ b/screens/Trading/components/Table/PositionRow.tsx @@ -98,7 +98,7 @@ const PositionRow = ({ const netValue = parseTokenValue(item.token_c_info.balance, decimalsC) * (priceC || 0); const collateral = parseTokenValue(item.token_c_info.balance, decimalsC); - const assetLabel = positionType.label === "Long" ? symbolD : symbolP; + const assetLabel = positionType.label === "Long" ? symbolP : symbolD; const indexPrice = positionType.label === "Long" ? priceP / priceD : priceD / priceP; const openTime = new Date(Number(item.open_ts) / 1e6); const uahpi: any = isMainStream @@ -144,7 +144,10 @@ const PositionRow = ({

-

{beautifyPrice(size)}

+

+ {" "} + {beautifyPrice(size)} {assetLabel} +

({beautifyPrice(sizeValue, true, 3, 3)})
@@ -174,14 +177,10 @@ const PositionRow = ({ ) : ( - )} - {assetLabel}
-
- {beautifyPrice(indexPrice)} - {assetLabel} -
+
{beautifyPrice(indexPrice)}
${beautifyPrice(LiqPrice)} @@ -258,7 +257,10 @@ const PositionRow = ({
-

{beautifyPrice(size)}

+

+ {" "} + {beautifyPrice(size)} {assetLabel} +

({beautifyPrice(sizeValue, true, 3, 3)})

Size

@@ -291,9 +293,7 @@ const PositionRow = ({

Entry Price

{entryPrice !== null ? ( - - {beautifyPrice(entryPrice)} {assetLabel} - + {beautifyPrice(entryPrice)} ) : ( - )} @@ -301,9 +301,7 @@ const PositionRow = ({

Index Price

-

- {beautifyPrice(indexPrice)} {assetLabel} -

+

{beautifyPrice(indexPrice)}

Liq. Price

@@ -314,7 +312,7 @@ const PositionRow = ({

{new Date(openTime).toLocaleString()}

- PNL & ROE{" "} + PNL{" "}

0 ? "text-green-150" : pnl < 0 ? "text-red-150" : "text-gray-400"