fix: full arb table + net profit columns in price view

- ArbTable: removed slice(0,10) cap, shows all 42 opps (21x2)
- PriceTable: added net_bg_to_hl and net_hl_to_bg columns
- Backend SSE: sends net profit for both directions per coin
This commit is contained in:
jackyu66git
2026-05-04 18:26:49 +08:00
parent 9628100681
commit 0aa9923067
14 changed files with 45090 additions and 15 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Exchange Monitor Dashboard</title>
<script type="module" crossorigin src="/static/assets/index-DqqWimRT.js"></script>
<script type="module" crossorigin src="/static/assets/index-D_JzXaOQ.js"></script>
<link rel="stylesheet" crossorigin href="/static/assets/index-Bh5bnFYE.css">
</head>
<body>
+10 -4
View File
@@ -333,15 +333,15 @@ function PriceTable({ coins, prices, getPrevPrice, priceClass, pricesAge }) {
<div className="table-wrap">
<table id="price-table">
<thead>
<tr><th>币种</th><th>HyperLiquid</th><th>Bitget</th><th>BGHL价差</th></tr>
<tr><th>币种</th><th>HyperLiquid</th><th>Bitget</th><th>毛价差</th><th>BGHL净利</th><th>HLBG净利</th></tr>
</thead>
<tbody id="price-body">
{coins.length === 0 ? (
<tr><td colSpan="4" className="loading">等待数据...</td></tr>
<tr><td colSpan="6" className="loading">等待数据...</td></tr>
) : coins.map(coin => {
const row = prices.find(p => p.coin === coin)
if (!row) {
return <tr key={coin}><td>{coin}</td><td className="text-dim">-</td><td className="text-dim">-</td><td className="text-dim">-</td></tr>
return <tr key={coin}><td>{coin}</td><td className="text-dim">-</td><td className="text-dim">-</td><td className="text-dim">-</td><td className="text-dim">-</td><td className="text-dim">-</td></tr>
}
const cells = EXCHANGES.map(ex => {
const p = row[ex]
@@ -351,11 +351,17 @@ function PriceTable({ coins, prices, getPrevPrice, priceClass, pricesAge }) {
})
const spread = row['bg_hl_spread']
const spreadCls = spread > 0.2 ? 'text-green' : spread < -0.2 ? 'text-red' : ''
const nb = row['net_bg_to_hl']
const nh = row['net_hl_to_bg']
const nbCls = nb != null ? pnlClass(nb) : ''
const nhCls = nh != null ? pnlClass(nh) : ''
return (
<tr key={coin}>
<td><strong>{coin}</strong></td>
{cells}
<td className={spreadCls}>{spread != null ? spread.toFixed(4) + '%' : '-'}</td>
<td className={nbCls}>{nb != null ? nb.toFixed(2) + '%' : '-'}</td>
<td className={nhCls}>{nh != null ? nh.toFixed(2) + '%' : '-'}</td>
</tr>
)
})}
@@ -378,7 +384,7 @@ function ArbTable({ opps }) {
<tbody id="arb-body">
{!opps || opps.length === 0 ? (
<tr><td colSpan="5" className="text-dim">暂无套利机会</td></tr>
) : opps.slice(0, 10).map((opp, i) => {
) : opps.map((opp, i) => {
const cls = opp.net_profit > 0.10 ? 'text-green' : opp.net_profit > 0.05 ? 'text-yellow' : ''
return (
<tr key={i}>