盘口数据优化
This commit is contained in:
parent
bc1cd1297a
commit
671a6355da
@ -71,18 +71,22 @@ export function mapBaiduQuotationToQuote(result: BaiduQuotationResult): QuoteDat
|
|||||||
const asksRaw = result.askinfos ?? []
|
const asksRaw = result.askinfos ?? []
|
||||||
const bidsRaw = result.buyinfos ?? []
|
const bidsRaw = result.buyinfos ?? []
|
||||||
|
|
||||||
// 盘口:接口卖档为卖5→卖1,买档为买1→买5,与 UI 一致
|
// 盘口:接口卖档为卖5→卖1,买档为买1→买5;价格为 "0.0"/0 的空档不展示
|
||||||
const asks = asksRaw.map((a, i) => ({
|
const asks = asksRaw
|
||||||
|
.map((a, i) => ({
|
||||||
level: asksRaw.length - i,
|
level: asksRaw.length - i,
|
||||||
price: toNum(a.askprice),
|
price: toNum(a.askprice),
|
||||||
volume: toNum(a.askvolume),
|
volume: toNum(a.askvolume),
|
||||||
}))
|
}))
|
||||||
|
.filter((a) => a.price > 0)
|
||||||
|
|
||||||
const bids = bidsRaw.map((b, i) => ({
|
const bids = bidsRaw
|
||||||
|
.map((b, i) => ({
|
||||||
level: i + 1,
|
level: i + 1,
|
||||||
price: toNum(b.bidprice),
|
price: toNum(b.bidprice),
|
||||||
volume: toNum(b.bidvolume),
|
volume: toNum(b.bidvolume),
|
||||||
}))
|
}))
|
||||||
|
.filter((b) => b.price > 0)
|
||||||
|
|
||||||
// 买卖力度条按五档挂单量汇总,而非外盘/内盘
|
// 买卖力度条按五档挂单量汇总,而非外盘/内盘
|
||||||
const bidVol = bids.reduce((sum, b) => sum + b.volume, 0)
|
const bidVol = bids.reduce((sum, b) => sum + b.volume, 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user