@@ -51,6 +51,7 @@ export function SnapshotDetail({ snapshot, onClose }: SnapshotDetailProps) {
5151 < thead >
5252 < tr className = "bg-bg text-text-muted text-left" >
5353 < th className = "px-2.5 py-1.5 font-medium" > Symbol</ th >
54+ < th className = "px-2.5 py-1.5 font-medium text-center" > Ccy</ th >
5455 < th className = "px-2.5 py-1.5 font-medium text-right" > Qty</ th >
5556 < th className = "px-2.5 py-1.5 font-medium text-right" > Avg Cost</ th >
5657 < th className = "px-2.5 py-1.5 font-medium text-right" > Mkt Price</ th >
@@ -70,11 +71,12 @@ export function SnapshotDetail({ snapshot, onClose }: SnapshotDetailProps) {
7071 </ span >
7172 </ td >
7273 < td className = "px-2.5 py-1.5 text-right text-text tabular-nums" > { p . quantity } </ td >
73- < td className = "px-2.5 py-1.5 text-right text-text-muted tabular-nums" > { fmtStr ( p . avgCost ) } </ td >
74- < td className = "px-2.5 py-1.5 text-right text-text tabular-nums" > { fmtStr ( p . marketPrice ) } </ td >
75- < td className = "px-2.5 py-1.5 text-right text-text tabular-nums" > { fmtStr ( p . marketValue ) } </ td >
74+ < td className = "px-2.5 py-1.5 text-center text-text-muted text-[10px] tabular-nums" > { p . currency } </ td >
75+ < td className = "px-2.5 py-1.5 text-right text-text-muted tabular-nums" > { fmtStr ( p . avgCost , p . currency ) } </ td >
76+ < td className = "px-2.5 py-1.5 text-right text-text tabular-nums" > { fmtStr ( p . marketPrice , p . currency ) } </ td >
77+ < td className = "px-2.5 py-1.5 text-right text-text tabular-nums" > { fmtStr ( p . marketValue , p . currency ) } </ td >
7678 < td className = { `px-2.5 py-1.5 text-right font-medium tabular-nums ${ pnl >= 0 ? 'text-green' : 'text-red' } ` } >
77- { fmtPnlStr ( p . unrealizedPnL ) }
79+ { fmtPnlStr ( p . unrealizedPnL , p . currency ) }
7880 </ td >
7981 </ tr >
8082 )
@@ -153,15 +155,28 @@ function symbolFromAliceId(aliceId: string): string {
153155 return parts [ parts . length - 1 ]
154156}
155157
156- function fmtStr ( s : string ) : string {
158+ const CURRENCY_SYMBOLS : Record < string , string > = {
159+ USD : '$' , HKD : 'HK$' , EUR : '€' , GBP : '£' , JPY : '¥' ,
160+ CNY : '¥' , CNH : '¥' , CAD : 'C$' , AUD : 'A$' , CHF : 'CHF ' ,
161+ SGD : 'S$' , KRW : '₩' , INR : '₹' , TWD : 'NT$' , BRL : 'R$' ,
162+ }
163+
164+ function currencySymbol ( currency ?: string ) : string {
165+ if ( ! currency ) return '$'
166+ return CURRENCY_SYMBOLS [ currency . toUpperCase ( ) ] ?? `${ currency } `
167+ }
168+
169+ function fmtStr ( s : string , currency ?: string ) : string {
157170 const n = Number ( s )
158171 if ( isNaN ( n ) ) return s
159- return `$${ n . toLocaleString ( 'en-US' , { minimumFractionDigits : 2 , maximumFractionDigits : 2 } ) } `
172+ const sym = currencySymbol ( currency )
173+ return `${ sym } ${ n . toLocaleString ( 'en-US' , { minimumFractionDigits : 2 , maximumFractionDigits : 2 } ) } `
160174}
161175
162- function fmtPnlStr ( s : string ) : string {
176+ function fmtPnlStr ( s : string , currency ?: string ) : string {
163177 const n = Number ( s )
164178 if ( isNaN ( n ) ) return s
179+ const sym = currencySymbol ( currency )
165180 const sign = n >= 0 ? '+' : ''
166- return `${ sign } $${ n . toLocaleString ( 'en-US' , { minimumFractionDigits : 2 , maximumFractionDigits : 2 } ) } `
181+ return `${ sign } ${ sym } ${ n . toLocaleString ( 'en-US' , { minimumFractionDigits : 2 , maximumFractionDigits : 2 } ) } `
167182}
0 commit comments