|
|
@@ -4,7 +4,6 @@ import { geLoginID_number, isLogin } from '@/services/bus/login';
|
|
|
import { getToken } from '@/services/bus/token';
|
|
|
import { funCode } from '@/services/funcode/index';
|
|
|
import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
|
|
|
-import { mergeObj } from '@/utils/objHandle';
|
|
|
import { Package40 } from '@/utils/websocket/package';
|
|
|
import Long from 'long';
|
|
|
import moment from 'moment';
|
|
|
@@ -124,65 +123,165 @@ export function parseReceivePush(quotationData: any) {
|
|
|
}
|
|
|
const quoteDayInfo = APP.getRef('quoteDayInfo');
|
|
|
const itemQuote = quoteDayInfo.value.find((el: QueryQuoteDayRsp) => el.goodscode === goodsQuoteTik.goodscode);
|
|
|
+ // debugger
|
|
|
if (itemQuote) {
|
|
|
const goods = getGoodsByCode(itemQuote.goodscode);
|
|
|
if (goods) {
|
|
|
- // 处理报价小数为
|
|
|
- const decimalplace = goods.decimalplace
|
|
|
- const num = Math.pow(10, decimalplace)
|
|
|
- const fn = (value: number) => +(value / num).toFixed(decimalplace)
|
|
|
- goodsQuoteTik.decimalplace = decimalplace
|
|
|
- goodsQuoteTik.last = goodsQuoteTik.last ? fn(goodsQuoteTik.last) : '--'
|
|
|
- // goodsQuoteTik.presettle = goodsQuoteTik.presettle ? (fn(goodsQuoteTik.presettle)) : '--'
|
|
|
- goodsQuoteTik.ask = goodsQuoteTik.ask ? (fn(goodsQuoteTik.ask)) : '--'
|
|
|
- goodsQuoteTik.ask2 = goodsQuoteTik.ask2 ? (fn(goodsQuoteTik.ask2)) : '--'
|
|
|
- goodsQuoteTik.ask3 = goodsQuoteTik.ask3 ? (fn(goodsQuoteTik.ask3)) : '--'
|
|
|
- goodsQuoteTik.ask4 = goodsQuoteTik.ask4 ? (fn(goodsQuoteTik.ask4)) : '--'
|
|
|
- goodsQuoteTik.ask5 = goodsQuoteTik.ask5 ? (fn(goodsQuoteTik.ask5)) : '--'
|
|
|
- goodsQuoteTik.ask6 = goodsQuoteTik.ask6 ? (fn(goodsQuoteTik.ask6)) : '--'
|
|
|
- goodsQuoteTik.ask7 = goodsQuoteTik.ask7 ? (fn(goodsQuoteTik.ask7)) : '--'
|
|
|
- goodsQuoteTik.ask8 = goodsQuoteTik.ask8 ? (fn(goodsQuoteTik.ask8)) : '--'
|
|
|
- goodsQuoteTik.ask9 = goodsQuoteTik.ask9 ? (fn(goodsQuoteTik.ask9)) : '--'
|
|
|
- goodsQuoteTik.ask10 = goodsQuoteTik.ask10 ? (fn(goodsQuoteTik.ask10)) : '--'
|
|
|
- goodsQuoteTik.bid = goodsQuoteTik.bid ? (fn(goodsQuoteTik.bid)) : '--'
|
|
|
- goodsQuoteTik.bid2 = goodsQuoteTik.bid2 ? (fn(goodsQuoteTik.bid2)) : '--'
|
|
|
- goodsQuoteTik.bid3 = goodsQuoteTik.bid3 ? (fn(goodsQuoteTik.bid3)) : '--'
|
|
|
- goodsQuoteTik.bid4 = goodsQuoteTik.bid4 ? (fn(goodsQuoteTik.bid4)) : '--'
|
|
|
- goodsQuoteTik.bid5 = goodsQuoteTik.bid5 ? (fn(goodsQuoteTik.bid5)) : '--'
|
|
|
- goodsQuoteTik.bid6 = goodsQuoteTik.bid6 ? (fn(goodsQuoteTik.bid6)) : '--'
|
|
|
- goodsQuoteTik.bid7 = goodsQuoteTik.bid7 ? (fn(goodsQuoteTik.bid7)) : '--'
|
|
|
- goodsQuoteTik.bid8 = goodsQuoteTik.bid8 ? (fn(goodsQuoteTik.bid8)) : '--'
|
|
|
- goodsQuoteTik.bid9 = goodsQuoteTik.bid9 ? (fn(goodsQuoteTik.bid9)) : '--'
|
|
|
- goodsQuoteTik.bid10 = goodsQuoteTik.bid10 ? (fn(goodsQuoteTik.bid10)) : '--'
|
|
|
- goodsQuoteTik.averageprice = goodsQuoteTik.averageprice ? (fn(goodsQuoteTik.averageprice)) : '--'
|
|
|
- goodsQuoteTik.grepmarketprice = goodsQuoteTik.grepmarketprice ? (fn(goodsQuoteTik.grepmarketprice)) : '--'
|
|
|
- goodsQuoteTik.highest = goodsQuoteTik.highest ? (fn(goodsQuoteTik.highest)) : '--'
|
|
|
- goodsQuoteTik.iep = goodsQuoteTik.iep ? (fn(goodsQuoteTik.iep)) : '--'
|
|
|
- goodsQuoteTik.limitdown = goodsQuoteTik.limitdown ? (fn(goodsQuoteTik.limitdown)) : '--'
|
|
|
- goodsQuoteTik.limitup = goodsQuoteTik.limitup ? (fn(goodsQuoteTik.limitup)) : '--'
|
|
|
- goodsQuoteTik.lowest = goodsQuoteTik.lowest ? (fn(goodsQuoteTik.lowest)) : '--'
|
|
|
- goodsQuoteTik.opened = goodsQuoteTik.opened ? (fn(goodsQuoteTik.opened)) : '--'
|
|
|
- goodsQuoteTik.preclose = goodsQuoteTik.preclose ? (fn(goodsQuoteTik.preclose)) : '--'
|
|
|
- goodsQuoteTik.settle = goodsQuoteTik.settle ? (fn(goodsQuoteTik.settle)) : '--'
|
|
|
- goodsQuoteTik.strikeprice = goodsQuoteTik.strikeprice ? (fn(goodsQuoteTik.strikeprice)) : '--'
|
|
|
+ console.log('goodsQuoteTik', goodsQuoteTik)
|
|
|
+ // 判断是一下行情时间是否比现在的要早
|
|
|
+ const quoteTime = moment(goodsQuoteTik.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
+ const localTime = moment(itemQuote.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
+ if (quoteTime >= localTime) {
|
|
|
+ // 实时行情由于行情源的问题可能不会下发现量,这时用盘面的总量来计算
|
|
|
+ if (!goodsQuoteTik.lastvolume) {
|
|
|
+ if (itemQuote.totalvolume) {
|
|
|
+ itemQuote.lastvolume = goodsQuoteTik.totalvolume - itemQuote.totalvolume;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // mergeObj(itemQuote, goodsQuoteTik);
|
|
|
+ // 处理报价小数为
|
|
|
+ const decimalplace = goods.decimalplace
|
|
|
+ const num = Math.pow(10, decimalplace)
|
|
|
+ const fn = (value: number) => +(value / num).toFixed(decimalplace)
|
|
|
+ //
|
|
|
+ // 处理 报价小数位
|
|
|
+ const handleDeimalplace = (key: string) => {
|
|
|
+ return goodsQuoteTik[key] ? fn(goodsQuoteTik[key]) : itemQuote[key]
|
|
|
+ }
|
|
|
+ // 处理 如果有值则更新值,没有的话,则取上次的值
|
|
|
+ const handleNoneValue = (key: string) => {
|
|
|
+ return goodsQuoteTik[key] ? goodsQuoteTik[key] : itemQuote[key]
|
|
|
+ }
|
|
|
+ // 处理价格
|
|
|
+ itemQuote.decimalplace = decimalplace
|
|
|
+ itemQuote.last = handleDeimalplace('last')
|
|
|
+ itemQuote.ask = handleDeimalplace('ask')
|
|
|
+ itemQuote.ask2 = handleDeimalplace('ask2')
|
|
|
+ itemQuote.ask3 = handleDeimalplace('ask3')
|
|
|
+ itemQuote.ask4 = handleDeimalplace('ask4')
|
|
|
+ itemQuote.ask5 = handleDeimalplace('ask5')
|
|
|
+ itemQuote.ask6 = handleDeimalplace('ask6')
|
|
|
+ itemQuote.ask7 = handleDeimalplace('ask7')
|
|
|
+ itemQuote.ask8 = handleDeimalplace('ask8')
|
|
|
+ itemQuote.ask9 = handleDeimalplace('ask9')
|
|
|
+ itemQuote.ask10 = handleDeimalplace('ask10')
|
|
|
+ itemQuote.bid = handleDeimalplace('bid')
|
|
|
+ itemQuote.bid2 = handleDeimalplace('bid2')
|
|
|
+ itemQuote.bid3 = handleDeimalplace('bid3')
|
|
|
+ itemQuote.bid4 = handleDeimalplace('bid4')
|
|
|
+ itemQuote.bid5 = handleDeimalplace('bid5')
|
|
|
+ itemQuote.bid6 = handleDeimalplace('bid6')
|
|
|
+ itemQuote.bid7 = handleDeimalplace('bid7')
|
|
|
+ itemQuote.bid8 = handleDeimalplace('bid8')
|
|
|
+ itemQuote.bid9 = handleDeimalplace('bid9')
|
|
|
+ itemQuote.averageprice = handleDeimalplace('averageprice')
|
|
|
+ itemQuote.grepmarketprice = handleDeimalplace('grepmarketprice')
|
|
|
+ itemQuote.highest = handleDeimalplace('highest')
|
|
|
+ itemQuote.iep = handleDeimalplace('iep')
|
|
|
+ itemQuote.limitdown = handleDeimalplace('limitdown')
|
|
|
+ itemQuote.limitup = handleDeimalplace('limitup')
|
|
|
+ itemQuote.lowest = handleDeimalplace('lowest')
|
|
|
+ itemQuote.opened = handleDeimalplace('opened')
|
|
|
+ itemQuote.lastturnover = handleDeimalplace('lastturnover')
|
|
|
+ itemQuote.nontotalturnover = handleDeimalplace('nontotalturnover')
|
|
|
+ itemQuote.lastturnover = handleDeimalplace('lastturnover')
|
|
|
+ itemQuote.preclose = handleDeimalplace('preclose')
|
|
|
+ itemQuote.settle = handleDeimalplace('settle')
|
|
|
+ itemQuote.totalturnover = handleDeimalplace('totalturnover')
|
|
|
|
|
|
- goodsQuoteTik.lasttime = moment(goodsQuoteTik.date + goodsQuoteTik.time, 'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ itemQuote.askorderid = handleNoneValue('askorderid')
|
|
|
+ itemQuote.askorderid2 = handleNoneValue('askorderid2')
|
|
|
+ itemQuote.askorderid3 = handleNoneValue('askorderid3')
|
|
|
+ itemQuote.askorderid4 = handleNoneValue('askorderid4')
|
|
|
+ itemQuote.askorderid5 = handleNoneValue('askorderid5')
|
|
|
+ itemQuote.askordervolume = handleNoneValue('askordervolume')
|
|
|
+ itemQuote.askordervolume2 = handleNoneValue('askordervolume2')
|
|
|
+ itemQuote.askordervolume3 = handleNoneValue('askordervolume3')
|
|
|
+ itemQuote.askordervolume4 = handleNoneValue('askordervolume4')
|
|
|
+ itemQuote.askordervolume5 = handleNoneValue('askordervolume5')
|
|
|
+ itemQuote.askordervolume6 = handleNoneValue('askordervolume6')
|
|
|
+ itemQuote.askordervolume7 = handleNoneValue('askordervolume7')
|
|
|
+ itemQuote.askordervolume8 = handleNoneValue('askordervolume8')
|
|
|
+ itemQuote.askordervolume9 = handleNoneValue('askordervolume9')
|
|
|
+ itemQuote.askqueueinfo = handleNoneValue('askqueueinfo')
|
|
|
+ itemQuote.askvolume = handleNoneValue('askvolume')
|
|
|
+ itemQuote.askvolume2 = handleNoneValue('askvolume2')
|
|
|
+ itemQuote.askvolume3 = handleNoneValue('askvolume3')
|
|
|
+ itemQuote.askvolume4 = handleNoneValue('askvolume4')
|
|
|
+ itemQuote.askvolume5 = handleNoneValue('askvolume5')
|
|
|
+ itemQuote.askvolume6 = handleNoneValue('askvolume6')
|
|
|
+ itemQuote.askvolume7 = handleNoneValue('askvolume7')
|
|
|
+ itemQuote.askvolume8 = handleNoneValue('askvolume8')
|
|
|
+ itemQuote.askvolume9 = handleNoneValue('askvolume9')
|
|
|
|
|
|
- // !goodsQuoteTik.bidvolume && (goodsQuoteTik.bidvolume = '--')
|
|
|
- // !goodsQuoteTik.askvolume && (goodsQuoteTik.askvolume = '--')
|
|
|
- // !goodsQuoteTik.lastvolume && (goodsQuoteTik.lastvolume = '--')
|
|
|
- // 实时行情由于行情源的问题可能不会下发现量,这时用盘面的总量来计算
|
|
|
- if (!goodsQuoteTik.lastvolume) {
|
|
|
- if (itemQuote.totalvolume) {
|
|
|
- goodsQuoteTik.lastvolume = goodsQuoteTik.totalvolume - itemQuote.totalvolume;
|
|
|
- } else {
|
|
|
- goodsQuoteTik.lastvolume = "--";
|
|
|
- }
|
|
|
+ itemQuote.bidorderid = handleNoneValue('bidorderid')
|
|
|
+ itemQuote.bidorderid2 = handleNoneValue('bidorderid2')
|
|
|
+ itemQuote.bidorderid3 = handleNoneValue('bidorderid3')
|
|
|
+ itemQuote.bidorderid4 = handleNoneValue('bidorderid4')
|
|
|
+ itemQuote.bidorderid5 = handleNoneValue('bidorderid5')
|
|
|
+ itemQuote.bidordervolume = handleNoneValue('bidordervolume')
|
|
|
+ itemQuote.bidordervolume2 = handleNoneValue('bidordervolume2')
|
|
|
+ itemQuote.bidordervolume3 = handleNoneValue('bidordervolume3')
|
|
|
+ itemQuote.bidordervolume4 = handleNoneValue('bidordervolume4')
|
|
|
+ itemQuote.bidordervolume5 = handleNoneValue('bidordervolume5')
|
|
|
+ itemQuote.bidordervolume6 = handleNoneValue('bidordervolume6')
|
|
|
+ itemQuote.bidordervolume7 = handleNoneValue('bidordervolume7')
|
|
|
+ itemQuote.bidordervolume8 = handleNoneValue('bidordervolume8')
|
|
|
+ itemQuote.bidordervolume9 = handleNoneValue('bidordervolume9')
|
|
|
+ itemQuote.bidqueueinfo = handleNoneValue('bidqueueinfo')
|
|
|
+ itemQuote.bidvolume = handleNoneValue('bidvolume')
|
|
|
+ itemQuote.bidvolume2 = handleNoneValue('bidvolume2')
|
|
|
+ itemQuote.bidvolume3 = handleNoneValue('bidvolume3')
|
|
|
+ itemQuote.bidvolume4 = handleNoneValue('bidvolume4')
|
|
|
+ itemQuote.bidvolume5 = handleNoneValue('bidvolume5')
|
|
|
+ itemQuote.bidvolume6 = handleNoneValue('bidvolume6')
|
|
|
+ itemQuote.bidvolume7 = handleNoneValue('bidvolume7')
|
|
|
+ itemQuote.bidvolume8 = handleNoneValue('bidvolume8')
|
|
|
+ itemQuote.bidvolume9 = handleNoneValue('bidvolume9')
|
|
|
+ itemQuote.calloptionpremiums = handleNoneValue('calloptionpremiums')
|
|
|
+ itemQuote.calloptionpremiums2 = handleNoneValue('calloptionpremiums2')
|
|
|
+ itemQuote.calloptionpremiums3 = handleNoneValue('calloptionpremiums3')
|
|
|
+ itemQuote.calloptionpremiums4 = handleNoneValue('calloptionpremiums4')
|
|
|
+ itemQuote.calloptionpremiums5 = handleNoneValue('calloptionpremiums5')
|
|
|
+ itemQuote.holdincrement = handleNoneValue('holdincrement')
|
|
|
+ itemQuote.holdvolume = handleNoneValue('holdvolume')
|
|
|
+ itemQuote.inventory = handleNoneValue('inventory')
|
|
|
+ itemQuote.lastlot = handleNoneValue('lastlot')
|
|
|
+ itemQuote.nontotalholdervolume = handleNoneValue('nontotalholdervolume')
|
|
|
+ itemQuote.nontotallot = handleNoneValue('nontotallot')
|
|
|
+ itemQuote.nontotalvolume = handleNoneValue('nontotalvolume')
|
|
|
+ itemQuote.totallot = handleNoneValue('totallot')
|
|
|
+ itemQuote.totalvolume = handleNoneValue('totalvolume')
|
|
|
}
|
|
|
- !goodsQuoteTik.holdvolume && (goodsQuoteTik.holdvolume = '--')
|
|
|
- !goodsQuoteTik.holdincrement && (goodsQuoteTik.holdincrement = '--')
|
|
|
+
|
|
|
+
|
|
|
+ // goodsQuoteTik.averageprice = goodsQuoteTik.averageprice ? (fn(goodsQuoteTik.averageprice)) : '--'
|
|
|
+ // goodsQuoteTik.grepmarketprice = goodsQuoteTik.grepmarketprice ? (fn(goodsQuoteTik.grepmarketprice)) : '--'
|
|
|
+ // goodsQuoteTik.highest = goodsQuoteTik.highest ? (fn(goodsQuoteTik.highest)) : '--'
|
|
|
+ // goodsQuoteTik.iep = goodsQuoteTik.iep ? (fn(goodsQuoteTik.iep)) : '--'
|
|
|
+ // goodsQuoteTik.limitdown = goodsQuoteTik.limitdown ? (fn(goodsQuoteTik.limitdown)) : '--'
|
|
|
+ // goodsQuoteTik.limitup = goodsQuoteTik.limitup ? (fn(goodsQuoteTik.limitup)) : '--'
|
|
|
+ // goodsQuoteTik.lowest = goodsQuoteTik.lowest ? (fn(goodsQuoteTik.lowest)) : '--'
|
|
|
+ // goodsQuoteTik.opened = goodsQuoteTik.opened ? (fn(goodsQuoteTik.opened)) : '--'
|
|
|
+ // goodsQuoteTik.preclose = goodsQuoteTik.preclose ? (fn(goodsQuoteTik.preclose)) : '--'
|
|
|
+ // goodsQuoteTik.settle = goodsQuoteTik.settle ? (fn(goodsQuoteTik.settle)) : '--'
|
|
|
+ // goodsQuoteTik.strikeprice = goodsQuoteTik.strikeprice ? (fn(goodsQuoteTik.strikeprice)) : '--'
|
|
|
+
|
|
|
+ // goodsQuoteTik.lasttime = moment(goodsQuoteTik.date + goodsQuoteTik.time, 'YYYYMMDDHHmmss').format('YYYY-MM-DD HH:mm:ss')
|
|
|
+
|
|
|
+ // // 实时行情由于行情源的问题可能不会下发现量,这时用盘面的总量来计算
|
|
|
+ // if (!goodsQuoteTik.lastvolume) {
|
|
|
+ // if (itemQuote.totalvolume) {
|
|
|
+ // goodsQuoteTik.lastvolume = goodsQuoteTik.totalvolume - itemQuote.totalvolume;
|
|
|
+ // } else {
|
|
|
+ // goodsQuoteTik.lastvolume = "--";
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // !goodsQuoteTik.holdvolume && (goodsQuoteTik.holdvolume = '--')
|
|
|
+ // !goodsQuoteTik.holdincrement && (goodsQuoteTik.holdincrement = '--')
|
|
|
// !goodsQuoteTik.totalturnover && (goodsQuoteTik.totalturnover = '--')
|
|
|
- mergeObj(itemQuote, goodsQuoteTik);
|
|
|
+ // console.log('goodsQuoteTik', goodsQuoteTik)
|
|
|
+ // mergeObj(itemQuote, goodsQuoteTik);
|
|
|
} else {
|
|
|
console.warn(`行情推送的商品goods:${itemQuote.goodscode}在商品列表里不存在`)
|
|
|
}
|
|
|
@@ -191,11 +290,11 @@ export function parseReceivePush(quotationData: any) {
|
|
|
// 之前是 通过 websocket 查询的,故 可能存在字段发生变化问题,如遇到,则进行优化处理
|
|
|
|
|
|
// 判断是一下行情时间是否比现在的要早
|
|
|
- const quoteTime = moment(goodsQuoteTik.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
- const localTime = moment(itemQuote.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
- if (quoteTime >= localTime) {
|
|
|
- mergeObj(itemQuote, goodsQuoteTik);
|
|
|
- }
|
|
|
+ // const quoteTime = moment(goodsQuoteTik.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
+ // const localTime = moment(itemQuote.lasttime, 'YYYY-MM-DD HH:mm:ss')
|
|
|
+ // if (quoteTime >= localTime) {
|
|
|
+ // mergeObj(itemQuote, goodsQuoteTik);
|
|
|
+ // }
|
|
|
} else {
|
|
|
// 此处 待优化(存在字段变化问题)
|
|
|
quoteDayInfo.push(itemQuote);
|