|
|
@@ -199,7 +199,7 @@ export default defineComponent({
|
|
|
lastIndex = source.length - 1, // 历史行情最后索引位置
|
|
|
cycleMilliseconds = getCycleMilliseconds(),
|
|
|
newTime = moment(quote.value.lasttime), // 实时行情最新时间
|
|
|
- newPrice = quote.value.last; // 实时行情最新价
|
|
|
+ { last, opened, highest, lowest } = quote.value; // 实时行情
|
|
|
|
|
|
const oldTime = lastIndex === -1 ? newTime : moment(source[lastIndex].date); // 历史行情最后时间
|
|
|
const diffTime = newTime.valueOf() - oldTime.valueOf(); // 计算时间差
|
|
|
@@ -215,10 +215,10 @@ export default defineComponent({
|
|
|
// 新增K线数据
|
|
|
klineData.source.push({
|
|
|
date: newDate,
|
|
|
- open: newPrice,
|
|
|
- close: newPrice,
|
|
|
- lowest: newPrice,
|
|
|
- highest: newPrice,
|
|
|
+ open: opened,
|
|
|
+ close: last,
|
|
|
+ lowest: lowest,
|
|
|
+ highest: highest,
|
|
|
ma5: '-',
|
|
|
ma10: '-',
|
|
|
ma15: '-',
|
|
|
@@ -256,13 +256,13 @@ export default defineComponent({
|
|
|
} else {
|
|
|
// 更新列表中最后一条记录的数据
|
|
|
const item = source[lastIndex];
|
|
|
- if (item.lowest > newPrice) {
|
|
|
- item.lowest = newPrice; // 更新最低价
|
|
|
+ if (item.lowest > last) {
|
|
|
+ item.lowest = last; // 更新最低价
|
|
|
}
|
|
|
- if (item.highest < newPrice) {
|
|
|
- item.highest = newPrice; // 更新最高价
|
|
|
+ if (item.highest < last) {
|
|
|
+ item.highest = last; // 更新最高价
|
|
|
}
|
|
|
- item.close = newPrice; // 更新收盘价
|
|
|
+ item.close = last; // 更新收盘价
|
|
|
}
|
|
|
|
|
|
// 更新各种指标
|