实时挂单比例显示
This commit is contained in:
parent
5708ab2b14
commit
bc1cd1297a
@ -67,9 +67,6 @@ export function mapBaiduQuotationToQuote(result: BaiduQuotationResult): QuoteDat
|
||||
|
||||
const outside = toNum(op?.outside)
|
||||
const inside = toNum(op?.inside)
|
||||
const total = outside + inside
|
||||
const buyRatio = total > 0 ? Math.round((outside / total) * 100) : 50
|
||||
const sellRatio = 100 - buyRatio
|
||||
|
||||
const asksRaw = result.askinfos ?? []
|
||||
const bidsRaw = result.buyinfos ?? []
|
||||
@ -87,6 +84,13 @@ export function mapBaiduQuotationToQuote(result: BaiduQuotationResult): QuoteDat
|
||||
volume: toNum(b.bidvolume),
|
||||
}))
|
||||
|
||||
// 买卖力度条按五档挂单量汇总,而非外盘/内盘
|
||||
const bidVol = bids.reduce((sum, b) => sum + b.volume, 0)
|
||||
const askVol = asks.reduce((sum, a) => sum + a.volume, 0)
|
||||
const bookTotal = bidVol + askVol
|
||||
const buyRatio = bookTotal > 0 ? Math.round((bidVol / bookTotal) * 100) : 50
|
||||
const sellRatio = 100 - buyRatio
|
||||
|
||||
const amountYi = parseAmountYi(
|
||||
result.pankouinfos?.list?.find((i) => i.ename === 'amount')?.value,
|
||||
op?.amount,
|
||||
|
||||
@ -71,8 +71,9 @@ export const quoteMock: QuoteData = {
|
||||
outerVol: 412331,
|
||||
innerVol: 413312,
|
||||
updatedAt: '11:30:00',
|
||||
buyRatio: 48,
|
||||
sellRatio: 52,
|
||||
// 买档量 1503 / 卖档量 1365 → 约 52% / 48%
|
||||
buyRatio: 52,
|
||||
sellRatio: 48,
|
||||
intraday: buildIntraday(),
|
||||
candles: {
|
||||
day: buildCandles(60),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user